Skip to content
LSUDOKOPublic

About

Group buying on Bitcoin Cash: a covenant holds the money. Fill the group and the shop is paid; miss it and everyone is refunded with an early bonus. Live on mainnet.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

55 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bunch: buy together, or get paid for trying

Group buying where a Bitcoin Cash covenant holds the money.
Hit the group size and the shop is paid automatically. Miss it and every buyer is refunded automatically,
and early joiners get a bonus from the shop.

Live on mainnet Pitch deck White paper Pitch deck PDF CI Mainnet transactions MIT
CashScript 0.14 WizardConnect CashTokens React 19 + Vite BCH BLAZE 2026

The Bunch home page: grapes fill one by one as people join

$8 if 10 of us buy. Otherwise your money comes back, plus a bonus.

Try it in 60 seconds

  1. Open bunch-cash.pages.dev and tap Try it: join a real bunch (the Judge Bunch: 2 seats, 1 taken).
  2. Scan the QR with a WizardConnect wallet (Selene, Paytaca, Cashonize) and approve once.
  3. The grapes fill, the page broadcasts the settlement itself and shows two explorer links: your join and the shop's payout.

Or join the Refund Bunch (needs 3, has only 2 seats): after its deadline block your money comes back with a bonus, and nobody has to press anything.

Link
App (mainnet) https://bunch-cash.pages.dev
App (chipnet, free test coins) https://chipnet.bunch-cash.pages.dev
Pitch deck https://bunch-cash.pages.dev/deck · PDF
White paper PDF · source
Evidence for judges JUDGES.md · docs/EVIDENCE.md
QR code: https://bunch-cash.pages.dev
Open the app

QR code: EMBER2026 donation address
EMBER2026 donations (Community Choice)
bitcoincash:zzvha3elk3nl27xsyam28kxhcqzgl4duw50jehkn4t

It is real: mainnet proof

On Nov 22, 2026 a real Selene phone wallet joined the Judge Bunch over WizardConnect, and the open web page broadcast the keyless payout. Selene shows the receipt NFT by name with the Bunch icon, read from our BCMR registry.

Selene wallet showing the Bunch receipt NFT with name, grapes icon and description
Step Transaction What it proves
Join (Selene, WizardConnect) 34ddd25c…b609 30,000-sat seat, receipt NFT + change back to the phone
Keyless complete (sent by the page) 93ce7f3b…0910 shop 63,451 sats; fee exactly 1,200 = 2% of 60,000
Judge Bunch genesis 5a00a53a…e80a state thread with minting NFT + bonus pool
Terminal: reading both mainnet transactions from Electrum, every output value and address

Every other contract path ran on testnet3 (same consensus rules as mainnet): complete, leave with the receipt, keyless refund + early bonus, and shop-accept with the early-joiner rebate. All txids: docs/EVIDENCE.md.

Testnet3 rehearsal log (every path, real transactions)
Terminal: testnet3 rehearsal of every contract path

Screenshots

Home A live bunch Connect a wallet
Home page Judge Bunch page with live counter WizardConnect pairing QR
Start a bunch (shops) Pickup voucher check Phone
Create a bunch Shop voucher check Home on a phone

All screenshots are of the live mainnet site (docs/assets/screens/).

The problem

  • Nobody wants to go first. Group deals and threshold campaigns stall because early joiners carry the risk that the group never fills.
  • Someone has to hold the money. Whoever collects money for a group order must be trusted to refund it if the order falls through.
  • Deal platforms are expensive for shops. A 2011 analysis of Groupon merchant agreements put Groupon's share at around 42% of revenue (research summary in docs/11).

The idea, backed by research

Bunch replaces the trusted organiser with a covenant, and adds an early refund bonus: a dominant assurance contract (Tabarrok 1998). If the group fills you get the deal; if it doesn't, you get your money back plus a bonus, so joining early is a no-lose choice.

