The go-ethereum Contract Tutorial greeter, deployed with the greeting: test
Historical Significance
The Contract Tutorial was the introduction to Solidity that shipped with go-ethereum, and deploying the greeter was its final step. Each copy therefore preserves the sentence its author chose to write onto a public chain while learning the tools. The Solidity source here was recovered by compiling the tutorial text with period compilers until the output matched the deployed bytecode exactly.
Context
The Contract Tutorial on the go-ethereum wiki was written for Frontier in 2015 and stayed in use as an introduction to Solidity well past the Homestead fork of March 2016. Copies of its greeter went on being deployed to mainnet by people working through the tutorial, compiled with whichever Solidity release was current when they reached the last step.
Key Facts
Description
The greeter is the worked example of the Contract Tutorial on the go-ethereum wiki. It inherits a base contract named mortal, which records the account that created it and exposes kill(), a function that self-destructs the contract and sends its balance to that account. Only the creator can call it.
The greeter itself adds one string. The constructor stores the greeting given at deployment and greet() returns it. There is no setter, so the greeting a copy is born with is the only greeting it ever has, and no account other than the creator can affect it.
This copy was deployed with the greeting: test
Heuristic Analysis
The following characteristics were detected through bytecode analysis and may not be accurate.
DAO Fork Era
The controversial fork to recover funds from The DAO hack.
Bytecode Overview
Verified Source Available
This contract has verified source code on Etherscan.
Show source code (Solidity)
// Submitted by EthereumHistory (ethereumhistory.com)
contract mortal {
/* Define variable owner of the type address*/
address owner;
/* this function is executed at initialization and sets the owner of the contract */
function mortal() { owner = msg.sender; }
/* Function to recover the funds on the contract */
function kill() { if (msg.sender == owner) suicide(owner); }
}
contract greeter is mortal {
/* define variable greeting of the type string */
string greeting;
/* this runs when the contract is executed */
function greeter(string _greeting) public {
greeting = _greeting;
}
/* main function */
function greet() constant returns (string) {
return greeting;
}
}
External Links
Related contracts
ShapeShift Chain-Split Forwarder
Same eraEarliest ShapeShift on-chain contract (Jul 24, 2016). Simple ETH forwarder with an active flag — routes deposits to target when active and msg.value > 0.
0xa2d5c5...d549deJuly 24, 2016Balance Router
Same eraDAO whitehat balance-conditional router: if EF/whitehat address holds >1M ETH, route to addr1; otherwise route to addr2.
0x6e9ccd...aee851July 25, 2016ShapeShift Chain-Split Receiver
Same eraShapeShift ETH/ETC routing contract (Jul 26, 2016). Forwards ETH to target only when on-chain forked() oracle result matches stored boolean — routing deposits to the correct wallet on each chain post-DAO-fork.
0x3e7756...2e7a25July 26, 2016ShapeShift Chain-Split Receiver
Same eraShapeShift ETH/ETC routing contract (Jul 26, 2016). Twin instance of the ShapeShiftReceiver — identical bytecode, configured for the opposite chain fork state.
0x89afcc...a51456July 26, 2016CanaryV7
Same eraA liveness canary for the Ethereum Alarm Clock, deployed 28 July 2016.
0x6c3abc...4aa180July 28, 2016Migrations
Same eraTruffle's Migrations bookkeeping contract: it records the number of the last completed migration so a rerun knows where to resume.
0x765c89...e36a52July 29, 2016