The greeter with a changeable greeting and a block number reader
Historical Significance
The greeter with a setter is a small but real departure from the tutorial: once the greeting can be changed after deployment, the contract has mutable state that somebody has to be allowed to change, and the question of who becomes unavoidable. Walkthroughs of the period added exactly this step to introduce access control.
Context
Deployed in December 2015 on the Frontier chain.
Key Facts
Description
The greeter that repeats a string given at construction, extended past the tutorial version: setGreeting lets the creator replace the greeting after deployment, and getBlockNumber returns the current block, included by its author as a demonstration of reading a global rather than for any purpose of its own. kill returns the balance to the creator. The declaration order matters to the compiled result: kill is written above setGreeting, and putting them the other way round moves a jump and changes the bytecode.
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)
/*
The following is an extremely basic example of a solidity contract.
It takes a string upon creation and then repeats it when greet() is called.
*/
contract Greeter // The contract definition. A constructor of the same name will be automatically called on contract creation.
{
address creator; // At first, an empty "address"-type variable of the name "owner". Will be set in the constructor.
string greeting; // At first, an empty "string"-type variable of the name "greeting". Will be set in constructor and can be changed.
function Greeter(string _greeting) public // The constructor. It accepts a string input and saves it to the contract's "greeting" variable.
{
creator = msg.sender;
greeting = _greeting;
}
function greet() constant returns (string)
{
return greeting;
}
function getBlockNumber() constant returns (uint) // this doesn't have anything to do with the act of greeting
{ // just demonstrating return of some global variable
return block.number;
}
function kill()
{
if (msg.sender == creator)
suicide(creator); // kills this contract and sends remaining funds back to creator
}
function setGreeting(string _newgreeting)
{
greeting = _newgreeting;
}
/**********
Standard kill() function to recover funds
**********/
}External Links
Related contracts
Info
Same deployerA 280-byte contract that exposes one stored number through info() and can be destroyed by its deployer via kill().
0x44b10e...0dd430August 20, 2015Info
Same deployerA 280-byte contract that exposes one stored number through info() and can be destroyed by its deployer via kill().
0xef550c...ff98bcAugust 20, 2015greeter
Same deployerThe Frontier-era greeter tutorial contract: returns a constructor-set greeting from greet(), with an owner-only kill() inherited from mortal.
0x083e1d...0fb616August 30, 2015Contract 0xf3b6b2...2c6903
Same deployerThe Frontier greeter carrying one extra unused storage slot
0xf3b6b2...2c6903August 30, 2015greeter
Same deployerThe Frontier-era greeter tutorial contract: returns a constructor-set greeting from greet(), with an owner-only kill() inherited from mortal.
0x3ae3af...e4e04dAugust 31, 2015Greeter
Same deployerThe Greeter from the solidity-baby-steps tutorials, deployed with an empty greeting.
0x68b58d...dc2dc0December 1, 2015