Back to Home

CoinFlipper

Utility
0x5bd4a6d9fa20...669957527b12
FrontierContract #83Source VerifiedEdit this contract
Deployed August 8, 2015 (11 years ago)Block 55,563

A coin flip settled on the parity of the block timestamp, with a size guard written the wrong way round so no bet can ever be placed.

Frontier EraVerified Source

Historical Significance

An early gambling contract that shows both hazards of the form at once: a payout decided by a value the block producer controls, and a guard written backwards that made the whole contract inert. The author noticed the second problem within the hour and redeployed; the timestamp problem went on being repeated by dice contracts for years.

Context

Ethereum's Frontier network went live on 30 July 2015. Almost nothing was deployed in its first months except tutorial code and small experiments, written in a Solidity only a few months old and with no test network in common use, so the experiments happened on mainnet.

Key Facts
Deployment Block
55,563
Deployment Date
Aug 8, 2015, 10:25 PM
Code Size
186.0 B
Gas at Deploy
66,999

Description

A gambling contract with two entry points. donate() takes ether and does nothing with it. The fallback function is the bet: it compares the stake against the contract's own balance, records the block timestamp in a public variable, and pays the sender twice the stake when that timestamp is odd.

The guard is inverted. It requires the stake to be smaller than twice the balance and returns otherwise, but the balance it reads already includes the stake just received, so the condition holds for every non-zero bet and the function returns before reaching the flip. No bet placed on this contract can ever be settled.

The same account deployed a corrected version sixty four blocks later, with the comparison the other way around.

Settling on block.timestamp would have been unsafe in any case: the miner producing the block chooses it within a tolerance, and here the payout is twice the stake.

Heuristic Analysis

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

Detected Type: Utility

Bytecode Overview

Opcodes186
Unique Opcodes56
Jump Instructions13
Storage Operations2

External Links

Related contracts