The dapp-bin standardized currency API, with one slot the code never touches
Context
Frontier and Homestead era deployment.
Key Facts
Description
Ethereum's dapp-bin repository published a set of standardized contract APIs, and this is its currency: balances held in an Account struct, sendCoin and sendCoinFrom, an approval mapping named withdrawers, and a CoinSent event. The deployment differs from the published file in one respect. A second 32-byte member sits inside Account between balance and withdrawers, shifting every withdrawers access from offset one to offset two. Nothing reads or writes it, so the runtime is the same length as the original and differs only in those seven nibbles. The contract's own name is fixed by its bytecode rather than assumed: compiled as currency, the function currency() is the constructor and never reaches the dispatcher, which is what the deployed code shows. Under any other name that function becomes public, the dispatcher gains a fourth entry and the runtime grows by 45 bytes.
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 currency {
struct Account {
uint balance;
uint spent;
mapping ( address => uint) withdrawers;
}
mapping ( address => Account ) accounts;
event CoinSent(address indexed from, uint256 value, address indexed to);
function currency() {
accounts[msg.sender].balance = 1000000;
}
function sendCoin(uint _value, address _to) returns (bool _success) {
if (accounts[msg.sender].balance >= _value && _value < 340282366920938463463374607431768211456) {
accounts[msg.sender].balance -= _value;
accounts[_to].balance += _value;
CoinSent(msg.sender, _value, _to);
_success = true;
}
else _success = false;
}
function sendCoinFrom(address _from, uint _value, address _to) returns (bool _success) {
uint auth = accounts[_from].withdrawers[msg.sender];
if (accounts[_from].balance >= _value && auth >= _value && _value < 340282366920938463463374607431768211456) {
accounts[_from].withdrawers[msg.sender] -= _value;
accounts[_from].balance -= _value;
accounts[_to].balance += _value;
CoinSent(_from, _value, _to);
_success = true;
_success = true;
}
else _success = false;
}
function coinBalance() constant returns (uint _r) {
_r = accounts[msg.sender].balance;
}
function coinBalanceOf(address _addr) constant returns (uint _r) {
_r = accounts[_addr].balance;
}
function approve(address _addr) {
accounts[msg.sender].withdrawers[_addr] = 340282366920938463463374607431768211456;
}
function isApproved(address _proxy) returns (bool _r) {
_r = (accounts[msg.sender].withdrawers[_proxy] > 0);
}
function approveOnce(address _addr, uint256 _maxValue) {
accounts[msg.sender].withdrawers[_addr] += _maxValue;
}
function isApprovedOnceFor(address _target, address _proxy) returns (uint256 _r) {
_r = accounts[_target].withdrawers[_proxy];
}
function disapprove(address _addr) {
accounts[msg.sender].withdrawers[_addr] = 0;
}
}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