Skip to main content

Provable Fairness (VRF)

Every pack is fair in two independent, verifiable steps: a VRF roll decides your tier (Common / Uncommon / Rare / Epic), then a second provable step decides which card you win inside that tier. Both steps come from the same cryptographic VRF output, and everything needed to re-check them is published on Solana. We can't predict, retry, or steer either one — and neither can you. This page explains how, and how to verify any pack yourself.

Verify a pack right now

Open /verify-selection/YOUR_MEMO in your browser, or call GET /api/vrf/verify?memo=YOUR_MEMO. The browser page recomputes everything from scratch (client-side) and checks it against the on-chain record. See Verify your pack.

At a glance​

StepDecidesDriven byCommitted on-chain as
1. The rollyour tierECVRF output (beta bytes 0–8)a VRF proof commit (cc-vrf)
2. The walkyour cardthe same ECVRF output (beta bytes 8–24)the sel_anchor in the award transaction's memo (Solana; on EVM the anchor is published via the verify API — why)

Both steps are decided when you sign, not when the pack opens — see When your card is decided.

A Verifiable Random Function (VRF) is a keyed function: for an input alpha, the key holder produces a random-looking output beta and a proof that beta is the one and only correct output for that key and that input. Anyone with the public key can verify the proof. The holder cannot bias the result, and it's reproducible by every verifier. We use the RFC 9381 ECVRF-EDWARDS25519-SHA512-TAI suite — see the spec links.


Step 1 — The roll picks your tier​

  1. The input is bound to your signature. The VRF input (alpha) is always derived from something only you can produce by signing. We cannot know or influence it until after you have signed — so we can't precompute or "shop for" a favorable roll. Two forms are in use, one per chain, and both are current:

    ChainalphaWhy we can't produce it
    SolanaSHA-256("ccgacha-vrf-v1\0" ‖ your_signature)your wallet's signature on the pack, under a fixed domain tag
    EVMSHA-256(memo ‖ your_payment_tx_hash)an EVM transaction hash is keccak-256 over the signed transaction, so the hash commits to your own ECDSA signature

    These are the same construction in the sense that matters: the input is a value your wallet creates and we cannot forge or predict. Older Solana packs with no stored signature fall back to SHA-256(memo ‖ payment_signature) — still a value you produced by paying.

  2. We evaluate the VRF. Our server runs ECVRF with its secret key over your alpha, producing an 80-byte proof and a 64-byte output beta.

  3. The roll comes from beta. We read the first 8 bytes of beta as a big-endian unsigned integer and reduce it: roll = (beta[0..8] as u64) mod 100,000,000 + 1, a uniform integer in [1, 100,000,000].

  4. The roll maps to a tier using the machine's published rarity weights (see GET /api/machines for the live odds per machine).

Because ECVRF (RFC 9381) guarantees exactly one valid proof and one beta per (public key, alpha), there is no second roll to reach for. The proof either verifies against our public key or it doesn't.


Step 2 — The leaf pool and the Feistel walk pick your card​

Once the tier is known, the same beta selects the specific card — over a candidate set that was frozen and committed before the card was picked.

The leaf pool (the committed candidate set)​

The "leaf pool" is the machine's live prize inventory, snapshotted into an immutable pool version and committed as a Merkle tree:

  • Every eligible card becomes a leaf: leaf = SHA-256( 0x00 || nft_mint(32 bytes) || insured_value_in_cents(u64 BE) ).
  • Leaves are grouped by tier (epic / rare / uncommon / common) and hashed into a per-tier Merkle root.
  • The four tier roots, their counts, and the version number are folded into one version_root — a single 32-byte commitment to the entire candidate set of that pool version.

The pool is rebuilt periodically on a randomized cadence as inventory changes (cards added, won, or returned). Each rebuild produces a new pool version with a new version_root. When your pack is created, it is pinned to whatever pool version is current at that moment — so the set of cards you "could have won" is fixed and committed up front, not chosen after the roll.

The Feistel walk​

A Feistel network is the standard way to turn a small secret seed into a pseudo-random permutation — a keyed shuffle that maps the positions 0, 1, ..., N-1 onto themselves with no repeats and no gaps (a bijection). Think of it as shuffling the tier's candidate cards with a key, then dealing from the top.

  • The shuffle's key is a different window of the same beta: bytes 8–24 (the roll used bytes 0–8). One VRF output drives both steps, so the card pick is just as unpredictable and just as verifiable as the roll.
  • permIndex(rank) returns the card index at a given position in the shuffle. We walk rank = 0, 1, 2, ... and award the first card that is still available — skipping any card already won by an earlier pack and not yet returned.
  • "Already won" is determined by a global, monotonic ownership sequence. Your award sits at some point P in that sequence; the cards considered "taken" are exactly those with a win event before P and no later return (a card that was bought back becomes available again). The verifier replays these same events.
  • Turbo packs differ. A turbo pack that rolls Common is bought back immediately and never consumes the card, so its "taken" set is the prior picks of the same turbo session rather than the global ownership stream — a standalone turbo pack has nothing taken and lands on rank 0. (A turbo pack rolling uncommon or better is sent out and consumes its card like any other pack.)

