Sortes
QoreChain diana
Fair randomness on QoreChain

Nobody rigs
the draw.

The Athenian lottery machine, rebuilt on chain. Every lot carries its proof.

IStep one · The houseON-CHAIN

The house locks first

Before you arrive, the house commits to a hash chain. Its reveal must hash to the next link, or the call reverts.

link #1260x2f40…b13d
link #1270x9b2e…41c0
link #128sealing…

Writing link #128

IIStep two · YouON-CHAIN

You commit blind

Your browser keeps the secret and sends only its hash, with 1 QOR.

QoreX wallet requestdiana testnet
Methodcommit(bytes32)
Commitment0x6c40…b215
Value1 QOR
RejectApprove

Waiting for your signature

IIIStep three · The blockUNKNOWABLE

A block nobody had seen

Two blocks after your commit, the lock block seals the draw.

Commit#…905pending
+1#…906waiting
Lock#…907unknown

Waiting two blocks after your commit

IVThe drawONE RESULT

Three inputs, one row

House value0x4e17…a9c3
Your secret0x1f88…07de
Lock block0xd03a…5e19
Result0x……

Inputs arriving

Drawn

fairly.

VLot #271LEGENDARY · 4%

Six checks, all passed

The result chose every trait of this plate. Re-run the checks in your own browser.

House chainYour secretLock blockResult hashTraitsDeadlines

Introduction

01 · The inputs

Three inputs, each one checks the others.

No one holds all three. The contract checks every reveal against what was locked before, and gives the floor to anyone who goes quiet.

A bronze ticket sliding into a slot of the marble machineticket into the top row
IThe houselocked first

A value locked in advance

The house commits to a hash chain before anyone arrives. Its reveal must hash to the next link, or it reverts.

link #1270x9b2e…41c0
link #128sealed
forged revealreverts
See it fail →
A white ball dropping into the bronze funnelwhite ball, the funnel
IIYoucommitted blind

A secret, sent as a hash

Your browser keeps the secret and sends only its hash. Swapping it later reverts; staying silent gets you the floor.

commitment0x6c40…b215
value1 QOR
swapped secretreverts
See it fail →
A black ball dropping into the bronze funnelblack ball, sealed
IIIThe blocknobody had seen

A block nobody could know

The lock block lands two blocks after your commit. Its hash did not exist when the house or you chose.

commit#4,182,905
lock#4,182,907
hash0xd03a…5e19
See it fail →
02 · The desk

Follow a draw through the machine.

Five stops, all on chain. Here is one draw, stop by stop. The values are a worked example; every real lot shows its own on its page.

worked example · lot #271commit received
Rendered still of the allotment machine at the Commit stopA white ball enters the funnel
COMMITMENT0x6c40…b215H(secret, you, mint)
VALUE1 QORmint price
BLOCK#4,182,905commit block
LOCK BLOCK#4,182,907two blocks later
03 · Proof

Every lot shows its work.

Verify any lot
#3120x…sampleSample#3110x…sampleSample#3100x…sampleSample#3090x…sampleSample#3080x…sampleSample
04 · Refusals

What it refuses, and how you'll know.

We attacked Sortes eight ways. Each attempt is a test you can run and a transaction you can open.

forge test --match-test test_guarantee1
[PASS] test_guarantee1_houseCannotSteer()
  revealHouse(1, 0x7a1f…)
  └─ ← revert BadReveal
       H(value) 0x51ce…  ≠  chain checkpoint 0x9b2e…

1 passed · 0 failed
  1. T-01Constant block randomnessnaive method broken
  2. T-02Sender grinds the tx hashnaive method broken
  3. T-03House posts a forged valuereverted · BadReveal
  4. T-04House goes silentfloor + 3 QOR to user
  5. T-05User goes silentfloor applied
  6. T-06User swaps the secretreverted · BadSecret
  7. T-07Thief with only the ECDSA keyreverted · BadPqcSignature
  8. T-08Replayed admin signaturereverted · BadPqcSignature
05 · Sortes Lots

A thousand plates, drawn fairly.

Open the gallery
06 · For builders

Fair randomness in ten lines.

Open one request, read one result. Sortes runs the house, the lock block and every timeout for you.

Read the build guide →
CoinFlip.sol
import {ISortesHouse} from "./ISortesHouse.sol";

contract CoinFlip {
    ISortesHouse public immutable house;
    constructor(ISortesHouse h) { house = h; }

    function flip(bytes32 commit) external payable returns (uint256 id) {
        id = house.request{value: house.FEE()}(commit, msg.sender);
    }

    function heads(uint256 id) external view returns (bool) {
        (, bytes32 r) = house.resultOf(id); // zero = floor
        return uint256(r) % 2 == 0;
    }
}
07 · Questions

Asked before you ask.

No. The flagship is an NFT mint: you pay a fixed price for a lot, and the fair result only decides its traits.

Hand your app a fair draw, not a promise.