swarm-keydb

Getting Started (5 minutes)

This guide gets you from zero to a working put/get round-trip in minutes.

[!IMPORTANT] If you run with Bee storage (SWARM_KEYDB_BACKEND=bee), you must provide a valid postage batch id. See docs/deployment.md.

Prerequisites

Quickstart (local backend)

# 1) start the server
 dotnet run --project src/SwarmKeyDb.Server/SwarmKeyDb.Server.csproj
# 2) in another terminal, write and read
 redis-cli -p 6379 SET demo:key "hello swarm"
 redis-cli -p 6379 GET demo:key

Expected output:

OK
"hello swarm"

Bee-backed quickstart

export SWARM_KEYDB_BACKEND=bee
export BEE_URL=http://localhost:1633/
export BEE_POSTAGE_BATCH_ID=<your-postage-batch-id>
dotnet run --project src/SwarmKeyDb.Server/SwarmKeyDb.Server.csproj

Then run the same SET/GET commands above.

Stream quickstart (XADD + XRANGE)

redis-cli -p 6379 XADD events * type created user alice
redis-cli -p 6379 XADD events * type updated user alice
redis-cli -p 6379 XRANGE events - +
redis-cli -p 6379 XREVRANGE events + - COUNT 1
redis-cli -p 6379 XLEN events

Expected shape:

<ms>-<seq>
1) 1) "<ms>-<seq>"
   2) 1) "type"
      2) "created"
      3) "user"
      4) "alice"
...

IPFS-backed quickstart

export BACKEND=ipfs
export IPFS_API_URL=http://localhost:5001/
dotnet run --project src/SwarmKeyDb.Server/SwarmKeyDb.Server.csproj

Verify from C# client

dotnet run --project examples/UserProfileExample/UserProfileExample.csproj

Troubleshooting