Why a walk rather than index = beta mod N? Cards are being won concurrently by other buyers, so a single index could land on a card that's already gone. The Feistel permutation gives a complete, deterministic fallback order for the whole tier, so "skip taken, take the next" is itself fully reproducible and unbiased — there is no hidden tie-breaker.

sel_anchor — the on-chain commitment to your card​

The exact card you got is committed with a 32-byte selection anchor:

sel_anchor = SHA-256( 0x04 || version_root || ownership_seq(u64 BE) || awarded_nft_mint(32 bytes) )

This binds three things at once: the entire candidate set (version_root), the exact point in the global ownership timeline (ownership_seq), and the specific card.

On Solana, the sel_anchor is written into the memo of the award transaction (the on-chain NFT transfer, or the buyback transaction for turbo packs) as a fixed-width :r<64-hex> suffix. That memo is immutable once the transaction confirms, so the card you received is locked to the committed pool and timeline forever.

On EVM, the award is an ERC-721 safeMint(to, uri), which has no memo field — so there is nothing on the EVM transaction to carry the anchor. The anchor is recorded against the pack and published through GET /api/evm/vrf/verify and the browser verifier, where you can still replay the walk and check it. The VRF proof for an EVM pack is committed on-chain exactly like a Solana pack's — same key, same cc-vrf program on Solana, in the same batches — so the roll carries a chain-anchored commitment on both machines, and the card anchor is chain-anchored on Solana only.


When your card is decided​

Short version: your card is decided the moment you sign. Not when the pack opens.

Opening the pack does not pick anything. It hands you the card that was already picked.

The simple version​

Think of a real pack of cards in a shop. The card is inside the pack before you buy it. You don't know which card it is. The shop doesn't either. Tearing the wrapper doesn't choose the card — it only shows you the card that was always in there.

Ours works the same way, in this order:

  1. The list already exists. We do not build a list for your pack. The machine keeps one standing list of every card you could win, with a version number and a version_root fingerprint, and checks it every two to four minutes, rebuilding it when inventory has moved. When your pack is created — before you pay — we write that version number onto your pack. That is all that happens: your pack gets tied to a list that was already frozen, usually a minute or two earlier, while somebody else was buying. We can't quietly change it afterwards, because changing the list changes the fingerprint.
  2. You sign. That is the moment it's decided. Your signature is the input. We run it through the VRF with our secret key, and that gives one output, beta. beta decides everything: your tier, and then the shuffled order of every card in that tier. Your first-choice card, your second, your third — the whole order is fixed right there, in one step. Neither side can steer it: we can't pick your signature, and you can't work out the VRF output without our key.
  3. Opening delivers it. The animation, the transfer, the mint — that's the wrapper coming off. No new randomness happens. Nothing is drawn.

The comparison holds for the part that matters — the outcome is fixed before you open — but be clear on where it stops. A shop pack physically holds one card, and nobody else can take that card. Ours fixes a decided order over shared inventory. So if another buyer reaches your first card before you open, you get the next one down your own list. That is the one moving part, and the next section is about it.

So what can change between signing and opening?​

One thing only: somebody else may have already taken the card at the top of your list.

Other people are buying from the same inventory. If your first-choice card is gone, you get the next card on your list. That order was fixed when you signed — so the "backup" was decided at the same instant as the first choice. We are not picking your replacement. We are reading down an order you can recompute yourself.

That's why Step 2 uses a shuffle of the whole tier instead of a single index. A single index could land on a card that's already gone, and then somebody would have to decide what happens next. With a full shuffled order, there is nothing left to decide.

Why we built it this way​

Because it matches the physical thing. A card is in a pack from the moment the pack is sealed. The alternative — rolling at the instant you click open — would decide your outcome after you had already committed your money. We would rather the outcome be locked at the moment you commit, and be provable after the fact.

Exact order of events​

For the record, precisely. "Decided" below means the tier and the full card order are mathematically fixed and cannot be changed by anyone, including us.

ChainThe list is frozenYour pack is tied to itYour card is decided
Solanaon a rolling rebuild every 2–4 min, before your pack existswhen the pack is created, before you paywhen you sign the payment transaction
EVMthe same rebuild, before your pack existswhen the pack is created, before you paywhen you sign the payment transaction — its hash is the VRF input

Read the three columns in order. Nothing about your outcome is decided in the last step of that flow. The list is frozen first, your pack is tied to it second, and your signature decides the result third. Opening the pack is a fourth step that decides nothing.

One more detail, since it affects what "already taken" means: the ownership timeline (ownership_seq) is a single global stream shared by both machines. A card claimed by a Solana pack and a card claimed by an EVM pack land in the same ordering, so a verifier on either chain replays the same history.


How proofs are committed on-chain​

The VRF proofs are committed through cc-vrf, a standalone, permissionless on-chain VRF system for Solana (program ccvrfu3fSpbnPLiUqdWAt85Zn9nq96ekwGTbHqGtdgQ). Every pack is committed in a batch: one on-chain Merkle root over every pack opened since the previous batch.

