Whitepaper

How the deck stays honest

The mechanics behind CardEntropy, and the (illustrative) economics around $CARD.

1. Why this exists

For a card game, the shuffle basically *is* the game - so whoever controls it controls the outcome. That's the problem a verifiable, permissionlessly-relayed randomness source solves: it lets a game trust the deck without trusting whoever built the game, and without every team having to build its own oracle from scratch.

2. The moving parts

Three of them:

  • CardEntropy - one immutable contract handling dealer registration, requests, reveal checks, and callbacks back to whoever asked.
  • Dealer keeper - an off-chain process watching for requests and posting reveals. It's a convenience, not a dependency - anyone can submit a valid reveal, so there's no single point that has to stay honest or even stay online.
  • Consumer contracts - anything implementing ICardConsumer, like the reference DemoCardGame.

3. The commit-reveal chain

A dealer builds a one-way hash chain off-chain and publishes only its tip. Each reveal hands over the next preimage down that chain - self-checking, since anyone can hash it and compare it against what was committed before.

hash-chain.txt
chain[0]              = random 32-byte seed
chain[i]               = keccak256(chain[i-1])
tip = chain[N-1]        -> published on-chain as the commitment

reveal(request #0)  = chain[N-2]   // keccak256(chain[N-2]) == tip
reveal(request #1)  = chain[N-3]   // keccak256(chain[N-3]) == chain[N-2]
...
reveal(request #N-2) = chain[0]    // chain exhausted after this

The actual card ids fall out of combining that reveal with the requester's own client-supplied value: combinedSeed = keccak256(userRandom, revealedValue, sequenceNumber), run through a standard Fisher-Yates shuffle over a 52-card deck. Neither side knows enough in advance to predict or steer the result on its own.

4. Who pays what

Providers set their own per-request fee (the default dealer charges 0.000025 ETH). Unrevealed requests are refundable to the requester after 90 seconds. Accrued fees are swept by a provider's fee recipient and can be routed into CardStaking for distribution to $CARD stakers.

These numbers are illustrative. This repository ships no real tokenomics, no vesting schedule, and no token sale - $CARD and its staking contract exist to demonstrate the mechanism, not as an investment product. Replace the constants in CardToken.sol and CardStaking.sol before using this for anything beyond an early testnet deployment.

5. What's next

See the roadmap for where this goes from here - more dealers running at once, and eventually some accountability for the ones that don't hold up their end.