ERC-918 PoW mining-based token standard (Mineable Token Standard)

Stagnant · Tokens · created 2018-03-07

A standard in which solving a Proof of Work puzzle rewards the solver with tokens locked in the contract via the mint() function. It replaces an issuer-centric ICO structure by handing token distribution to miners.

Why it is needed

In ICOs (Initial Coin Offerings) and their derivative models, distributing tokens leaves a single human, the issuer, in control of both the initial coins and the funds raised, exposing the process to fraud and centralization risk. Investors have no choice but to rely on the issuer's good faith, and every new token project needs a single trusted party. By contrast, if tokens are distributed via proof of work, ownership of the token contract does not remain with the issuer, and the issuer becomes just another user, the same as any other miner. However, if each project uses a different mining scheme, it becomes hard to standardize CPU/GPU mining software, mining pools, and external tools.

What to implement

In depth

The Four-Step Structure of mint()

Each time mint(nonce) is called, it executes four steps in order. First, hash(nonce) verifies whether the submitted nonce satisfies the digest condition (at or below the difficulty target) that combines challengeNumber, msg.sender, and nonce. Next, _reward() calculates the reward amount and adds it to tokensMinted, and _newEpoch advances epochCount by one block. Only when epochCount is a multiple of blocksPerReadjustment does _adjustDifficulty() adjust the difficulty. Finally, it emits a Mint event containing the reward address, reward amount, epochCount, and new challengeNumber, and returns true. These four internal functions are designed to be overridden by each implementation.

Key State Fields

adjustmentInterval is the time (in seconds) between difficulty adjustments. challengeNumber is the current challenge value, which must be newly generated each time a reward is minted and contains a recent Ethereum block hash to prevent pre-mining future blocks. difficulty is the current mining difficulty, adjusted in the _adjustDifficulty step. tokensMinted is the cumulative sum of tokens minted so far, and epochCount counts the number of blocks mined so far.

Why challengeNumber and msg.sender Are Included in the Hash

Including challengeNumber and msg.sender together in the hash input when searching for a nonce solution is a key design choice. challengeNumber acts like a random value that is not revealed before the mining round begins, preventing future blocks from being pre-mined. Including msg.sender makes the found nonce valid only for that account, preventing man-in-the-middle (MITM) attacks where someone else intercepts and reuses it, and also lets a mining pool force its pool address into the hash to prevent cheating by miners.

Merged Mining Extension

The optional ERC918Merged extension allows a single nonce to be submitted at once across multiple token contracts via the merge(nonce, _mineTokens) function. Internally, it sequentially calls mint(nonce) for each token address in an array. However, this feature only works correctly if each token contract uses tx.origin instead of msg.sender when paying out rewards; otherwise the reward is sent to the intermediate calling contract rather than the end user. An overload that accepts challenge_digest is also provided for backward compatibility.

Delegated Minting Extension

An extension that helps a third party, such as a mining pool, submit transactions on behalf of a miner. The miner creates a mining mint packet off-chain containing the nonce, origin address, and a signature over the hash of delegatedMintHashing(uint256,address), and passes it to the pool. The pool calls delegatedMint(nonce, origin, signature), uses ECDSA to recover the signing address and checks that it matches origin, then pays the gas fee and submits the transaction. The pool must then manually return the reward tokens, minus its fee, to the original miner.

Metadata and Backward Compatibility Extension

The optional ERC918Metadata extension provides a single metadataURI() function that references off-chain JSON containing the symbol, name, description, website, image, and type (hash algorithm) fields. Earlier versions also had a form such as mint(nonce, challenge_digest), which took a digest combining challengeNumber, msg.sender, and nonce, but this was removed from the standard to save gas. For compatibility with existing mining software and pools, an ERC918BackwardsCompatible contract can verify this digest and then internally call mint(nonce), preserving the legacy interface.

A Proposal Still Stalled

This proposal is currently in Stagnant status, unchanged since it was written in 2018 with no further discussion. Since it has not been finalized as a standard, implementation details may change in the future or may never be adopted.

Original ERC · ← ERCs