Back to Home

SerpentGamble

Unknown
Part of The Vitalik Collection
0x034df8705289...d3bdf7200e2f
FrontierContract #1,376Exact Bytecode MatchEdit this contract
Deployed September 20, 2015 (10 years ago)Block 263,291

Provably-fair betting game where players choose their own odds. The owner settles bets with a commit-reveal random seed. Includes a 2-day emergency refund.

Frontier EraVerified Source
Key Facts
Deployer
Vitalik Buterin(0x1db343...fa6ee6)
Deployment Block
263,291
Deployment Date
Sep 20, 2015, 02:38 PM
Code Size
1.3 KB
Gas at Deploy
368,150
Transactions by Year
201513

Description

Deployed September 20, 2015 in block 263291 by Vitalik Buterin (0x1Db3439a222C519ab44bb1144fC28167b4Fa6EE6). Written in Serpent, an early Ethereum high-level language. The runtime (1264 bytes) and the full creation bytecode (1286 bytes) both reproduce byte-for-byte from the reconstructed source using the ethereum/serpent compiler at commit f0b4128.

How it works:

bet(guess, odds): payable. A player sends ETH and picks their own odds, a win chance in per-mille from 0 to 1000. The contract records a payout of msg.value * 1000 / odds, a fair line with no house edge, along with the player's bytes32 guess used as draw entropy. The bet is rejected if 100 bets are already open (returns -1) or if the bank cannot cover the payout (returns -2), and the stake is refunded in both cases. It emits Bet(sender, value, odds).

set_curseed(a, b): owner only. Settles the round. It requires sha3(curseed) == a, or curseed == 0 on the first run. For each open bet it computes rand = sha3([a, guess]) / (2^256 / 1000), giving a number from 0 to 999, and pays the player the recorded payout if rand < odds. It then clears all bets, stores the new seed commitment b, resets a 2-day deadline, and emits NewSeed.

emergency_withdraw(): callable by anyone once the 2-day deadline passes without a settlement. It refunds every open bet its original stake (payout * odds / 1000) and then self-destructs.

withdraw(): sends the bank's free balance (this.balance minus reserved payouts) to the owner.

get_curseed(), get_num_bets(), get_bet(id): read-only views.

The seed mechanism is a commit-reveal scheme. Each round the owner publishes a value and later reveals its hash to drive the per-bet randomness, so the draw cannot be chosen after bets are placed. The 2-day deadline and emergency_withdraw path protect bettors if the owner stops settling.

On-chain history shows the contract was only ever exercised by its deployer: 14 set_curseed reveals and no external bettors. It holds no balance today.

Source Verified

SerpentExact bytecode match(1,286 bytes)
Compiler: f0b4128

Runtime bytecode (1264 bytes) and full creation bytecode (1286 bytes, including the init constructor that sets the owner) both reproduce byte-for-byte from the reconstructed Serpent source. Compiled with ethereum/serpent at commit f0b4128; commit 146cc8a, dated 2015-09-20, produces an identical result. runtime sha256 96fc31b95c65b4110a4c25de8e01c1b6abd3094b972f16ccf1d91d64d9fe7ca0, creation sha256 22efde675afdfa05b2bb6335ff2a9d5ff3411ce49786fac6c5ed2e98f37e03e1.

Heuristic Analysis

The following characteristics were detected through bytecode analysis and may not be accurate.

Detected Type: Unknown

Bytecode Overview

Opcodes1,286
Unique Opcodes150
Jump Instructions59
Storage Operations38

External Links

Related contracts