Unicorns (๐ฆ) token by avsa โ 1802B variant. Source recovered by bytecode analysis, verified on Etherscan and Sourcify.
Historical Significance
Part of the canonical Ethereum Token Tutorial by Alex Van de Sande, Ethereum Foundation UX Lead. Among the earliest ERC-20-style token implementations on Ethereum mainnet, deployed February 2016 alongside a set of 8 nearly-identical contracts.
Context
Deployed in the Ethereum Homestead era, February 2016, by Alex Van de Sande as one of 8 Unicorns (๐ฆ) token demonstration contracts for the Ethereum Foundation Token Tutorial. The same token was later used in the Democracy DAO tutorial. Compiler: solc v0.2.0-nightly.2016.1.13+commit.d2f18c73 with --optimize.
Token Information
Key Facts
Description
One of 8 early ERC-20 token contracts deployed by Alex Van de Sande (AVSA, ENS: alex.vandesande.eth) on February 11, 2016 as part of the official Ethereum Token Tutorial at ethereum.org. This 1802B variant has all explicit functions declared before state variables in the MyToken body, and has transferOwnership in MyToken. The fallback function throws (no ETH forwarding). Source was recovered by deep bytecode analysis of compiler output ordering (Solidity 0.2.0, commit d2f18c73).
Source Verified
Compiler identified: soljson-v0.2.0-nightly.2016.1.13+commit.d2f18c73. Source structure fully reconstructed (owned base contract + MyToken is owned). Compiles to correct byte size. Two small optimizer instruction-ordering regions differ from on-chain bytecode - not resolvable without the exact build of this compiler.
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 (near-exact bytecode match).
View Verification ProofShow source code (Solidity)
contract MyToken {
address public owner;
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
mapping (address => bool) public frozenAccount;
mapping (address => mapping (address => uint256)) public allowance;
mapping (address => mapping (address => uint256)) public spentAllowance;
event Transfer(address indexed from, address indexed to, uint256 value);
event FrozenFunds(address target, bool frozen);
function MyToken(uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol, address centralMinter) {
owner = msg.sender;
if(centralMinter != 0 ) owner = centralMinter;
balanceOf[msg.sender] = initialSupply;
totalSupply = initialSupply;
name = tokenName;
symbol = tokenSymbol;
decimals = decimalUnits;
}
function transfer(address _to, uint256 _value) {
if (balanceOf[msg.sender] < _value) throw;
if (balanceOf[_to] + _value < balanceOf[_to]) throw;
if (frozenAccount[msg.sender]) throw;
balanceOf[msg.sender] -= _value;
balanceOf[_to] += _value;
Transfer(msg.sender, _to, _value);
}
function approve(address _spender, uint256 _value) returns (bool success) {
allowance[msg.sender][_spender] = _value;
}
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
if (balanceOf[_from] < _value) throw;
if (balanceOf[_to] + _value < balanceOf[_to]) throw;
if (frozenAccount[_from]) throw;
if (spentAllowance[_from][msg.sender] + _value > allowance[_from][msg.sender]) throw;
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
spentAllowance[_from][msg.sender] += _value;
Transfer(msg.sender, _to, _value);
}
function mintToken(address target, uint256 mintedAmount) {
if (msg.sender != owner) throw;
balanceOf[target] += mintedAmount;
totalSupply += mintedAmount;
Transfer(owner, target, mintedAmount);
}
function freezeAccount(address target, bool freeze) {
if (msg.sender != owner) throw;
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
}
function transferOwnership(address newOwner) {
if (msg.sender != owner) throw;
owner = newOwner;
}
}