A coin flip on the block timestamp that pays double or keeps the stake
Historical Significance
Randomness is the problem gambling contracts exist to expose. Every value available inside the EVM is either known in advance or chosen by the account producing the block, so a payout decided from block data can be steered by whoever mines it. This run of revisions is that lesson being learned in public, one deployment at a time, and the answer the ecosystem eventually reached, an oracle or a commit and reveal, is not available here at all.
Context
Deployed in August 2015, in the first month of the Frontier chain. The same account verified another contract of its own with the identical interface, which is where the name comes from.
Key Facts
Description
Send it more than twice its own balance and it flips: the low bit of the block timestamp is written to storage as the result, and if that bit is set the sender is paid back twice what they sent, otherwise the contract keeps everything. Anything less than twice the balance is refused outright, which caps the payout at what the contract can cover. A donate function exists solely to fund it, and the flip result stays readable afterwards. The randomness is the timestamp, which the miner producing the block chooses.
Source Verified
Heuristic Analysis
The following characteristics were detected through bytecode analysis and may not be accurate.
Frontier Era
The initial release of Ethereum. A bare-bones implementation for technical users.
Bytecode Overview
Verified Source Available
Source verified through compiler archaeology and exact bytecode matching.
View Verification ProofShow source code (Solidity)
// Submitted by EthereumHistory (ethereumhistory.com)
contract CoinFlipper {
uint8 public flip;
function donate() {
}
function() {
var v = msg.value;
var b = address(this).balance;
if (v < 2 * b) {
return;
}
flip = uint8(block.timestamp % 2);
if (flip == 0) {
} else {
msg.sender.send(2 * v);
}
}
}External Links
Related contracts
Greeter
Same deployerA Frontier-era Greeter contract with the message: 'Hello World!'
0x113158...72fa8aAugust 8, 2015CoinFlipper
Same deployerA 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.
0x5bd4a6...527b12August 8, 2015CoinFlipper
Same deployerTimestamp-parity coinflip with balance guard and donate().
0xb87824...8642adAugust 8, 2015CoinFlip
Same deployerTimestamp-parity coinflip; payout is `2 * msg.value` via `send`.
0x0013e7...1c2989August 8, 2015Multiply7
Same deployerThe Multiply7 tutorial contract — one of the first Solidity examples ever deployed to mainnet.
0xfcb20a...b96d3fAugust 10, 2015token
Same deployerThe Frontier Guide's Coin tutorial contract: a pre-ERC-20 token with coinBalanceOf, sendCoin and a CoinTransfer event.
0xf30bf3...8f7db2August 10, 2015