An authenticated key-value database using secp256k1 signatures (compatible with Ethereum wallets).
This service allows storing and retrieving data associated with Ethereum addresses, where only the owner of the private key can modify their data. All write operations require a valid signature from the address owner, ensuring data integrity and authentication.
Key features:
- Read/write/delete string values associated with Ethereum addresses
- Namespace support for organizing data
- Counter-based versioning to prevent data overwrites
- JSONRPC API with CORS support
- Designed for Cloudflare Workers with KV storage
# Clone the repository
git clone https://github.com/etherplay/secp256k1-db.git
cd secp256k1-db
pnpm install
To start the development server:
pnpm start
This will start a local Cloudflare Workers development server.
To deploy to Cloudflare Workers:
pnpm run deploy
Retrieves data associated with an Ethereum address in a specific namespace.
Parameters:
address
: Ethereum address (0x-prefixed)namespace
: String namespace
Example:
{
"jsonrpc": "2.0",
"id": 1,
"method": "wallet_getString",
"params": ["0x1234567890123456789012345678901234567890", "my-namespace"]
}
Stores data associated with an Ethereum address in a specific namespace. Requires a valid signature.
Parameters:
address
: Ethereum address (0x-prefixed)namespace
: String namespacecounter
: Counter value (typically current timestamp in ms)data
: String data to storesignature
: Signed message ofput:${namespace}:${counter}:${data}
Example:
{
"jsonrpc": "2.0",
"id": 1,
"method": "wallet_putString",
"params": [
"0x1234567890123456789012345678901234567890",
"my-namespace",
"1632146788123",
"Hello, world!",
"0x123...signature"
]
}
In wrangler.toml
:
- Set up your KV namespace bindings
- Configure your Cloudflare Worker name and compatibility date
See the LICENSE file for details.