r/ergonauts • • 23h ago

I built ErgoFlip: an open-source, provably fair coin flip on Ergo (one ErgoScript box, commit-reveal, Nautilus)

4 Upvotes

Hi Ergonauts 👋

I'm the developer of ErgoFlip (https://ergoflip.app), a simple heads-or-tails game against the house, built entirely on Ergo's eUTXO model. It's live on mainnet and fully open source: https://github.com/dungvn3000/ergoflip

How it works

  1. You pick a bet (0.01 to 1 ERG). The house picks its side first and commits to it with blake2b256(secret ++ side).
  2. You pick HEAD or TAIL and sign with Nautilus. Your stake and the house's stake go into one box locked by a small ErgoScript contract.
  3. After one block, the house reveals. Only the winner's key can spend the box: if you win, you claim 2× your bet straight to your wallet.

Why it's fair

  • The house can't change its side: the commitment is fixed before you pick, and the contract only opens the box with the matching secret.
  • The house can't back out: it pre-signs its inputs for both the HEAD and TAIL versions of the game tx before you choose.
  • You see exactly what you sign: the page checks the offer (contract, amounts, registers, change) before Nautilus opens.
  • No account, no custody, no timeout: an unclaimed box eventually goes to storage rent.
  • Every game is verifiable on chain. The settlement tx publishes the house's side and secret, so anyone can check the commitment. The contract is on the "How it works" page if you want to compile it and compare the address.

Stack: CodeIgniter 4 + Alpine.js, Fleet SDK, Nautilus, a cron that settles house wins, and retro pixel-art UI đŸ•šī¸

It's a small hobby project with a low max bet for now. I'd love feedback on the contract, the UX, or anything you'd do differently. Bug reports and PRs are welcome on GitHub.

Play responsibly: it's a 50/50 game, and only bet what you're happy to lose.