keicoin.org use cases docs examples status llms.txt

Build an inventory system

An item is a token with supply 1 and 0 decimals — not a special type, not a second code path, and no indexer to run. Ownership is balanceOf.

You are probably here because somebody asked for

  • build an inventory system for my game
  • let players own items that persist
  • add equipment / collectibles / NFT-style items without the NFT stack

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.

Most item systems become two systems: the items, and the index that makes "what does this player own?" answerable. The index is the part that breaks, lags, and needs re-syncing.

Kei has no indexer because it does not need one. The same facts are stored in both directions — by account and by asset — so both questions are one lookup.

Create, mint, transfer, ask who owns it
const sword = await game.items.create({
  name: 'Sword of Testing',
  description: 'It tests things.',
  image: './sword.png',
  supply: 100,             // omit for a unique item
  transfer: 'open',        // 'none' is soulbound
})

await game.items.mint(sword.id, playerAddress)

// Player side, signed by the player — there is no 'from' argument
await kei.items.transfer(sword.id, toAddress)
await kei.items.owner(sword.id)     // 'kei_3abc...'
await kei.items.ownedBy(address)    // [ item, ... ]

Why this is worth doing

The inventory outlives your server. A player can open a wallet that has never heard of your game and see what they own — which is what makes "players own their items" true rather than a slogan. If the inventory lives only in your database, it is your inventory.

It also means your progression system has no save file. The demo restores every upgrade a player bought by reading the chain on load.

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.
  • Items are not the place for per-instance mutable state. Durability, enchantments, and stack counts that change every minute belong in your game, not on a chain. Model the item; keep the fiddly state local.
  • An account has a cap on how many distinct assets it can hold, so an item type per player per session is the wrong shape.
  • No royalties, no marketplace fees, and no VM to implement them in.