Finding Source
A refund bonus makes contributing a dominant strategy Tabarrok (1998), Public Choice 96:345–362
Refund bonuses raise success in threshold fundraising (lab) Cason & Zubrickas (2017), GEB 101 · (2019), EER 119
Refund bonuses "can increase the rate of campaign success by 50% or more"; early-only bonuses work as well and pay out less Cason, Tabarrok & Zubrickas (2021), GEB 129 · working paper · summary
A refund bonus is a credible quality signal Cason, Tabarrok & Zubrickas (2025), Management Science 71(7)
Showing later buyers how many joined increases purchases Hu, Shi & Wu (2013), Management Science → Bunch's live counter
Group discounts turn buyers into sales agents Jing & Xie (2011), Management Science 57(8)
Small teams + short windows drive team purchase at scale Pinduoduo (Modern Retail) · YC
Metamorphic relations find faulty crowdfunding contracts (the best relations killed 89% of mutants) Villanueva et al. (2025), arXiv 2501.09955 → our metamorphic tests
The sources, as published (screenshots of the abstract pages, Nov 22, 2026)
EconPapers: Early refund bonuses increase successful crowdfunding, Games and Economic Behavior 2021
Cason, Tabarrok & Zubrickas (2021), Games and Economic Behavior 129: "refund bonuses can increase the rate of campaign success by 50% or more"
EconPapers: Signaling Quality, Management Science 2025
Cason, Tabarrok & Zubrickas (2025), Management Science 71(7): refund bonuses as a quality signal
EconPapers: Enhancing fundraising with refund bonuses, Games and Economic Behavior 2017
Cason & Zubrickas (2017), Games and Economic Behavior 101: refund bonuses in threshold fundraising
arXiv 2501.09955: Metamorphic Testing for Smart Contract Validation
Villanueva, Srinivasan & Rehman (2025), arXiv 2501.09955: metamorphic testing of a crowdfunding contract

What is new here

