A time lock: its owner sets one future expiry, and after that moment passes redeem() destroys the contract and returns its balance.
Historical Significance
Deferred spending with nobody to ask, an idea people reached for as soon as a contract could hold money: the promise is enforced by a contract that cannot be talked out of it rather than by a custodian. Making the deadline settable once and only into the future is the detail that turns a convenience into a commitment.
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
Description
A contract that holds ether until a date its owner chooses. lock(expiration) takes a timestamp and accepts it only if it lies in the future and no expiry has been set yet, so the deadline can be set exactly once and never moved or removed afterwards. Only the owner can call it.
After the timestamp has passed, redeem() self-destructs the contract and sends everything it holds to that owner. Before then redeem() does nothing, and there is no other way out: no partial withdrawal, no cancel, and no recipient other than the owner.
If the owner never calls lock, the expiry stays zero, which is in the past, and the balance can be redeemed at any time.
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
This contract has verified source code on Etherscan.
Show source code (Solidity)
// Submitted by EthereumHistory (ethereumhistory.com)
contract owned {
function owned() {
owner = msg.sender;
}
modifier onlyowner() {
if (msg.sender == owner)
_
}
address owner;
}
contract CoinLock is owned {
uint public expiration; // Timestamp in # of seconds.
function lock(uint _expiration) onlyowner returns (bool) {
if (_expiration > block.timestamp && expiration == 0) {
expiration = _expiration;
return true;
}
return false;
}
function redeem() onlyowner {
if (block.timestamp > expiration) {
suicide(owner);
}
}
}External Links
Related contracts
Greeter
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, 2015Greeter
Same eraA Frontier-era Greeter contract with the message: 'Hello World!'
0x113158...72fa8aAugust 8, 2015