The guide's kill contract with a coin flip added to its fallback
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 December 2015 on the Frontier chain.
Key Facts
Description
It keeps the standard shape of the mortal example, an owner recorded at construction and a kill that returns the balance to that owner, and adds a payable fallback that gambles. Every payment reads the block timestamp: if it is even the call simply returns and the contract keeps the money, and if it is odd the sender is paid back twice what they sent. There is no check that the contract can cover the payout, so a win against an empty balance simply fails to send.
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 Mortal {
address owner;
function Mortal() {
owner = msg.sender;
}
function kill() {
if (msg.sender == owner) {
suicide(owner);
}
}
function() {
var v = msg.value;
var t = block.timestamp;
if (t % 2 == 0) {
return;
} else {
msg.sender.send(2 * v);
}
}
}External Links
Related contracts
greeter
Same deployerThe classic Frontier 'greeter' (Nov 2015): a mortal-derived contract storing a constructor-set greeting returned by greet(), with an owner-only kill().
0x09338c...7e82d2November 2, 2015Greeter
Same eraA HelloWorld greeter deployed at block 51,909 on 8 August 2015, one of a run of contracts from the same account that week.
0x412fda...7267edAugust 8, 2015Greeter
Same eraA Greeter with the message 'Ethereum will change the world smarter' - deployed Aug 8, 2015 by a developer connected to the Tokyo Smart Contract meetup.
0xda0c1c...7a68ebAugust 8, 2015MessageStore
Same eraA 6-line contract storing a single public string, deployed Day 9 of Ethereum by a prolific early experimenter who shipped 18 contracts in one week.
0xd2eccd...ff3d6bAugust 8, 2015Greeter
Same eraThe go-ethereum Contract Tutorial greeter, deployed with the greeting: Hello World!
0x506f4b...466983August 8, 2015Contract 0xd4eae4...a2c77a
Same eraThe ethereum.org crowdsale tutorial, deployed on the ninth day of the public chain, with the funding goal, deadline and price fixed at construction.
0xd4eae4...a2c77aAugust 8, 2015