BCH BLAZE 2026 entry (Mainnet track) · Deck: https://apeir.dk/online/pot/deck.pdf · Video (104 s): https://apeir.dk/online/pot/pot-demo.mp4 · Repo: https://github.com/apeirs/pot (pre-hackathon prep: https://gist.github.com/apeirs/aff6b63931c57e1a0729a72770abb325, tag
prehack-2026-11-14; pre-hackathon demo: https://apeir.dk/online/pot-chipnet/) · EMBER2026 CashTokens address:bitcoincash:zrk8th0g30cn28um7apj85un4l9vvd37lyf6j3l26f
Lock a bounty on chain. Only the judge can award it; only after the deadline can the poster take it back.
Live: https://apeir.dk/online/pot/ (mainnet) · https://apeir.dk/online/pot/?net=chipnet (free test coins)
- Open the BLAZE 2026 demo pot (first under Featured on the home page): 0.0005 BCH locked on mainnet until block 979,645 (about 11-30). Its balance, deadline and history are read live from the chain.
- Add to it: scan the QR under "Or pay from any BCH wallet" with any BCH wallet, or connect Paytaca (Connect wallet, top right) and press "Send from my wallet". The pot updates within seconds.
- Identity: click the ✓ npub badge next to the judge. The #/bind
view fetches the judge's Nostr binding from the relays and verifies both signatures in the page.
No wallet?
#/bind?trybinds throwaway keys, logs in with them and shows forged proofs being refused. - See the other two paths done: pot A was awarded (both coins to one winner in one transaction), pot B was refunded after its deadline (links in the table below).
- Create your own pot: Connect wallet (top right) with Paytaca or Selene over WizardConnect, then Create a pot (0.0001 BCH at least). Put the deadline 1-2 hours out. After the deadline you take it back with "Take the pot back"; before it, as the judge, you award it to another address.
- On chipnet the same page runs with free test coins: https://apeir.dk/online/pot/?net=chipnet
Mainnet proof, one transaction per path, signed by the Paytaca browser extension over WizardConnect:
| Path | Transaction | What it shows |
|---|---|---|
| create (pot A) | 8457e87d… |
0.0002 BCH into the contract, title in a POT1 OP_RETURN |
| top-up (pot A) | 48dcebb3… |
0.00002 BCH more, a second coin |
| award (pot A) | d7f47d5e… |
the judge's wallet signs two contract inputs; 0.000213 BCH to the winner, fee 700 sats |
| create (pot B) | 9d17abd3… |
0.0001 BCH, deadline block 977,443 (pot B) |
| refund (pot B) | 50afa3db… |
the poster's wallet signs the contract input after the deadline; 0.00009594 BCH back |
| create (pot C, open) | 8223691c… |
0.0005 BCH locked until block 979,645, open for top-ups |
WizardConnect shares your wallet's public keys (xpub) with the page, as every WizardConnect dapp does. Use a fresh wallet if that matters to you.
Bounty hunters do the work first and trust the poster to pay. Pot puts the money in a contract before anyone starts: the hunter sees it locked, the poster can't pull it back early, and the rules are code anyone can read.
- Contract
contracts/Pot.cash:Pot(posterPkh, judgePk, deadline, maxFee, salt)award(judgeSig): the judge pays every pot coin in the transaction to one output, minus at mostmaxFee; not to the poster, not to the judge.refund(posterPk, posterSig): from blockdeadlineon, the poster takes it all back, to their own address only.- Top-ups are plain payments to the contract address; an award or refund sweeps them too.
- The pot's terms travel in its link (
#/p/1.<poster>.<judge key>.<deadline>.<fee cap>.<salt>); the page rebuilds the contract and its address from them. The title and link sit in an OP_RETURN of the funding transaction. No backend, no account, no indexer: the page reads the chain over Electrum. - Wallets sign over WizardConnect. Award and refund spend a contract input: the page builds the transaction with CashScript placeholders and the judge's or poster's wallet fills in its signature.
More in ARCHITECTURE.md.
A poster or judge can bind their BCH address to a Nostr key, so a pot shows who stands behind it and a pot can be judged by, or awarded to, an npub instead of a raw address.
Paytaca Decentralized Identity: requirement → where to see it (no wallet needed for any link below)
| Requirement | Where to see it |
|---|---|
| 1. Identity creation and management | #/bind: your BCH wallet (Paytaca or Selene over WizardConnect, or any wallet with Sign Message) and your Nostr key (NIP-07 extension, a key made in the page, or a pasted nsec). Keys stay in the wallet or the page; no server, no account. |
| 2. Cryptographic binding | #/bind?try: throwaway BCH and Nostr keys (two different keys) both sign one message, and the page verifies both signatures. Its three "try to cheat" buttons show a copied proof, a borrowed address and an edited event refused, each with the reason. Live: the demo judge's mainnet binding, signed with Paytaca (test/mainnet-binding.json), and a Selene address bound with the never-mined WizardConnect proof (test/mainnet-binding-selene.json). |
| 3. Decentralized discovery | Three public Nostr relays, by npub or by address: #/bind?q=<npub>, #/bind?q=<address>, and the ✓ npub badge on demo pot C. |
| 4. Verification and authentication | Every event is verified in the browser (src/bindverify.mjs, src/nostrbind.mjs). Challenge-response login: #/bind?try logs in with the throwaway identity and refuses a replay; #/bind?login=<npub> issues a real challenge to the demo judge's bound address. A real wallet logged in on mainnet: Selene signed the challenge for its bound npub (see Wallets below). Reusable: src/login.mjs. Tests: test/login-test.mjs, test/identity-test.mjs. |
| 5. Working demo and documentation | This site, this README, ARCHITECTURE.md (identity section), npm test. |
| Stretch: pay by identity | #/new: pick "Someone else" as judge and enter an npub; the page resolves its binding and shows the bound address and the judge key it recovered. A judge's award form takes the winner as an npub too, and resolves it again when the award is made. |
| Stretch: interoperability | Reads and verifies NIP-39 bch: claims (kind 10011) and pennyops bch-nostr-bind.v1 as well as its own format (see "Compatible with" below). |
- Bind (
#/bind): connect Paytaca or Selene over WizardConnect (the same session as the pot), pick a Nostr key (a NIP-07 extension if you have one, else a fresh key made in the page or a pasted nsec; the secret never leaves the page and is never stored), then sign one short message with both keys. The BCH side is either a walletsignmessagesignature (pasted) or a WizardConnect-signed transaction that commits to the message and can never be mined (locktime 4102444800, non-final). The page checks both signatures offline, then publishes the event tonos.lol,relay.primal.netandrelay.snort.social. - On a pot page the poster's and judge's addresses get a verified npub badge when a valid binding exists. The badge
opens
#/bind?q=<npub>, which fetches the binding from the relays and shows every check it passed. - Pay by identity: the create form's judge field and the award form's winner field accept an npub. The page finds the npub's binding on the relays, verifies both signatures, and uses the bound address (or its key, for a judge). It re-resolves at award time and puts the npub in the wallet prompt.
- Try it without a wallet (
#/bind?try): the page makes a throwaway BCH key and a throwaway Nostr key at runtime (never stored, shown or published; the address is never funded), binds them, verifies the binding, logs in with it, then lets you try three forgeries and shows why each is refused. Code:src/tryit.mjs. - Log in with it (
#/bind?login=<npub>): the challenge-response check of the Paytaca spec. The page finds the npub's binding on the relays and issues a challenge naming this site, the npub, a random 16-byte nonce and the time. The bound address signs it (a pastedsignmessage, or the same never-mined WizardConnect proof), and the page shows✓ Logged in as <npub> / <address>when the nonce is its own, unused and under 5 minutes old, the binding verifies and the signature is by the bound address. Each nonce logs in once. Any app can reusesrc/login.mjs(no server needed). - Format
nostr-bch-bind v1: a kind 30078 event,d=bch-bind:<address>, tagsi=bch:<address>andproof= [signmessage|wc-tx, value]; contentnostr-bch-bind:v1 / npub:<hex> / bch:<address> / created:<ts>. A binding is valid when the Nostr event signature, the BCH proof over the same message, and the address/key fields all agree. Logic insrc/bindverify.mjsandsrc/nostrbind.mjs, page inweb/bind.js. - Live binding: the BLAZE demo wallet
bitcoincash:qzjta36gk6ycrmlcnaln07z4yda305lepy7tp7cnvp(judge of pot C) is bound tonpub1dw38lu4qufjs85t6m6hwgk0v5we8puwlyzed9yj3rjjav6skjvnqjuhunswith a Paytacasignmessagesignature, eventadf8a87d…fa1c100f(alsotest/mainnet-binding.json, checked bynpm test).
Compatible with: NIP-39 (kind 10011 identity list): a ["i", "bch:<cashaddr>", "<signmessage>"] claim whose BCH
signature is over NIP-39's own text Verifying that I control the following Nostr public key: <npub> is read and fully
verified (found by npub and by address; the newest list replaces older ones), and shown as format "NIP-39". It was
checked against a live NIP-39 bch: binding published by another BLAZE project (tenxagent/blaze-bch). pennyops bch-nostr-bind.v1 (kind 30078, d = bch-nostr-bind, written for Cashonize #405, the
prior art for paying an npub) is read and fully verified, signature from its i tag. alberdioni bch-identity-bridge
(kind 31234) carries no BCH proof on the relay, so it is shown greyed out as unverifiable, never as verified.
| Wallet | Network | Create | Top-up | Award (contract input) | Refund (contract input) | Identity proof (wc-tx) |
|---|---|---|---|---|---|---|
| Paytaca browser extension 0.27.5 | mainnet | yes | yes | yes | yes | yes |
| Selene web app v2026.10.02 (app.selene.cash) | mainnet | yes | yes | yes | yes | yes |
@wizardconnect/wallet test wallet (e2e/wallet.mjs) |
chipnet | yes | yes | yes | yes | yes |
| Cashonize | not tried yet |
- Selene signs the CashScript contract input: a pot it created (
5e14240d…) was awarded by Selene as judge to another Selene address (335210ab…). Its signature prompt names the action and marks the winner output as its own. Selene's firstwallet_readycarries no keys and the next one does; the page now waits for awallet_readywith a receive key (before this fix, pairing Selene ended in "The wallet did not share an address"). - Selene top-up and refund: a second Selene pot (
68d57d5b…, 10,000 sats, deadline two blocks ahead) was topped up from the pot page with 2,000 sats (033259da…), and after the deadline block Selene took both coins back in one refund (094ad31d…, 11,232 sats, locktime = the deadline). - Selene identity and login: on
#/bindSelene signed the never-mined binding transaction for its receive address 0 and a new Nostr key (npub1jq3hja2…,wc-tx, published to all 3 relays, kept astest/mainnet-binding-selene.json). Then#/bind?login=<npub>issued a challenge, Selene signed it (prompt "Signature only, never sent: log in to apeir.dk/online/pot as npub1jq3hja2…"), and the page answered✓ Logged in as npub1jq3hja2… / bitcoincash:qp4s8eq2…with all 8 checks passed. - Paytaca identity proof: on mainnet the wallet signed the binding transaction (prompt "Signature only, never sent"),
the page verified it, and a broadcast attempt was refused by the network:
bad-txns-nonfinal (code 64). - Paytaca login:
#/bind?login=npub1dw38…issued a challenge for the live binding above, the Paytaca extension signed it (prompt "Signature only, never sent: log in to apeir.dk/online/pot"; nothing broadcast, no funds moved), and the page answered✓ Logged in as npub1dw38… / bitcoincash:qzjta36g…with all 8 checks passed (2026-11-18 06:56 UTC, screenshot).
Each rule of the contract, the attack it stops, and the test that tries it (npm test, mock network):
| Rule (Pot.cash line) | Attack it stops | Test (test/pot-test.mjs) |
|---|---|---|
| judge signature (13) | the poster or a stranger awarding | award signed by the poster, award signed by a stranger |
| one output (14) | change siphoned to a second output | award with a second output |
| output ≠ poster (15) / ≠ judge (16) | self-award | award to the poster, award to the judge |
| every input is this contract (20, 37) | mixing in foreign or other-pot inputs | foreign P2PKH input, inputs of two different pots |
| output ≥ inputs − maxFee (24, 41) | skimming, incl. leaving a top-up out of the payout | award skimming above the fee cap, sweep of 3 UTXOs paying out only 2, refund skimming |
poster key (29, 30) + tx.time ≥ deadline (31) |
early or third-party refund | refund before the deadline, refund by the judge |
| refund output = poster (33) | refund to someone else | refund after the deadline to someone else |
| 8-byte salt (10, 12, 28) | two pots with the same terms sharing one address, so one award sweeps both | same terms, different salt, inputs of two pots with the same terms but different salts |
Limits, plainly:
- The judge is trusted. A judge who colludes with the poster can award to the poster's second address. Pot stops the poster acting alone, not a corrupt judge. If the judge is the poster, hunters get only "locked until the deadline".
- Top-ups are gifts to the pot: if nobody wins, they go back to the poster, not to whoever added them.
- The contract can't see coins left out of a transaction, so a judge may award fewer than all; the rest waits for a later award or refund. The page always sweeps all it can.
- CashTokens sent to a pot are burned by an award or refund. The page never sends tokens and warns token holders.
- After the deadline, award and refund race: the first confirmed transaction wins. That's intended, so a judge can still pay late.
- One award sweeps at most 15 coins at the 5,000-sat fee cap (13 for a refund; about 330-360 bytes each). The page takes the largest coins and says what it left for a later sweep; top-ups start at 2,000 sats.
- Anyone can spam a pot with dust top-ups. Its page still loads: it reads the first 5 and the newest transactions (60 at most) and shows "N of M".
- A deadline is a block height. The date the page shows assumes 10-minute blocks, so it is approximate.
npm ci
npm test # contract, sweep, app and network tests on a mock network (127 cases)
npm run dev # builds the page into web/dist and serves it on http://127.0.0.1:8917
npm run e2e # chipnet end to end in headless Chrome (needs Chrome and the test wallet's chipnet coins)
The end-to-end wallet (e2e/wallet.mjs) uses keys derived from a fixed public label: it is for chipnet test coins only.
A design and a chipnet spike were done before 2026-11-14 and published unchanged as the gist above (tag
prehack-2026-11-14 marks the same files in this repo). Everything after that tag was written during the hackathon.
MIT