The first Ethereum token to implement an on-chain, increasing-difficulty hash-based minting mechanism.
Token Information
Key Facts
Description
HashToken embeds an increasing-difficulty hash puzzle directly into the token contract itself. Unlike later “mineable” tokens that rely on off-chain work or oracle-style verification, HashToken enforces both difficulty and supply constraints entirely on-chain.
At launch, minting was trivial and could be done interactively through the Mist wallet by submitting random values. As difficulty increased, participants began using scripts and eventually GPUs to search for valid hashes, turning the contract into a genuine on-chain mining target.
Quotes from the Deployer (Reddit, 2016)
“I created a new type of Hash currency based on EIP2…
New tokens get created when someone is able to solve a puzzle. The puzzle difficulty increases after every puzzle is solved…
Since difficulty increases after every token is minted, this creates a limited supply (kind of like gold).”
HashToken (symbol: HTK) is an experimental mineable token deployed in Ethereum’s early years that introduces a proof-of-work–style minting system directly inside a smart contract. New tokens are created only when a caller solves a cryptographic puzzle enforced on-chain.
Minting requires finding a value such that: sha3(value, prev_hash) < max_value
Each successful mint:
- Rewards the caller with
10^16HTK - Updates the stored hash used for the next puzzle
- Increases difficulty by reducing
max_valueby 1 percent
As minting continues, the probability of finding a valid solution decreases, producing a diminishing issuance curve analogous to physical mining.
The contract is derived from the early ConsenSys StandardToken implementation and follows pre-ERC-20 conventions, with balances, allowances, and transfers implemented manually.
Source Verified
Heuristic Analysis
The following characteristics were detected through bytecode analysis and may not be accurate.
Homestead Era
The first planned hard fork. Removed the canary contract, adjusted gas costs.
Bytecode Overview
Verified Source Available
Source verified on Etherscan.
Show source code (Solidity)
// Most of the code taken from
// https://github.com/ConsenSys/Tokens/blob/master/Token_Contracts/contracts/StandardToken.sol
contract TokenInterface {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) returns (bool success) {}
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) returns (bool success) {}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract HashToken is TokenInterface {
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
uint256 public totalSupply;
bytes32 public prev_hash;
uint public max_value;
// Meta info
string public name;
uint8 public decimals;
string public symbol;
function HashToken() {
prev_hash = sha3(block.blockhash(block.number));
max_value = 2 ** 255;
// Meta info
name = 'HashToken';
decimals = 16;
symbol = 'HTK';
}
function transfer(address _to, uint256 _value) returns (bool success) {
if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
balances[msg.sender] -= _value;
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
Transfer(_from, _to, _value);
return true;
} else { return false; }
}
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function approve(address _spender, uint256 _value) returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
event Mint(address indexed minter);
function mint(bytes32 value) {
if (uint(sha3(value, prev_hash)) > max_value) {
throw;
}
balances[msg.sender] += 10 ** 16;
prev_hash = sha3(block.blockhash(block.number), prev_hash);
// increase the difficulty
max_value -= max_value / 100;
Mint(msg.sender);
}
}