Innovation Why it matters Where
Dominant assurance contract as a UTXO covenant The bonus pool is locked up front, so the promise to pay early joiners is enforced by consensus, not trust contracts/BunchState.cash
Keyless settlement by any open page No bot, no server, no key: whoever has the page open broadcasts complete or refund; duplicates are harmless src/core/settle.ts, src/ui/useBunch.ts
Authority by spending NFTs WizardConnect has no message signing, so the receipt NFT authorises leave and the shop key NFT authorises accept contracts/*.cash, src/core/build.ts
The bunch lives in the link Every parameter is in /b#v1.<base64url>; any browser rebuilds both contract addresses and reads state from Electrum src/core/spec.ts
Receipts are pickup vouchers The receipt NFT shows by name in wallets (BCMR) and the shop verifies it against the chain src/core/voucher.ts, functions/bcmr/[cat].ts
Early rebate survives a smaller deal (D1) If the shop accepts fewer buyers after the deadline, early joiners still get their bonus as a rebate merchantAccept in BunchState.cash
Mutation-tested covenants Every require is removed one by one; each must break a test or be explained MUTATION_REPORT.md

How it works

flowchart LR
  B[Buyer wallet] -- join: price --> S[(Seat UTXO<br/>seat NFT)]
  B -. receipt NFT .-> B
  ST[(BunchState<br/>minting NFT + bonus pool)] -- count+1 --> ST
  S --> C{count ≥ target?}
  C -- yes: anyone broadcasts complete --> M[Shop: price × n − 2%]
  C -- no, deadline passed: anyone broadcasts refund --> R[Every buyer: price<br/>early seats: + bonus]
Loading
sequenceDiagram
  participant U as Buyer (Selene)
  participant P as Bunch page (static)
  participant E as Electrum (Fulcrum)
  participant C as Covenants on BCH
  P->>E: read state + seats (scripthash subscribe)
  U->>P: tap Join
  P->>U: WizardConnect sign request (broadcast: false)
  U-->>P: signed join tx
  P->>E: broadcast join
  E-->>P: notification: count = target
  P->>E: broadcast keyless complete (any open page)
  C-->>P: shop paid, exact 2% fee
Loading
Transaction Who Inputs → outputs
genesis shop vout-0 coin → state (minting NFT + pool), shop key NFT, change
join buyer, 1 signature state + buyer coins → state′, seat (= price), receipt NFT, change
leave buyer (spends own receipt) state + seat + receipt → state′, full refund, change
complete anyone state + every seat → shop, exact platform fee
refund anyone, after deadline state + every seat → shop's leftover pool, each buyer price (+ bonus if early)
merchantAccept shop (spends key NFT) state + key + every seat → shop, fee, a bonus rebate to each early seat
escape / reclaim anyone, after grace period seat → its buyer / state → shop

Full design: ARCHITECTURE.md. The web app is static files on Cloudflare Pages; the only function is a stateless BCMR registry so wallets can name the receipts. No server holds keys or money.

Why Bitcoin Cash

Covenants that loop over inputs and inspect tokens, CashTokens NFTs as receipts and vouchers, sub-cent fees and instant 0-conf. "Anyone can settle" only works because the contract, not a server, decides who gets paid.

Security

Summary below; threat model, findings and remaining risks in SECURITY.md.

  • Seat theft through join/leave is blocked; settlement needs every seat (inputs.length == count + 1).
  • Refunds go to the address stored in each seat; forged seats, receipts and shop keys from other token categories are rejected.
  • Every payout is exact, so a broadcaster can't shift money between outputs (Finding F1); keyless miner fees are capped by maxFee.
  • After the grace period every seat can go home even if this site disappears.
  • Internal testing and review only. No third-party audit.

Tests

Layer What Command
Contract VM tests 131: 20 normal flows + 111 single-change attacks, each must fail inside a contract npm run test:vm
Mutation testing 82/95 rule mutants + 33/35 operator mutants killed; every survivor explained npm run mutate
App tests (vitest) 62: builders on the real BCH VM, WizardConnect signing, spec validation, metamorphic + fast-check property tests npm run test:unit
WizardConnect live real dapp + wallet managers paired over the public relay npm run test:live
Browser journeys create → join ×2 → paid → voucher verified; accept with rebate; refund + bonus; leave npm run e2e
Smoke + accessibility deployed site on desktop and phone, real mainnet Electrum read, axe WCAG 2 A/AA on every page npm run e2e:smoke
Real terminal output
131 contract VM tests passing 56 vitest tests passing Typecheck clean

Details: TESTING.md.

Run it

npm install
npm run compile      # cashc -> artifacts/
npm test             # VM tests + vitest
npm run dev          # http://localhost:5173 (VITE_NETWORK=chipnet for chipnet; VITE_MOCK=1 for a simulated chain)
npm run keygen && npm run seed:demo && npm run deploy   # see DEPLOYMENT.md

Hackathon requirements

Requirement Where
Anyone can make a useful mainnet tx Join the Judge Bunch (pinned on the home page); proven with Selene
Live demo https://bunch-cash.pages.dev
WizardConnect src/core/wallet.ts, src/ui/wallet.tsx; Selene join on mainnet
Banner: slides, repo, unique EMBER2026 address top of every page (src/ui/components.tsx)
Mainnet transactions docs/EVIDENCE.md

Full mapping of every rule and judging category to evidence: JUDGES.md.

Known limits

  • Every path ran on testnet3; on mainnet a real phone wallet has signed the join. Leave, create and shop-accept have not yet been signed by a real phone wallet (headless wallets sign them in npm run e2e).
  • CashScript can only prove "after", so late joins can't be blocked by the contract; the UI hides Join at the deadline and late seats are refunded in the same batch.
  • Time deadlines use median-time-past, about an hour behind wall clock; demos use block-height deadlines.
  • One state thread means one join per block of contention; the UI retries ("someone just took seat 4").
  • Not built yet: leader flow, public merchant history, tiers, PUSD, lanes, XO template, languages (ROADMAP.md).

Docs

JUDGES.md · ARCHITECTURE.md · SECURITY.md · TESTING.md · DEPLOYMENT.md · BUSINESS.md · ROADMAP.md · CHANGELOG.md · CONTRIBUTING.md · design notes docs/00–13.

Built for BCH BLAZE 2026 (Mainnet Track), starting from the planning pack in docs/ (contracts, VM tests, research). Thanks to the community member who funded the Bunch team shop on mainnet.

Licence

MIT (LICENSE). Uses @wizardconnect/* unmodified from npm; their docs say LGPL-3.0-or-later while some npm metadata disagrees.

About

Group buying on Bitcoin Cash: a covenant holds the money. Fill the group and the shop is paid; miss it and everyone is refunded with an early bonus. Live on mainnet.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages