ERGOFLIP PLAY

HOW IT WORKS

ErgoFlip is a coin flip against the house on the Ergo blockchain. You and the house each put the same bet into one box locked by a smart contract. Guess the side right and the box is yours; guess wrong and it goes to the house. The server never holds your funds, and neither side can cheat.

YOUR BET
+ HOUSE BET
↓
ONE BOX
WINNER TAKES ALL

THE COIN

HEAD side of the coin: the Ergo Σ logo
HEAD
The Ergo Σ logo
on chain: R4 = 1
TAIL side of the coin: the word ERG
TAIL
The word ERG
on chain: R4 = 0

In the game box, R4 is one byte: 1 for HEAD, 0 for TAIL The explorer shows it as 1 / 0; the raw register is 0201 / 0200 (type Byte + value).

STEP BY STEP

  1. 1
    Connect Nautilus. Your wallet stays in your browser; the game only asks it to sign.
  2. 2
    New game. The house picks a random side and a random 128-bit secret, and shows you only the commitment blake2b256(secret ++ side). It builds the game transaction twice, once for each side you could pick, and signs its own bet in both before you choose.
  3. 3
    Pick HEAD or TAIL. Nautilus signs only your inputs of that version and sends it. That single transaction puts both bets in one game box: 2 × bet, with R4 = your pick (HEAD = 1, TAIL = 0), R5 = the commitment, R6 = the house key, R7 = your key.
  4. 4
    Wait for a block (usually about 2 minutes). The house reveals only once the game box is confirmed.
  5. 5
    Result. If your pick equals the house side, you win: the house hands you the secret and you press CLAIM PRIZE whenever you like. Otherwise the house takes the box by revealing the secret on chain.

WHY IT IS FAIR

THE CONTRACT

Every game box is locked by this ErgoScript. Compile it to get the ergoTree, and compare it with the game box on the explorer.

{
  val playerChoice = SELF.R4[Byte].get
  val answerHash   = SELF.R5[Coll[Byte]].get
  val housePk      = SELF.R6[SigmaProp].get
  val playerPk     = SELF.R7[SigmaProp].get
  val houseChoice  = OUTPUTS(0).R4[Byte].get
  val secret       = OUTPUTS(0).R5[Coll[Byte]].get
  val revealed = blake2b256(secret ++ Coll(houseChoice)) == answerHash && (houseChoice == 1 || houseChoice == 0)
  sigmaProp(revealed) && (if (playerChoice == houseChoice) playerPk else housePk)
}
ergoTree
195503040004020400d802d601b2a5730000d602e4c672010402ea02d1ed93cbb3e4c67201050e8301027202e4c6a7050ed801d6037e720204ec937203730193720373029593e4c6a704027202e4c6a70708e4c6a70608

The whole game is open source: the contract, the house's offer builder, the checks your browser runs before Nautilus signs, and the server. Read the code on GitHub.

BETS AND FEES

Bet
0.01 – 1 ERG
Network fee
0.0011 ERG per transaction
If you win
you get 2 × bet − 0.0011 ERG (claim fee), net +bet − 2 × fee
If you lose
you lose your bet + the 0.0011 ERG fee of your transaction

The house takes no cut: over many games you break even, minus network fees.

GOOD TO KNOW

PLAY NOW