◀ BACK TO THE POND

RULES

The pond is open 24/7, with no time limit and no cap on lines. You cast a bait in ERG; what bites is decided by a smart contract from two secret halves, one from the house and one from you. Nobody knows the result in advance, and nobody holds anyone's money but the contract.

FISH TABLE

There are 4 baits: Earthworm 0.1, Silver Shrimp 0.2, Cricket 0.3 and Magic Bait 0.5 ERG, and 4 fish. Every fish has a fixed prize, whatever the bait: the bigger the fish, the bigger the prize. A small bait cannot catch a big fish; a big bait still hooks small ones (and may then pay less than the bait).

FishPrizeEarthwormSilver ShrimpCricketMagic Bait
Perch0.15 ERG64.3%9.9%9.7%15.9%
Carp0.34 ERG—52.4%9.7%15.9%
Salmon0.6 ERG——40.3%15.9%
Dragon Fish5 ERG———6.2%
Old boot (miss)035.7%37.7%40.3%46.0%

Example: a Magic Bait (0.5 ERG) that hooks the Dragon Fish pays 5 ERG; one that hooks a Perch pays only 0.15 ERG. Each bait most often hooks exactly the biggest fish it can catch; on average every bait returns 96.5% of the bait (RTP), the house keeps 3.5%. Counting the network fees (when you cast and when you claim), what you get back for what you put in is about 94.7% for the Earthworm, 95.6% Silver Shrimp, 95.9% Cricket and 96.2% Magic Bait: the smaller the bait, the heavier the fees. This is a game of chance: only cast ERG you are fine to lose.

ONE CAST

  1. Cast. Connect your Nautilus wallet and pick a bait: Earthworm 0.1 ERG, Silver Shrimp 0.2 ERG, Cricket 0.3 ERG, Magic Bait 0.5 ERG. The bait goes into a box of your own (Bait box), locked by your wallet key. Until it is matched you can CANCEL and take it back at any time. One line at a time: the next cast opens once this one has its result.
  2. The house matches it. The house adds the rest, making a line (Cast box) that holds exactly the prize of the biggest fish that bait can catch (Earthworm: 0.15, Silver Shrimp: 0.34, Cricket: 0.6, Magic Bait: 5 ERG). Every line has its own house secret, locked as hash(secret) in the line itself. From here neither you nor the house can pull out.
  3. The line is revealed about 2 blocks (~4 minutes) after the match: the house publishes the line's secret on chain. Counted from your cast, the result usually comes in 5–7 minutes. The house has at most 30 blocks (~1 hour) to do it.
  4. Claim. The page sends your salt (your half of the secret) to the server and the house pays the fish's prize to your wallet, minus a 0.0011 ERG fee. On a miss the line goes to the house. The salt can only be sent while the page is open: keep it open until the result, or come back within 24 hours. If the server is down, CLAIM MYSELF sends the claim from your browser.

DEADLINES AND FEES

WHY NOBODY CAN CHEAT

CONTRACTS

The full ErgoScript source of the 3 contracts, exactly as the server uses them. To check them yourself: compile the source with the constants below (for example with @fleet-sdk/compiler); the address you get must match the one the explorer link opens. Then look the address up on an explorer: your bait sits at the Bait address, lines at Cast, results at Revealed.

Bait · view source

Constants (substitute them for the names in the source when compiling):

housePkpk:02eeba2b0b4ab6cdc8e6b55efdfaaf09567c6ff99c1973274fde01145830a520d4
unitlong:100000000
maxWaitint:3
castHashbytes:d0bf261b8f326d47d6bf0175086b0b3487a39c759081177151afcac9afa5bf83
// Bait box: the player's bait, waiting for the house to match it.
// R4 = playerPk (SigmaProp), R5 = saltHash (blake2b256(salt), 32 bytes). bait = SELF.value: 1, 2, 3 or 5 units
// (0.1 / 0.2 / 0.3 / 0.5 ERG); a bigger bait opens a bigger fish. Constants: housePk, unit, maxWait, castHash.
{
  val playerPk = SELF.R4[SigmaProp].get
  val bait = SELF.value
  val i = INPUTS.indexOf(SELF, 0)
  // the line's top prize, in tenths of the bait: its biggest fish (ro 0.15, chep 0.34, hoi 0.6, rong 5 ERG)
  val top10 = if (bait == unit) 15L else if (bait == 2L * unit) 17L else if (bait == 3L * unit) 20L else if (bait == 5L * unit) 100L else 0L

  // Match: the output at this input's index is a Cast holding the bait's top prize, for this player, salt and bait.
  // The house picks the commitment: the salt is only a hash here, so it cannot know the result.
  val matched = top10 > 0L && OUTPUTS.size > i && {
    val cast = OUTPUTS(i)
    val castEnd = cast.R5[Int].getOrElse(-1)
    blake2b256(cast.propositionBytes) == castHash &&
    cast.value == bait * top10 / 10L &&
    cast.R4[Coll[Byte]].getOrElse(Coll[Byte]()).size == 32 &&
    castEnd >= HEIGHT && castEnd <= HEIGHT + maxWait &&
    cast.R6[SigmaProp].isDefined && cast.R6[SigmaProp].get == playerPk &&
    cast.R7[Coll[Byte]].getOrElse(Coll[Byte]()) == SELF.R5[Coll[Byte]].get &&
    cast.R8[Long].getOrElse(0L) == bait
  }

  // A matching tx needs the house key; anything else is the player's (cancel, any time before it is matched).
  // if/else, not `playerPk || (housePk && matched)`: a match then needs one signature, not an OR proof that
  // Fleet's single-key prover (ergo_php) cannot make. The player cannot use the match path without the house key.
  if (matched) housePk else playerPk
}

