← Docs · Collection

Verification (proof of work)

The exact keccak-256 proof-of-work rule of Spirit Cards. The core is 0x0997DB0BEa2c1278063ebBEc0d1cdbecE7B6F021 and the tunable difficulty lives in the Config contract. Anyone can recompute a card's seed from its public on-chain values.

Preimage

The miner grinds a 64-bit nonce until the keccak-256 hash of this 104-byte preimage has enough leading zero bits:

work = keccak256(abi.encodePacked(
    uint256 chainId,   // 32 bytes, big-endian
    address core,      // 20 bytes
    address miner,     // 20 bytes
    uint256 nonce      // 32 bytes, big-endian
))
// 32 + 20 + 20 + 32 = 104 bytes (one Keccak-256 rate block)
// chainId = 4663

Validity rule

A nonce is valid iff the number of leading zero bits of the work hash is at least Config.baseBits():

valid  <=>  leadingZeroBits(work) >= Config.baseBits()

// Expected attempts ~= 2^baseBits
// Nonces are single-use per wallet (nonceUsed[miner][nonce])

Verify without a transaction

Recompute workFor(miner, nonce) locally and compare its leading zero bits to baseBits(). On-chain, core.workFor(miner, nonce) returns the same hash.

recompute  work = keccak256(chainId, core, miner, nonce)
compare    leadingZeroBits(work) >= Config.baseBits()
Contract0x0997DB0BEa2c1278063ebBEc0d1cdbecE7B6F021
Config0x678629B80ab8A3Bc049e0FaBca7Aa5De826c8819
Chain4663
Spirit CardsBuilt on Robinhood Chain · Collect · Evolve · Stake · Battle// A more elemental tomorrow