ERC-918 · Stagnant · ERC · 2018-03-07
ERC-918: Mineable Token Standard
A standard for ERC-20 tokens that are distributed by proof-of-work mining through a mint(nonce) function instead of an ICO, so one set of mining software can mine any compliant token.
What problem does it solve?
In 2017–2018 most tokens were launched through ICOs. A single team held the initial supply and the money raised, which centralized control and invited abuse. Some projects tried a different model: lock the whole supply inside the token contract and release it gradually to anyone who solves a proof-of-work puzzle, much like Bitcoin mining. The authors call this an "Initial Mining Offering".
Each mineable token had its own interface, so miners needed custom software for each one. ERC-918 standardizes the interface, so generic CPU and GPU miners and pools can work with any compliant token. 0xBitcoin, whose team co-authored the proposal, is the best-known token of this kind.
How it works
A mineable token is an ERC-20 token with these extra members:
| Member | Purpose |
|---|---|
mint(nonce) |
Submit a solution. If valid, the sender receives the reward |
getChallengeNumber() |
Current challenge, usually based on a recent block hash |
getMiningTarget() / getMiningDifficulty() |
How hard the puzzle currently is |
getMiningReward() |
Tokens paid per valid solution |
getAdjustmentInterval() |
Seconds between difficulty adjustments |
event Mint(from, rewardAmount, epochCount, newChallengeNumber) |
Emitted on each successful mint |
Inside mint, the optional abstract contract runs four phases: hash (check the solution), reward (pay the miner), new epoch (rotate the challenge) and adjust difficulty (retarget every N solutions so issuance stays steady).
A typical solution is a nonce where:
uint256(keccak256(challengeNumber ‖ minerAddress ‖ nonce)) < miningTarget
Including the miner's address stops others from stealing a solution seen in the mempool. Using a recent block hash in the challenge prevents pre-mining.
Optional extensions cover merged mining (one solution mints several tokens) and delegated minting (a relayer submits on a miner's behalf).
Sample code
Off-chain miner loop (Python):
from eth_utils import keccak
def mine(challenge: bytes, miner: bytes, target: int) -> int:
nonce = 0
while True:
data = challenge + miner + nonce.to_bytes(32, "big")
if int.from_bytes(keccak(data), "big") < target:
return nonce
nonce += 1
On-chain check inside mint:
function _hash(uint256 nonce) internal view returns (bytes32 digest) {
digest = keccak256(abi.encodePacked(challengeNumber, msg.sender, nonce));
require(uint256(digest) < miningTarget, "insufficient work");
}
Things to know
- This ERC is Stagnant and was never finalized.
- Each
mintis an on-chain transaction, so gas costs and front-running affect miner profitability. The spec recommends binding the digest tomsg.sender. - The merged-mining extension relies on
tx.originfor rewards, a pattern generally discouraged today. - Proof-of-work here only controls distribution. The token still lives on Ethereum and inherits its security.