BCH BLAZE 2026 Slides GitHub Before BLAZE: Lotry.fun (Base, 2025) · old contracts EMBER2026 votes:
Lotry on XO

Lotry.fun, migrated to Bitcoin Cash · an XO template · live on Chipnet

The lottery the organiser can’t run away with.

One round lives in one coin, the pot. The pot is locked by rules with no key, so nobody, the organiser included, can take it. The chain itself checks the draw, pays the winner, or refunds every ticket.

From the team behind Lotry.fun, Base Batch India 2025 runner-up.

Rounds on Chipnet
3
Transactions, all public
15
Tests: every path, 25+ attacks
43
Keys that can move the pot
0

01 · How a round works

A coin with no key.

On Bitcoin Cash, money sits in coins, and every coin carries a small script that says how it may be spent. Most scripts ask for a signature from one key. The pot's script asks for none. It only lists the next moves it allows: one more ticket sold, the right winner written down, the winner paid, or a ticket refunded after the deadline.

No key means nothing to lose, leak, or run away with. The organiser runs the round but can never move the money.

  1. 1

    Open

    Organiser

    Creates the pot: a fresh coin carrying the round's minting NFT. It also publishes the hash of a secret it will reveal at the draw.

    pot 0 tickets

  2. 2

    Buy a ticket

    Organiser and player, together

    One transaction, two people. The organiser adds the pot, the player adds the price and receives ticket #n, a numbered NFT nobody can change.

    pot n tickets, + price

  3. 3

    Draw

    Organiser, after the draw height

    The organiser reveals the secret. The covenant checks it against the hash and works out the winner itself: sha256(secret) mod tickets + 1.

    pot winner #k

  4. 4

    Claim

    Whoever holds the winning ticket

    The winner spends the ticket together with the pot. Both NFTs are burned and the whole pot is paid out.

    pot paid to the winner

  5. 5

    or, if never drawn

    Refund

    Any ticket holder, after the refund height

    Each ticket burns for its price back. Nobody has to say yes, the organiser included. The first refund closes the round: no draw after it.

    pot refunds only

The pot's state is its NFT commitment: a 4-byte ticket count while the round is open, then the winning number plus the byte 0xd0 once drawn, or the count plus 0xee once refunds begin. The covenant checks every move against it.

02 · Live proof

Every step, on chain.

Live rounds on Chipnet, the Bitcoin Cash test network. Every row below is a real transaction built from an XO invitation, and every invitation file is public, so each step can be replayed in the XO debug tool. The first card is the whole story: open, tickets, draw, claim.

Loading the rounds from data/rounds.json…

03 · Migrated from Lotry.fun

Same round, no owner.

Lotry.fun is our lottery on Base, a Base Batch India 2025 runner-up. For BLAZE we moved its core round, the part where money waits for a winner, to Bitcoin Cash. The Solidity code was the spec; everything here was written during BLAZE.

Lotry.fun · Base · Solidity Lotry on XO · Bitcoin Cash
Ticket An ERC-20 token from LotryTicket.sol An immutable CashToken NFT, numbered by the pot and held in the player's own wallet
Pot Held by a contract with an owner One coin locked to a covenant with no key at all
Randomness Chainlink VRF (RandomWalletPicker.sol) Commit-reveal: the secret's hash is fixed at open, and the covenant checks the reveal and computes the winner
Payout The owner calls distributeRewards(winner) The winner claims by burning the winning ticket together with the pot
If no draw No refund if the draw never comes; tickets can only be sold back on the bonding curve Every ticket refundable after the refund height

Before BLAZE: lotry.fun and the original contracts at exprmnts/Lotry_contract.

04 · Why XO

The whole app, one template.

XO is General Protocols' template stack for Bitcoin Cash: a wallet loads a template and knows every action it offers, who takes part, and what each transaction must look like.

i.

One reviewable file

Roles, actions, transactions and the covenant itself live in lotry-template.mjs (as XO JSON: lotry.json). Read one file and you know every way the money can move.

ii.

Invitations: each side adds its part

A ticket sale is one transaction built by two people. The organiser starts an invitation with the pot; the player joins, adds coins, receives the ticket and signs. Each signs only their own inputs.

iii.

Follow-up actions

Coins know what can happen next. The pot offers the next sale and the draw to the organiser; a ticket offers claim and refund to whoever holds it, with no custom wallet code.

The XO debug tool showing a Lotry buyTicket invitation: seven signed commits, one from the organiser role and one from the player role, resulting in a buyTicket transaction.
Seen in the XO debug toolRound 2, ticket #2, opened in the XO debug tool at blaze.xo.cash: commits signed by the organiser and the player, merged into one buyTicket transaction (4f829aaf…194320).

05 · Limits

Stated plainly.

What this round does not do yet, so nobody has to find out the hard way.

  • The organiser knows the secret.

    So an organiser who also buys the last ticket could steer which ticket wins, like any raffle host who also plays. It still can never take the pot. Planned for v2: buyer-supplied randomness.

  • Chipnet only.

    Every transaction on this page uses test coins on Chipnet, the Bitcoin Cash test network. Nothing here is real money yet.

  • Tickets are bought from a CLI.

    Today a sale runs from the command line: the organiser and the player each run their own step. There is no browser wallet flow yet.

Found while building

Faster Blocks changed what a lock height means on Chipnet.

Chipnet switched to 1-minute blocks on 15 Nov 2026 (CHIP-2025-03, Faster Blocks). Lock-time heights kept their 10-minute meaning, so a lock height now advances once every ten blocks. We measured the activation height on the live network: at block 341,561 Chipnet accepted nLockTime 333,361 and refused 333,362, which puts activation at block 332,451.

The round's draw and refund heights use this rule (src/chain-time.mjs). Round 1 was opened before we caught it. Anyone using OP_CHECKLOCKTIMEVERIFY on Chipnet needs it today; mainnet follows on 15 May 2027.

06 · Try it

Run it yourself.

Node 24. Chipnet coins are free from the proof-of-work faucet at chipnet.bch.ninja. Or run nothing at all: import templates/lotry-v1.json (the version the live rounds used) into blaze.xo.cash and open any invitation file from round 2.

git clone https://github.com/nikhil-pn/lotry-xo && cd lotry-xo
npm install
npm test                                    # 43 tests: every covenant path, 25+ attacks, BCH 2026 VM

node scripts/make-wallets.mjs               # organiser + two buyers, mnemonics kept outside the repo
node scripts/addresses.mjs BUYER_A          # a wallet's Chipnet address
node scripts/faucet.mjs <bchtest:address>   # free test coins

node scripts/lotry.mjs open                 # organiser opens a round
node scripts/lotry.mjs offer                # organiser starts a ticket sale invitation
node scripts/lotry.mjs take BUYER_A         # player adds coins, takes the ticket, signs
node scripts/lotry.mjs seal                 # organiser signs the pot input and broadcasts
node scripts/lotry.mjs draw                 # after the draw lock height
node scripts/lotry.mjs claim BUYER_A        # the winning ticket takes the pot
node scripts/lotry.mjs refund BUYER_B       # undrawn rounds, after the refund height
node scripts/lotry.mjs status               # the pot as the organiser sees it

07 · Team

Two people, one round.

Nikhil PN

Builds it: the template, the covenant, the tests and the Chipnet rounds.

github.com/nikhil-pn

Hina Hanan

Ideas and product direction. She also presents the film.