About
Games, raffles and fair draws need a random number nobody can steer. On QoreChain, BLOCKHASH reads 0 (see /broken), and block fields are visible to whoever produces the block. Plain commit-reveal has a last-revealer problem: the last party sees every other secret and can walk away. And a beacon signed with classical keys can be hijacked the day those keys fall.
Astragal is a many-party, post-quantum randomness beacon. Anyone adds entropy from a phone, with QoreX or with a key made in the browser. Every contribution carries an ML-DSA-87 signature that the core contract checks on chain with pqcVerify (0x0A01), against a key that pqcKeyStatus (0x0A02) shows is registered with proof of possession. A late or forged commit reverts. Bonded anchors deal Shamir 3-of-5 shares of their secret, each sealed with ML-KEM-1024 to a keeper. If an anchor goes silent, three keepers post shares, the contract rebuilds its secret, and the round still finalizes. Each round ends in one 32-byte value that any contract reads with one call, randomness(round), and that your browser recomputes from public logs at /verify.
Quantum Pass, step by step:
- create-qorechain-dapp: apps/web is the scaffolder's output (npx create-qorechain-dapp apps/web --template viem-wagmi --network testnet), with QoreX listed first through @qorechain/qorex-rainbowkit.
- QoreX connect and one hybrid-signed transaction, read back from the chain: 67E65E3FB248F56CD6D072BB5B1E11D9B41B34CECAE567347B7F18D078FE01D7 (block 11109965, code 0, pqc_hybrid_verify verified, dilithium5).
- The app uses the QoreX key itself: QoreX signed round 69's digest with ML-DSA-87 and the core verified it on chain. Commit 0xd83c67e43553822e68aac62ee2b5a89c11f0466e3e03ae6f3b337c74098891c1, reveal 0xaa270676aa7584b0e9e294119da855a73fdc95da3309890952e8263be0883319. Round 69 finalized with the guest included.
- 12 contracts deployed on Diana.
Running on Diana now: 120 rounds opened on the live core, 103 of them finalized (read at block 11133137, 2 Dec 2026). An unattended worker keeps opening rounds. On the earlier deployment, a recorded fault and control pair shows the abort case: in one round the anchor committed and went silent, keepers posted shares and the contract rebuilt its secret; in the next the same anchor revealed normally. Both finalized, and both values recompute from public logs byte for byte.
Who runs what, plainly: the four occupied keeper seats, the anchor and the relayer are ours today. The beacon is not yet independent of us, and the README says so with a funding trace. ML-KEM protects shares only while a round is open.
Check it yourself:
- node ops/reverify.mjs (Node 20, no install, read-only) re-deals shares, re-hashes envelope roots, recounts acks and re-reads every README transaction: 19 passed, 0 failed, 2 skipped (2 Dec 2026).
- /judges re-reads every Quantum Pass item from Diana when you press Check on chain.
- /account checks any address's ML-DSA-87 key with the core's own gate and lists the rounds it entered.
Audit: QCAI ran twice on 2 Dec 2026: Astragal 72/100 (https://dashboard.qorechain.io/audits/QCAIA-1796178514400-7566592B) and AstragalConsumers 75/100 (https://dashboard.qorechain.io/audits/QCAIA-1796178572204-D0AB9E87), both MEDIUM. We checked all 11 findings against the code: 9 false positives or not applicable, 2 real limits, documented with tests in docs/AUDIT.md.
App: https://astragal-app.vercel.app · Judges: https://astragal-app.vercel.app/judges · Verify: https://astragal-app.vercel.app/verify
Diana testnet only. QOR there has no monetary value.
How it's made
Diana testnet (EVM chain id 9800): Solidity contracts, a keeper and anchor CLI, a relayer and proof API on Render, a React app on Vercel. The core contracts read block.number and no other block field.
A ROUND
1. Commit. A guest signs digestGuest with ML-DSA-87 and posts a commit hash. An anchor posts a bond (0.2 QOR), a commit hash, a hash of five share commitments and five ML-KEM-1024 envelopes; envelopesRoot binds them on chain.
2. Ack. Each keeper opens its envelope, checks the share against the on-chain commitment and acks only on a match. Four acks certify an anchor.
3. Reveal or reconstruct. An honest anchor reveals. For a silent one, three keepers call postShare and the contract interpolates the secret and checks it against the commit. The anchor loses 10% of its bond.
4. Finalize (permissionless). The value is keccak256 over a XOR of one domain-separated term per included contributor, so reveal order cannot change it. isStrong(round) tells a consumer whether a bonded anchor was included.
Live windows: commit 100 blocks, ack 60, reveal 30, reconstruct 40.
POST-QUANTUM ON CHAIN
- The core calls pqcVerify (0x0000000000000000000000000000000000000a01) and pqcKeyStatus (0x...0a02). Both are constructor immutables, readable as VERIFY_PC() and KEYS_PC().
- PqLib accepts a key only if registered, algorithm id 1 (ML-DSA-87), possession proven and 2,592 bytes.
- The signed message is the 99-byte QoreSign form, qorechain-msg-v1|qorechain-diana|0x<digest>. So QoreX signArbitrary output goes straight into commitGuest.
- One on-chain verify of a 4,627-byte signature measured at least 315,130 gas.
- Keepers register ML-KEM-1024 keys in the chain's KEM registry. Shares are sealed with @qorechain/qoreseal in KEM-only mode: a 160-byte share becomes a 1,848-byte envelope.
- The relayer pays gas inside a hybrid-signed EVM window, renewed by a scheduled job. It forwards only payloads already authenticated by an ML-DSA-87 signature or a hash preimage, so a stolen relayer key cannot forge a commit, ack or reveal. Keeper and anchor windows are scoped to the core and the KeeperRegistry.
CONTRACTS (DIANA)
Astragal core 0x30bc333b19ad70d485ed7526443b0fb530980e37 (22,045 bytes; deploy 0xa9a25c52a062acd5f3628761f3e92f17363061d86c25b6b51e81faeaf599b55a)
KeeperRegistry 0x3eff1e73cd3982ec38fb7bf3de8b8e6346d206cc
AstragalSettlement 0x6d0498ce2025391a8409bfe8b74a9566ca35ea90
AstragalViews 0xf8ed91e26ab5e7c38860240517e55b90e21dd8bb
AstragalRouter 0x95cc698a05927ed1a6544b4dff7bb6b01388cc5d
AstragalRaffle 0x67e79f32f152fccd674ad7f9a99110019e3a47c8, AstragalDice 0xedb5d6a33a643c5d510925e08706009381073595, ExampleCoinFlip 0x32ad4498b1510e9fa8e1519c9fde64f00f160a31, AstragalSponsor 0xf4b2eced684e63b8653b80af4f8e6c57ff57b667, libraries PqLib 0xe1814c1b0a289ed93fa8ab3d3d1ce3f3cb8a9346 and Shamir 0x9a94a1700252f8a283091e682dc82c292c39be99, plus an earlier unused sponsor: 12 in all.
QOREX AND THE STARTER
apps/web is the create-qorechain-dapp output (viem-wagmi template, testnet), structure kept, with QoreX first via @qorechain/qorex-rainbowkit and a native-lane send through window.qorex.native.signAndBroadcast. The main app's /add does it as a stepper that moves only on chain data: connect, a 1 uqor self-send that is read back from Diana REST with its pqc_hybrid_verify event, then a QoreX-signed commit into the live round and an automatic reveal.
KITS
@qorechain/sdk (key registration with MsgRegisterPQCKeyV2, address encoding), @qorechain/pqc (ML-DSA-87 and ML-KEM-1024), @qorechain/qoreseal (share envelopes), @qorechain/evm (chain presets and the EVM window read in apps/web), @qorechain/qorex-rainbowkit, create-qorechain-dapp. Also @noble/post-quantum in the browser, viem, Foundry, React and Vite.
TESTS AND CHECKS
- Foundry: 226 tests pass, including the Shamir library over every three-share subset, an attack lab (forged signature, replay across rounds, inconsistent dealing, oversized envelopes), invariants and digest vectors shared with JavaScript.
- ops/reverify.mjs, read-only: 19 passed, 0 failed, 2 skipped (2 Dec 2026).
- Twenty-five probes measured the chain before any contract was written (docs/PROBES.md).
AUDIT (QCAI, 2 DEC 2026)
Astragal 72/100 MEDIUM, AstragalConsumers 75/100 MEDIUM. 11 findings: 9 false positives or not applicable, 2 real limits measured by tests and documented. No human audit.
WHAT WAS HARD
- Diana enforces the 24,576-byte contract limit, so the core was split into core, settlement, views and two linked libraries.
- Keepers signed relayed acks with the unified key while the chain held their keygen ML-DSA-87 key, so every relayed ack failed BadSignature (round 23). Round 21 failed because the keeper EVM windows had expired. Both are recorded in docs/KNOWN_ISSUES.md.
Who runs it today: the four occupied keeper seats, the anchor and the relayer are ours. Testnet only. MIT.