View the address on an explorer

Cast · view source

Constants (substitute them for the names in the source when compiling):

revealWindowint:30
revealedHashbytes:8e3495294f990022ed8b46007d3163b692a566a0d43c05744ef20d20c9e0be7e
// Cast box: a matched line holding the top prize (bait + the house's share).
// R4 = commitment (blake2b256(secret)), R5 = castEnd (Int), R6 = playerPk (SigmaProp), R7 = saltHash, R8 = bait (Long).
// Constants: revealWindow, revealedHash (blake2b256 of the Revealed ergoTree).
{
  val castEnd = SELF.R5[Int].get
  val playerPk = SELF.R6[SigmaProp].get
  val i = INPUTS.indexOf(SELF, 0)

  // Reveal: anyone holding the secret, only after castEnd (an early secret would let players pick salts) and before
  // castEnd + revealWindow. The output at this input's index is a Revealed box: same value, secret instead of commitment.
  val revealed = HEIGHT > castEnd && HEIGHT <= castEnd + revealWindow && OUTPUTS.size > i && {
    val r = OUTPUTS(i)
    blake2b256(r.propositionBytes) == revealedHash &&
    r.value == SELF.value &&
    blake2b256(r.R4[Coll[Byte]].getOrElse(Coll[Byte]())) == SELF.R4[Coll[Byte]].get &&
    r.R5[Int].getOrElse(-1) == castEnd &&
    r.R6[SigmaProp].isDefined && r.R6[SigmaProp].get == playerPk &&
    r.R7[Coll[Byte]].getOrElse(Coll[Byte]()) == SELF.R7[Coll[Byte]].get &&
    r.R8[Long].getOrElse(-1L) == SELF.R8[Long].get
  }

  // The house did not reveal in time: the player takes the whole box (the bait's top prize).
  sigmaProp(revealed) || (sigmaProp(HEIGHT > castEnd + revealWindow) && playerPk)
}

View the address on an explorer

Revealed · view source

Constants (substitute them for the names in the source when compiling):

housePkpk:02eeba2b0b4ab6cdc8e6b55efdfaaf09567c6ff99c1973274fde01145830a520d4
revealWindowint:30
claimWindowint:720
claimFeelong:1100000
unitlong:100000000
// Revealed box: the secret is public, the result is decided by the player's salt.
// R4 = secret, R5 = castEnd (Int), R6 = playerPk (SigmaProp), R7 = saltHash, R8 = bait (Long). Value = the bait's top prize.
// Context var 0 = salt. Constants: housePk, revealWindow, claimWindow, claimFee, unit.
{
  val secret = SELF.R4[Coll[Byte]].get
  val castEnd = SELF.R5[Int].get
  val playerPk = SELF.R6[SigmaProp].get
  val bait = SELF.R8[Long].get
  // tier 0..3 for baits of 1, 2, 3, 5 units (Cast only holds those)
  val t = if (bait == unit) 0 else if (bait == 2L * unit) 1 else if (bait == 3L * unit) 2 else 3
  val claimEnd = castEnd + revealWindow + claimWindow

  val salt = getVar[Coll[Byte]](0).getOrElse(Coll[Byte]())
  val saltOk = blake2b256(salt) == SELF.R7[Coll[Byte]].get

  // roll = first 2 bytes of blake2b256(secret ++ salt), unsigned, in 0..65535
  val h = blake2b256(secret ++ salt)
  val b0 = h(0).toInt
  val b1 = h(1).toInt
  val roll = (if (b0 < 0) b0 + 256 else b0) * 256 + (if (b1 < 0) b1 + 256 else b1)
  // Per tier, cumulative cuts out of 65536 for rong, hoi, chep, ro; 0-wide = that fish does not bite this bait. A bigger
  // bait keeps the smaller fish. RTP 96.5% for every bait (see DESIGN.md).
  val cuts = Coll(0, 0, 0, 42160, 0, 0, 34337, 40829, 0, 26443, 32784, 39125, 4047, 14494, 24941, 35388)
  // Each fish has a fixed prize, whatever the bait, in tenths of a unit: rong 5, hoi 0.6, chep 0.34, ro 0.15 ERG
  val p10 = if (roll < cuts(4 * t)) 500L else if (roll < cuts(4 * t + 1)) 60L else if (roll < cuts(4 * t + 2)) 34L
    else if (roll < cuts(4 * t + 3)) 15L else 0L
  val prize = unit * p10 / 10L

  // Claim: anyone with the salt, one Revealed per tx (INPUTS(0)), so two boxes can never share one house output.
  // OUTPUTS(0) pays the player (the claim fee comes out of the prize), OUTPUTS(1) the rest to the house.
  val claimed = saltOk && prize > 0L && HEIGHT <= claimEnd && INPUTS(0).id == SELF.id &&
    OUTPUTS(0).propositionBytes == playerPk.propBytes && OUTPUTS(0).value >= prize - claimFee &&
    (prize == SELF.value ||
      (OUTPUTS.size > 1 && OUTPUTS(1).propositionBytes == housePk.propBytes && OUTPUTS(1).value >= SELF.value - prize))

  // The house takes a line the salt proves lost, or any line left unclaimed after claimEnd.
  sigmaProp(claimed) || (housePk && sigmaProp((saltOk && prize == 0L) || HEIGHT > claimEnd))
}

View the address on an explorer

pk: is the public key (33 bytes hex) of the house's game address, long: is in nanoERG, int: in blocks, bytes: is the blake2b256 of the next contract's ErgoTree.