COOK N/A
Last Block- HealthChecking Treasury0 COOK Head-
BT--:--
PoSOFF PoW0 H/s Nodes0/0
Gas- COOK
Cookchain Explorer

Cookchain Game Protocol v1

Game Publisher Documentation

Connect a game without an operator admin key. A Cookchain wallet proves ownership once, the chain issues a game-specific key, and the game then synchronizes resources and NFTs through idempotent events.

RPC base: https://rpc.ldbl.netExplorer v2026.08.30.1

Security model

  • The wallet private key stays with the publisher and only signs the registration challenge.
  • The random register key is hashed before the challenge. It is not the wallet key.
  • The returned game_secure_key is shown once and belongs only on the game backend.
  • Every mutation needs a unique event_id. Reusing it makes retries idempotent.
  • Never call game mutation endpoints directly from an untrusted browser.

Endpoints

POST /game/register/challengeStart wallet-owned registration
POST /game/register/completeVerify signature and issue game key
POST /game/assets/bootstrapCreate resource contracts and NFT schemas
POST /game/resource/reconcileSet an authoritative resource snapshot
POST /game/nft/mintMint an NFT with URI and metadata
GET /game/wallet/:walletRead synchronized game assets

1. Registration challenge

POST https://rpc.ldbl.net/game/register/challenge
Content-Type: application/json

{
  "id": "my-game",
  "name": "My Game",
  "owner": "CoYOUR_WALLET",
  "register_key_hash": "BLAKE3_HEX_OF_RANDOM_REGISTER_KEY"
}

Sign the exact returned message bytes with the owner wallet's secp256k1 key. Cookchain addresses are RIPEMD160(SHA256(uncompressed_public_key)) with the Co prefix.

2. Complete registration

POST https://rpc.ldbl.net/game/register/complete
Content-Type: application/json

{
  "challenge_id": "RETURNED_CHALLENGE_ID",
  "register_key": "YOUR_RANDOM_REGISTER_KEY",
  "public_key_hex": "COMPRESSED_SECP256K1_PUBLIC_KEY",
  "signature_hex": "64_BYTE_COMPACT_ECDSA_SIGNATURE"
}

Store the returned game_secure_key in the game server's secret store. Send it on later calls as X-Game-Key.

3. Bootstrap resources and NFT schemas

POST https://rpc.ldbl.net/game/assets/bootstrap
X-Game-Key: GAME_SECURE_KEY
Content-Type: application/json

{
  "game_id": "my-game",
  "event_prefix": "bootstrap-v1",
  "resources": [{
    "symbol": "WOOD", "name": "Wood", "decimals": 0,
    "game_id": "my-game", "category": "resource",
    "max_supply": "1000000000",
    "logo_uri": "https://game.example/assets/wood.webp"
  }],
  "nft_schemas": [{
    "game_id": "my-game", "name": "Ship",
    "uri_template": "https://game.example/nft/ship/{id}.json",
    "logo_uri": "https://game.example/assets/ship.webp",
    "transferable": true
  }]
}

Icons must use HTTPS or IPFS. Resource and NFT contract addresses are derived deterministically by the chain and returned in API responses.

4. Reconcile the current game state

POST https://rpc.ldbl.net/game/resource/reconcile
X-Game-Key: GAME_SECURE_KEY
Content-Type: application/json

{
  "event_id": "player-42:resources:revision-187144",
  "game_id": "my-game",
  "wallet": [20 ADDRESS BYTES],
  "resources": [
    { "symbol": "WOOD", "amount": "275" },
    { "symbol": "IRON", "amount": "41" }
  ]
}

Use monotonically increasing game revisions in event IDs. Keep a durable outbox in the game database and retry failed events. Never delete local game inventory merely because an RPC read temporarily fails.

Transactions and Explorer

Every resource and NFT mutation produces a cookchain-game-event-v1 transaction envelope containing game_id, action, event_id and payload. These records appear in the Gaming Engine section and normal transaction detail pages.

Production checklist

  • Use the public RPC, not the validator's private control port.
  • Restrict the game key to the backend secret store.
  • Serve immutable WebP icons over HTTPS or IPFS.
  • Persist an outbox and retry with unchanged event IDs.
  • Reconcile snapshots periodically and monitor diagnostics.