Hand out loot to a thousand players
Minting per drop makes your issuer account a global write lock. Publish one root instead, and let each player write their own claim.
You are probably here because somebody asked for
- hand out rewards to a lot of players at once
- implement loot drops that are actually on-chain
- airdrop items or currency to thousands of players
Status: M1 of eleven. The SDK is real and runs end to end. The chain underneath it is an in-memory mock — there is no public network yet, and nothing anywhere holds value.
The naive version works until it is used. One account has one chain, so a thousand rewards is a thousand sequential writes on your issuer, and the queue behind them is the game.
The fix moves the signature to the player. The issuer publishes one block containing a root that commits to the whole batch; each player is handed a proof and writes their own claim, from their own account, with no contention between them.
const drop = await gems.commit([
{ to: playerA, amount: 500 },
{ to: playerB, amount: 120 },
// ...thousands more
])
send(playerA, drop.proofFor(playerA)) // plain JSON, hand it over however you likeawait kei.claims.add(bundle)
// Claiming happens in the background. A forged proof, a forged amount, or a
// second claim from the same account is rejected by the ledger, not the SDK.When a batch is old, close it: await gems.close(drop.root). Closed roots take no further claims and become prunable. Nothing expires on a timer — this chain has no clock, deliberately.
What is not true yet
- The chain is an in-memory mock today. The API is real and does not change when the node lands, but nothing on it holds value and there is no public network yet.
- You must deliver the proof to the player yourself. The chain stores a root, not a list of who is owed what — that is the whole reason it is cheap.
- One entitlement per account per root. Two rewards for the same player in one batch merge into one leaf.
- A claim is a block, so a player who never comes back never claims. Budget for unclaimed drops rather than assuming delivery.