The basic info getter from the solidity-baby-steps tutorials, a read only window onto the block and message globals.
Historical Significance
The ethereum.org token tutorial is where most people who deployed a token in this period started, and this is its opening form: a balance mapping, a guarded subtraction and the metadata a wallet needs to show a name. It has no allowance, so nothing can spend on a holder's behalf and no exchange or escrow can be given a limit. That gap is exactly what ERC-20 was written to close, and copies like this one are the before picture.
Context
Deployed 31 August 2015, during the Frontier era.
Key Facts
Description
Example 15 of the solidity-baby-steps tutorial series, deployed by the author of the series. It records its creator and then does nothing but read the globals back out: the current block's coinbase, difficulty, gas limit, number and timestamp, the message sender, value and gas, and tx.gasprice and tx.origin. The comments in the source are the author working out what each one means, including the note that the miner address returned is the miner of the block the call runs in and not the miner of the block that created the contract.
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 basicInfoGetter {
address creator;
function basicInfoGetter() public
{
creator = msg.sender; // msg is a global variable
}
function getCurrentMinerAddress() constant returns (address) // get CURRENT block miner's address,
{ // not necessarily the address of the miner when this block was born
return block.coinbase;
}
function getCurrentDifficulty() constant returns (uint)
{
return block.difficulty;
}
function getCurrentGaslimit() constant returns (uint) // the most gas that can be spent on any given transaction right now
{ // or the most gas that can be spent, globally, on each block?
return block.gaslimit;
}
function getCurrentBlockNumber() constant returns (uint)
{
return block.number;
}
// this should work according to Contract Tutorial, but solidity compiler doesn't like it.
// function getBlockhash(uint) constant returns (bytes32)
// {
// return block.blockhash;
// }
function getBlockTimestamp() constant returns (uint) // returns current block timestamp in SECONDS (not ms) from epoch
{
return block.timestamp; // also "now" == "block.timestamp", as in "return now;"
}
function getMsgData() constant returns (bytes) // UNSURE: this always returns "0xc8e7ca2e" for me, regardless of account/computer I'm requesting from.
{ // adding an input parameter would probably change it with each diff call?
return msg.data;
}
function getMsgGas() constant returns (uint) // UNSURE: returns gas remaining on this contract? Always returns 49978451 for me.
{ // would adding an input parameter change this value?
return msg.gas;
}
function getMsgSender() constant returns (address) // returns the address of whomever made this call
{ // not necessarily the creator of the contract
return msg.sender;
}
function getMsgValue() constant returns (uint) // returns amt of wei sent with this call
{
return msg.value;
}
function getTxGasprice() constant returns (uint) // returns gasprice required when contract deployed? Returns 50000000, so if msg.gas
{ // is what is remaining (49978451), then that makes sense as the cost to deploy was the diff.
return tx.gasprice;
}
function getTxOrigin() constant returns (address) // returns sender of the transaction
{ // What if there is a chain of calls?
return tx.origin;
}
function getContractAddress() constant returns (address)
{
return this;
}
function getContractBalance() constant returns (uint) // how is this different from gas?
{
return this.balance;
}
/**********
Standard kill() function to recover funds
**********/
function kill() returns (bool)
{
if (msg.sender == creator)
{
suicide(creator); // kills this contract and sends remaining funds back to creator
return true;
}
else
{
return false;
}
}
}
/*
var abi = [{
"constant": true,
"inputs": [],
"name": "getContractAddress",
"outputs": [{
"name": "",
"type": "address"
}],
"type": "function"
}, {
"constant": false,
"inputs": [],
"name": "kill",
"outputs": [{
"name": "",
"type": "bool"
}],
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "getContractBalance",
"outputs": [{
"name": "",
"type": "uint256"
}],
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "getCurrentBlockNumber",
"outputs": [{
"name": "",
"type": "uint256"
}],
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "getTxGasprice",
"outputs": [{
"name": "",
"type": "uint256"
}],
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "getBlockTimestamp",
"outputs": [{
"name": "",
"type": "uint256"
}],
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "getMsgSender",
"outputs": [{
"name": "",
"type": "address"
}],
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "getCurrentGaslimit",
"outputs": [{
"name": "",
"type": "uint256"
}],
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "getMsgGas",
"outputs": [{
"name": "",
"type": "uint256"
}],
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "getCurrentDifficulty",
"outputs": [{
"name": "",
"type": "uint256"
}],
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "getMsgValue",
"outputs": [{
"name": "",
"type": "uint256"
}],
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "getTxOrigin",
"outputs": [{
"name": "",
"type": "address"
}],
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "getMsgData",
"outputs": [{
"name": "",
"type": "bytes"
}],
"type": "function"
}, {
"constant": true,
"inputs": [],
"name": "getCurrentMinerAddress",
"outputs": [{
"name": "",
"type": "address"
}],
"type": "function"
}, {
"inputs": [],
"type": "constructor"
}];
*/External Links
Related contracts
GetBalance
Same deployerCyrus Adkisson experimental getter (Sep 2015) exposing the ether balance of a hardcoded address via getMyBalance(). Verified byte-for-byte with soljson v0.1.1.
0x759ad4...239a87August 26, 2015Contract 0xddcd64...a08e7b
Same deployerThe greeter tutorial contract: it stores a greeting set at deployment and can be shut down by its owner.
0xddcd64...a08e7bAugust 26, 2015basicInfoGetter
Same deployerA tour of the EVM globals, carrying the constructor of the file it was copied from
0xad826c...d33547August 31, 2015Contract 0xba575c...78733f
Same deployerA contract built to probe what the msg globals actually return, endowed with 5 ETH, deployed 1 September 2015.
0xba575c...78733fSeptember 1, 2015Contract 0x8b180c...c084df
Same deployerA third deployment of the msgExaminer that records its own creation message
0x8b180c...c084dfSeptember 1, 2015Contract 0x46dce1...3086aa
Same deployerA contract built to probe what the msg globals return, endowed with 3 ETH on 1 September 2015.
0x46dce1...3086aaSeptember 1, 2015