Rollout

Batch commits are live on mainnet since 2026-11-18 17:54 UTC, and on devnet (https://dev-gacha.collectorcrypt.com), on every rail. Mainnet packs opened before then keep their per-pack commit; see Legacy per-pack proofs.

  1. Register and freeze a key. The operator registers its VRF public key on-chain as a VrfAuthority (an owner plus a label), then calls freeze_authority, a one-way action. After freezing, the public key and ciphersuite are permanent and can't be swapped, and the program has no instruction that revokes an authority.

  2. Commit every pack in a batch. Every 5 minutes our commit key sends one commit_batch_event with the Merkle root over every pack opened since the last batch, Solana, EVM and Invoiced alike (format). A pack's commit lands within about 6 minutes of the open. Changing anything about a committed pack (its memo, seed, proof or result) breaks its path to a root that is already on-chain.

    One exception: Invoiced instant packs (POST /api/v1/packs/instant) are not committed. We generate their seed, so an on-chain record would show nothing the open response doesn't. Their roll still verifies at GET /api/v1/vrf/verify (seedSource: "server", vrfCommitSignature: null). Packs opened with your signed seed are committed as above.

So each pack carries two independent on-chain commitments:

  • the cc-vrf commit, which proves the roll's beta came from our frozen key over your alpha; and
  • the sel_anchor memo on the award transaction, which pins which card you got, over which committed candidate set.

Verification (/api/vrf/verify) re-runs the ECVRF math off-chain and checks the on-chain commit: the authority is frozen, your pack's leaf (rebuilt from its memo, alpha, proof and beta) proves into the committed root at its index, and the recomputed sel_anchor equals the one in the award memo.

Who signs the commits​

DevnetMainnet
Commit key (owner)vrfDEcMMZXQjJ4XZw5ZXucpbG6ypn2VhYQQBXcdH3o4vrfPkKnYfuFpXyYJPRzfSTCcnb7FwMgjhvmdTxRc61A
Labelgachagacha
Authority12eJED8cB66Lsy1oAmqsASMs72jGs3uu3nJr4zhgUdVp147oKMLbXHHgjbF3GhQkpcWedgufGS6h8doBhdLnsg3d
VRF public keycb64c69236771db39e0b4bcb594ccad33e86080270ac1b440224d010b56d337e115c996237b325ede5955f012069538c799944fb053521efd9b4d6599dd0cb83

Both authorities are frozen. The mainnet one holds the same VRF public key as the authority that committed every earlier mainnet pack (13C5cbemzwSg5wNerJDucU5uUJ1kHQENDqoTa3VSAHau), so the rolls come from the same key; only the key that signs the commit transactions changed. Each verify response names the commit's owner (vrfCommitOwner) and label (vrfCommitLabel).

Batch format (v1)​

leaf = SHA-256(0x00 ‖ "ccvrf-batch-v1" ‖ SHA-256(memo) ‖ SHA-256(alpha) ‖ SHA-256(proof) ‖ beta)
node = SHA-256(0x01 ‖ left ‖ right)
root = MTH(leaves) RFC 9162 §2.1.1, leaves in index order
  • memo is the pack's memo as UTF-8; alpha is the 32-byte VRF input; proof is the 80-byte ECVRF proof; beta is the 64-byte output (proof_to_hash(proof)); "ccvrf-batch-v1" is those 14 ASCII bytes, with no terminator.
  • MTH of one leaf is that leaf. For n > 1 leaves it is node(MTH(first k), MTH(rest)), where k is the largest power of two smaller than n.
  • A pack's path is its RFC 9162 §2.1.3.2 inclusion path, leaf level first.
  • Take count from the on-chain event, never from an API: one path shape fits several counts.
  • Always rebuild the leaf from its four fields; never accept a bare 32-byte leaf.
  • The event's leaf_version is 1. A change to the leaf would get a new version; v1 never changes.
  • A batch holds 1 to 1,048,576 leaves on-chain; ours hold at most 4,096.

What the batch commit contains​

commit_batch_event writes no account. It emits one VrfBatchCommitted event in the transaction's logs (an Anchor event, Borsh-encoded):

FieldTypeMeaning
ownerPubkeythe commit key
label[u8; 32]gacha, zero-padded
root[u8; 32]the batch root
countu32number of leaves
leaf_versionu81
ring_seqOption<u64>None for our batches
committed_slotu64the slot of the commit

The instruction data carries the same values at fixed offsets, so you can also read them from the signed instruction: bytes 8–40 label, 40–72 root, 72–76 count (little-endian), 76 leaf_version. The program emits nothing unless the signer owns a frozen authority with that label. Since the event lives in the transaction, not in an account, checking an old batch needs an RPC that serves historical transactions.

Checking a batched pack​

The verify routes (/api/vrf/verify, /api/evm/vrf/verify, /api/v1/vrf/verify, each ?memo=YOUR_MEMO) return vrfCommitMode: "batch" and a vrfBatch object. A real devnet pack, GET https://dev-gacha.collectorcrypt.com/api/vrf/verify?memo=cc-5d22d002-9fc0-4dc7-8e05-e4aab9eb8747:

{
"valid": true,
"alpha": "0x2bebaa62ca73a06dba340a6ffe804379fcd70bacb27512d8db3d7e470f64432e",
"proof": "0x9d9da7b0d1822f3afb111bc008dc9d7974bab7346d6ac9d4c7fa321e60999700451eb92baee6722a072c027fb00974adb007072c1e35a99fcdd52d720da44a87a7a9782804b42234e5f6fd57d6131600",
"beta": "0x21d786544bcb377ce16363153d234fe674d44cc884c35228f900fd8bc4a30519af453cbad1276ac0d3c2f28ae53b9a7c1a9b08c25dc545ab48e11d607a0cf959",
"vrfCommitMode": "batch",
"vrfBatch": {
"landed": true,
"signature": "3xNmywgvURspUXHTH1bko1RjcE5HumkULQzB6NPADEbWjfwRz9go4NEa6kmXZiz5CQfJkfXV3mzA2dKBcWs2mjvn",
"index": 25,
"count": 36,
"root": "7e220f76c99411ef5460a2b0cc03acbe8af63ff222856d696041ee861f9698d1",
"leaf": "17db6d2050f5914d7de1a918cbcab51d01ea382f0ba0417b00af0863113dab84",
"path": [
"32ac8e8e2dc6ede2d1d27e26b57dff3fc13d565c58eb3fab3cdec686058c92f7",
"205d4b78c38f635537e4f5924a8a8db080819a1e58154db3a15faf9bcfc8c6f1",
"1623ae2809fcb281fc06b172235446690fab716002d7efde763335277e9e26ac",
"61bdd7ee41c89d7d4c07f48951ca1bad006f8aed799367fed901f54ccc6b3029",
"55e508335d2c1e3a16b6e57384f1996aa6593ae833660aaf44fb36058d2816be",
"7b6d04d28fc225d18cb304cf86177013e1959f335dfc7123f7a6214da75a8ed3"
],
"leafVersion": 1,
"slot": 522080403
},
"vrfCommitOwner": "vrfDEcMMZXQjJ4XZw5ZXucpbG6ypn2VhYQQBXcdH3o4",
"vrfCommitLabel": "gacha",
"vrfVerifyUrl": "https://dev-gacha.collectorcrypt.com/api/vrf/link?rail=solana&memo=cc-5d22d002-9fc0-4dc7-8e05-e4aab9eb8747"
}

(commitSignature on Solana, vrfCommitSignature on EVM and Invoiced, is the same batch transaction; commitAddress / vrfCommitAddress is null.) Until the batch lands, vrfBatch.landed is false and the signature is null. To check it without trusting us:

  1. Verify the ECVRF proof against the VRF public key (@collectorcrypt/ecvrf).
  2. Rebuild your leaf from your memo, alpha, proof and beta. It must equal leaf.
  3. Walk path from your leaf with index and count. It must reach root.
  4. Fetch the batch transaction from Solana. Its VrfBatchCommitted event must carry that root and count, from the owner and label in the table above, whose authority is frozen with that VRF public key.

Steps 2 and 3 need nothing but SHA-256. This is the whole check for the pack above (Node 18+, no dependencies; save as check.mjs):

import crypto from 'node:crypto';
const sha256 = (...parts) => crypto.createHash('sha256').update(Buffer.concat(parts)).digest();
const hex = (h) => Buffer.from(h.replace(/^0x/, ''), 'hex');

function leafV1(memo, alpha, proof, beta) {
return sha256(Buffer.from([0x00]), Buffer.from('ccvrf-batch-v1'), sha256(Buffer.from(memo, 'utf8')),
sha256(alpha), sha256(proof), beta);
}

// RFC 9162 §2.1.3.2: the root an inclusion path leads to, or null if it can't fit (index, count).
function rootFromPath(leaf, index, count, path) {
if (index >= count) return null;
let fn = index, sn = count - 1, r = leaf;
for (const p of path) {
if (sn === 0) return null;
if (fn % 2 === 1 || fn === sn) {
r = sha256(Buffer.from([0x01]), p, r);
while (fn % 2 === 0 && fn !== 0) { fn = Math.floor(fn / 2); sn = Math.floor(sn / 2); }
} else {
r = sha256(Buffer.from([0x01]), r, p);
}
fn = Math.floor(fn / 2); sn = Math.floor(sn / 2);
}
return sn === 0 ? r : null;
}

const memo = 'cc-5d22d002-9fc0-4dc7-8e05-e4aab9eb8747';
const v = await (await fetch(`https://dev-gacha.collectorcrypt.com/api/vrf/verify?memo=${memo}`)).json();
const leaf = leafV1(memo, hex(v.alpha), hex(v.proof), hex(v.beta));
const root = rootFromPath(leaf, v.vrfBatch.index, v.vrfBatch.count, v.vrfBatch.path.map(hex));
console.log(leaf.toString('hex') === v.vrfBatch.leaf, root?.toString('hex') === v.vrfBatch.root); // true true

@collectorcrypt/vrf-client does all four steps against the chain. The VrfBatchCommitted lookup reads the transaction; the authority lookup needs an RPC with the ZK Compression API (for example Helius). As an ES module (for example RPC_URL=… npx tsx verify.mts):

import { AnchorProvider, Wallet } from '@coral-xyz/anchor';
import { Connection, Keypair, PublicKey } from '@solana/web3.js';
import { createRpc } from '@lightprotocol/stateless.js';
import {
encodeLabel, fetchAuthority, findBatchCommits, getProgram, hexToBytes, verifyBatchCommitEndToEnd,
} from '@collectorcrypt/vrf-client';

const API = 'https://dev-gacha.collectorcrypt.com'; // mainnet: https://gacha.collectorcrypt.com
const RPC = process.env.RPC_URL!; // same cluster, with the ZK Compression API
const memo = 'cc-5d22d002-9fc0-4dc7-8e05-e4aab9eb8747';

// Who signs the commits (table above). Pin these: never take the signer from the API you are checking.
const OWNER = new PublicKey('vrfDEcMMZXQjJ4XZw5ZXucpbG6ypn2VhYQQBXcdH3o4'); // mainnet: vrfPkKnYfuFpXyYJPRzfSTCcnb7FwMgjhvmdTxRc61A
const VRF_PK = 'cb64c69236771db39e0b4bcb594ccad33e86080270ac1b440224d010b56d337e'; // mainnet: 115c996237b325ede5955f012069538c799944fb053521efd9b4d6599dd0cb83
const LABEL = 'gacha';

const v = await (await fetch(`${API}/api/vrf/verify?memo=${memo}`)).json();
if (v.vrfCommitOwner !== OWNER.toBase58() || v.vrfCommitLabel !== LABEL) throw new Error('not committed by Collector Crypt');
const connection = new Connection(RPC, 'confirmed');
const program = getProgram(new AnchorProvider(connection, new Wallet(Keypair.generate()), {}));

// The commit in that transaction that carries this pack's root (one transaction may hold several).
const { commits } = await findBatchCommits(program, connection, v.vrfBatch.signature);
const batch = commits.find((c) => c.owner.equals(OWNER) && Buffer.from(c.root).toString('hex') === v.vrfBatch.root);
const authority = await fetchAuthority(program, createRpc(RPC, RPC), OWNER, LABEL);
if (Buffer.from(authority!.onChainAuthority.pk).toString('hex') !== VRF_PK) throw new Error('different VRF key');

const result = verifyBatchCommitEndToEnd({
authority: authority!.onChainAuthority,
batch: batch!,
memo,
alpha: hexToBytes(v.alpha),
proof: hexToBytes(v.proof),
index: v.vrfBatch.index,
path: v.vrfBatch.path.map((h: string) => hexToBytes(h)),
expectedOwner: OWNER,
expectedLabel: encodeLabel(LABEL),
});
console.log(result.valid, result.reasons); // true []

Building on it​

  • SDK: @collectorcrypt/vrf-client 0.2.0 has the batch API (batchLeafV1, buildBatch, verifyBatchPath, findBatchCommits, verifyBatchCommitEndToEnd): npm i @collectorcrypt/vrf-client. It verifies the older per-pack commits too.
  • Every leaf of a batch: GET /api/vrf/batch/<signature> returns root, count, leafVersion, slot, owner, label and leaves (hex, index order), so you can rebuild a whole batch root, or count its packs, without us.
  • Verify page link: GET /api/vrf/link?rail=solana|evm|ext&memo= redirects to the verify page for any commit mode, and returns 409 COMMIT_PENDING until the batch lands.
  • Timing: a pack's batch lands within about 6 minutes of the open. Poll the verify route until vrfBatch.landed is true; there's no per-pack transaction to wait for any more.
  • Other operators: the cc-vrf program also has commit_batch_ring, which keeps the last 128 roots in an account other programs can read, and attest_possession, a public proof that the operator holds the VRF key. The gacha uses the event form. See the cc-vrf repo.

Legacy per-pack proofs​

Mainnet packs opened before 2026-11-18 17:54 UTC were each committed in their own transaction, under authority 13C5cbemzwSg5wNerJDucU5uUJ1kHQENDqoTa3VSAHau (owner: the gacha wallet GachaNgyXTU3zFogQ8Z5jR2BLXs8215X2AtEH18VxJq3, label gacha). Solana and EVM packs used commit_proof_with_beta; Invoiced packs opened with a signed seed used commit_proof_event. These commits stay valid and verifiable forever. The verify routes report them as vrfCommitMode: "registry" (with a commit address) or "event".

Per-pack commit instructions​

InstructionWhat lands on-chainUsed for
commit_proof_with_betathe memo, proof and alpha hashes plus the full 64-byte beta (200 bytes)Solana and EVM packs before the switch
commit_proof_eventan event log only, no accountInvoiced signed packs before the switch
commit_proofthe memo, proof and alpha hashes (136 bytes)not used

Storing beta in the clear lets a verifier compare the beta it derives from the proof against the committed one. The verify page's registry-beta mode checks these records; its event mode checks the Invoiced events. The record's address is derived from (authority, memo_hash), so the chain allows one commit per memo.

What a per-pack commit record contains​

The compressed PDA is exactly 200 bytes, in this order:

OffsetSizeField
032authority address
3232SHA-256(memo)
6432SHA-256(proof)
9632SHA-256(alpha)
12864beta (stored as two 32-byte halves, beta_lo + beta_hi)
1928committed_slot (u64 LE)

memo, alpha and proof are stored as fingerprints, not as raw values. A fingerprint can't be reversed, but it can't be lied about either: once it's on-chain, the only values that will ever match it are the originals. We publish the originals through /api/vrf/verify, and anyone can re-hash them and compare.

beta is the exception — it goes on-chain raw. That's deliberate (see above).

How the on-chain hash is built​

Two different hashings get confused for each other, so to be explicit:

  • beta = proof_to_hash(proof) makes the random number. Deterministic — the same proof always yields the same beta.
  • The SHA-256 fingerprints above have nothing to do with randomness. They only lock the values in place.

The record itself is anchored to Solana in four rungs:

  1. Fingerprints. We SHA-256 the memo, the alpha and the proof before sending anything.
  2. Data hash. Light Protocol squeezes the 200-byte record into a single 32-byte data hash (Poseidon, not SHA-256).
  3. Leaf hash. That data hash is combined with the record's identity — program ID, state tree, leaf index, compressed address, account discriminator — into one leaf hash.
  4. Merkle root. The leaf is inserted into a Light state Merkle tree whose root lives in a real on-chain account.

So one 32-byte root covers the whole record. Change a single byte anywhere below it — swap the proof, nudge the alpha, edit the roll — and the root no longer matches what the chain holds.

Worked example — from a memo to the on-chain transaction​

Real mainnet pack. Memo cc-77161af0-8001-425b-9213-e5e1d24083d6 (pokemon_50, 2026-08-07), committed per pack. For a batched pack, see Checking a batched pack.

Steps 1–4 are pure math — no network, no API, nothing from us. Steps 5–6 read the chain.

1. Start with the memo. It's printed on your pack.

cc-77161af0-8001-425b-9213-e5e1d24083d6

2. Hash it.

SHA-256(memo) = 0x46f31a79c1ae2b87999094278a29f0c6f50843998112fb10fb2e97511629c841

3. Derive the authority address from "vrf_authority" || owner || label, where the owner is the gacha wallet GachaNgyXTU3zFogQ8Z5jR2BLXs8215X2AtEH18VxJq3 and the label is gacha:

13C5cbemzwSg5wNerJDucU5uUJ1kHQENDqoTa3VSAHau

4. Derive the commit address from "vrf_proof" || authority || memo_hash:

1fNrGDCyJrKBEheLcvhTKJXkLrAmWsM7FNXP7cR1hNF

Nothing secret went into that. Anyone holding the memo lands on that exact address — which is also why we can't hide a commit or write a second one for the same pack. The address is already taken.

5. Read the record. Leaf 744951 in state tree bmt1LryLZUMmF7ZtqESaw7wifBXLfXHQYoE4GAmrahU. Its 200 bytes decode to:

authority   008fb0761e0d68e818644fe8f6fee08de44858c5e6e3c891364c441e5847c666
memo hash 46f31a79c1ae2b87999094278a29f0c6f50843998112fb10fb2e97511629c841
proof hash 23c025b668c5eee717756a4e519435cf553331fd83173c116a331fb374d6e62c
alpha hash a35e5296e8596a17f723ba7ee60fb91274d2865590cdc10e3507dbcc0d32e3b0
beta e15d44f4181c1a9016a0589be046ef3c3fbc779b5767ca5ebfb65abe2c4014ba
6568514ccb234c808fee0912658e1ff1479ca5c6915e3433a673ac5a9a1ac351
slot f734191a00000000 → 437,859,575

6. Ask which transaction created that leaf.

2PnAaXGBtutqXah7rmZA7Fj6Mu4GMGRwUwKbeDtmhuXaaQYb7djwniJM73PD5pSxAqDNJsBrXD8PEd4oU63ujpWD
slot 437,859,575 — 2026-08-07 20:51:27 UTC

That signature is a normal Solana transaction. Open it in any explorer and the logs read:

Program ccvrfu3fSpbnPLiUqdWAt85Zn9nq96ekwGTbHqGtdgQ invoke [1]
Program log: Instruction: CommitProofWithBeta
caution

Paste the transaction signature into an explorer, not the commit address. The commit address is a Light Protocol compressed address — it isn't a regular Solana account, so standard explorers won't find it. Use the Lookup page at vrf.collectorcrypt.com for compressed addresses.

Checking the values against that record​

The published proof and alpha for this pack (from /api/vrf/verify?memo=…):

alpha 0x800fb99a079d0823110497f6d41d56672c55a58e556426303d3541884f7ed1f1
proof 0x0dfc748650f44a04f9726f3155f0202ef69a1bd0eda7fd9e684cc5ab707ed2c7
5de8c77faa88f920203d26739ae2c193bf15b93474e055886b67aad727e19fca
1fb83aaaa50939d54eef6d02ae83df06

Five checks, all reproducible:

CheckResult
SHA-256("ccgacha-vrf-v1\0" ‖ your signature) == alphamatches — the input came from the buyer's own signature 2hdYcPFQ…hvE2
verifyVRF(pk, alpha, proof) under the frozen key 0x115c9962…cb83valid
SHA-256(memo) / SHA-256(alpha) / SHA-256(proof) == the three on-chain fingerprintsall three match
proof_to_hash(proof) == the on-chain betamatches
beta[0..8] → the roll16,239,211,646,535,080,592 mod 100,000,000 + 1 = 35,080,593 — the stored roll

And the card, from the award transaction io6XatGJb1TogSGEBpQQC7QP8QGLH3QTfTqqeLzy9x1PZBTadyc8pCiRyHTEiAxaYCY7zRtVsJ5HUnLaVMtvSvB, whose on-chain memo carries the sel_anchor:

cc-77161af0-8001-425b-9213-e5e1d24083d6:send:r181ed2e79df8903b3ad811fc26ff590122ecd4442a82ccce9d690ac7e1a5968a

Recompute SHA-256(0x04 ‖ version_root ‖ ownership_seq ‖ awarded_nft) and you get that same 181ed2e7…968a. Two independent on-chain commitments, one per step.


Why it can't be exploited​

By us (the operator)​

  • We can't precompute or steer the roll. alpha is bound to your signature, which we don't have until you sign. There's nothing to grind against ahead of time.
  • We can't retry for a better roll. RFC 9381 ECVRF yields exactly one valid proof and one beta per (public key, alpha). Our public key is frozen on-chain and can't be revoked. Any substitute proof fails verification against the frozen key, and the original SHA-256(proof) is already committed on-chain — so swapping it after the fact is detectable.
  • We can't hand-pick your card. Given beta, the Feistel walk is fully determined over the candidate set that was frozen and committed (version_root) before the pick. To award a different card we'd have to change beta (can't — see above), the committed candidate set, or the timeline position — each of which changes the sel_anchor, which is pinned to the immutable award-transaction memo. Any mismatch shows up as NOT VERIFIED.
  • We can't quietly shrink the pool to withhold a card. All four tier roots and counts are folded into version_root; removing or altering any card changes the root.

By you (the buyer)​

  • You can't predict the output. Computing beta from alpha requires the VRF secret key, which only we hold. You choose your alpha (indirectly, via your signature), but the VRF's unpredictability means you can't find a signature that yields a favorable roll without breaking the VRF.
  • You can't choose your card. It's a deterministic function of a beta you can't predict.
  • You can't forge or replay a different outcome. You can verify a proof after the fact, but only the holder of the secret key can produce a valid one.

The "memo selection" angle​

The only theoretical lever in any commit-style VRF is choosing which committed input to honor. We remove it by binding alpha to your own wallet signature and issuing the memo before you sign: we can't choose your signature, and you can't compute the VRF to know which signature would be favorable. Neither side can shop for an outcome.


Verify your pack yourself​

  • Card selection (full replay) — open /verify-selection/YOUR_MEMO. Entirely in your browser, it fetches the pool snapshot, recomputes the Merkle and version roots, replays the Feistel walk from beta, and hard-checks the recomputed sel_anchor against the on-chain memo. The frozen candidate set for a pool version is stored durably, so a pack stays fully replayable indefinitely — there is no expiry window. If a candidate set ever cannot be reproduced (a pool version predating the durable leaf log, or a reconstruction whose root does not match what was committed), the page says so rather than guessing, and the roll and on-chain anchor remain independently verifiable on their own.
  • Roll (proof + roll match) — GET /api/vrf/verify?memo=YOUR_MEMO returns the proof, public key, alpha/beta, the on-chain commit status (with vrfBatch for a batched pack), the awarded transaction signature, and whether the stored roll matches the recomputed roll.
  • Raw data (replay it yourself) — GET /api/pool-snapshot/YOUR_MEMO returns everything the browser verifier replays, as JSON. See The pool snapshot.

The browser verifier shows these checks, all of which must pass for a green VERIFIED:

CheckWhat it proves
Roll verified (cc-vrf, not degraded)the roll is a genuine ECVRF roll from our frozen key
Merkle root of candidates matchesthe published candidate set is the one that was committed
Selection anchor matcheshard against the on-chain award memo on Solana; on EVM a soft match against the published anchor, because an EVM mint carries no memo
Roll maps to the awarded tierthe verified roll, classified under the odds this pack was sold at, gives your tier
Feistel walk lands on your cardreplaying the shuffle from beta reproduces your exact card
Awarded value within the tier bandyour card's insured value is inside the tier's published band

The pool snapshot​

GET https://gacha.collectorcrypt.com/api/pool-snapshot/YOUR_MEMO

Public, no key, for a pack from any machine. It returns the pool version your pack was pinned to: every candidate card in the tier you won, the commitments for the other three tiers, the earlier ownership events your walk stepped over, and your award. With the precise construction below, that is enough to recompute your card. The proof behind beta comes from GET /api/vrf/verify?memo=YOUR_MEMO (/api/evm/vrf/verify for an EVM pack).

Fetch it once the pack has settled, about 15 minutes after it opens. Before that, some fields can still change.

FieldWhat it is
chainsolana, evm, or ext (Invoiced)
poolVersionthe pool version your pack was pinned to
versionBuiltAtwhen that pool version was built
versionRootthat version's version_root
tiersepic, rare, uncommon and common, each { root, count }
awardedTierthe tier you won
leavesevery candidate card in that tier, in leaf order: { leafIndex, nftAddress, valueCents, leafHash }
bandsCentseach tier's value band, { startCents, endCents }, start inclusive and end exclusive
takenEventsearlier events for cards in leaves, sorted by ownershipSeq: { nftAddress, ownershipSeq, direction, signature, chain }, where direction is win or return
takenModelglobal, or turbo-yolo for a turbo pack, whose takenEvents are the same turbo session's earlier picks
selAnchorthe sel_anchor recorded for your pack
committedThresholds, machineWeightsthe odds your roll was classified under: thresholds committed on the pack (Fixed EV machines), otherwise the machine's tier weights
awardyour award: roll, beta, nftAddress, ownershipSeq, baseIndex, awardedIndex, awardedRank, transactionSignature (the transfer, or the buyback for a turbo pack), turboMode

A pack from before provable selection returns provableSelection: false, and only its roll can be verified. If a pool version's candidate set cannot be reproduced, the response has available: false; the roll and the anchor still verify on their own.

To replay it:

  1. Hash every card in leaves and build the Merkle root. It must equal tiers[awardedTier].root.
  2. Fold poolVersion and the four tiers into version_root. It must equal versionRoot.
  3. Mark a card taken if its last entry in takenEvents is a win.
  4. Walk rank = 0, 1, 2, … with beta[8..24] as the seed. The first leaves[permIndex(rank)] that is not taken is your card: award.nftAddress, at award.awardedIndex and award.awardedRank.
  5. Compute sel_anchor from versionRoot, award.ownershipSeq and award.nftAddress. On Solana it must equal the :r<64-hex> suffix of the memo on award.transactionSignature; on EVM and Invoiced, compare it with selAnchor.
  6. Your card's valueCents must fall inside bandsCents[awardedTier].

Precise construction (for re-implementers)​

All hashes are SHA-256. || is byte concatenation. Mint addresses are base58-decoded to their raw 32 bytes. These constants are a frozen contract — they never change, or verification of past packs would break. The reference implementation is isomorphic (the same code runs on our server and in your browser).

roll          = (beta[0..8]  as u64 BE) mod 100_000_000 + 1
seed16 = beta[8..24] # the selection seed; beta[24..] reserved

leaf(nft,val) = SHA-256( 0x00 || nft(32B) || cents(val) as u64 BE )
leaf order = by cents(val) ascending, then by base58 address in byte (ASCII) order;
leafIndex = position in that order, 0..len-1
node(L,R) = SHA-256( 0x01 || L || R ) # odd level duplicates the last node
tier_root = Merkle root of the tier's leaves # empty tier => 32 zero bytes
version_root = SHA-256( 0x02 || version(u64 BE)
|| root_epic || root_rare || root_uncommon || root_common
|| count_epic || count_rare || count_uncommon || count_common ) # counts are u32 BE
sel_anchor = SHA-256( 0x04 || version_root || ownership_seq(u64 BE) || awarded_nft(32B) )

# Feistel permutation over [0, len): 4-round alternating additive Feistel, cycle-walked
# down to the exact domain.
bits = smallest b with 2^b >= len # len <= 1 => permIndex(rank) = rank
aBits = ceil(bits / 2), bBits = bits - aBits
F(r, v, m) = first 6 bytes of SHA-256( "ccgacha-sel-v1\0" || seed16 || r(u8) || v(u32 BE) )
as a big-endian integer, mod m
encrypt(x) : A = floor(x / 2^bBits) # high aBits
B = x mod 2^bBits # low bBits
for r in 0, 1, 2, 3:
r even: A = (A + F(r, B, 2^aBits)) mod 2^aBits
r odd: B = (B + F(r, A, 2^bBits)) mod 2^bBits
return A * 2^bBits + B
permIndex(rank): x = rank; do x = encrypt(x) while x >= len; return x

# The walk. Events are the snapshot's takenEvents, all with ownership_seq below your pack's.
taken(card) = the card's last event, in ownership_seq order, is a win
your card = leaves[permIndex(rank)] for the first rank = 0, 1, 2, ... whose card is not taken

cents(val) mirrors round(insured_value * 100). The on-chain memo carries sel_anchor as a trailing :r<64-hex> segment (fixed width, so legacy memos still parse).


Spec & source​