The case for the Mineable ERC20 Token

infernal_toast
3 min readFeb 6, 2018

--

If you look at the recent verified contracts on https://etherscan.io, you will notice that there are more than 100 token contracts deployed every day. The Ethereum ecosystem is booming, and for good reason; it has the most tooling and the largest community.

You will also notice that coinmarketcap.com notes coins and tokens as being ‘mineable’ or ‘not mineable.’ Most of these tokens will withold most of their stash and advertise to have a big ‘ICO’ to distribute tokens to investors, even if they have no working product. This is often necessary — you can’t mine a token!

But it is time for that to change

Back in the good old days of 2012 and 2013 when cryptocurrencies were just fruiting, many new blockchains launched. These never had ICOs. Litecoin, Dogecoin, Peercoin, Anoncoin, Darkcoin (Dash), Feathercoin… not a single one.

You could obtain these coins for free by mining using Proof of Work. In this way, the coins were fairly and evenly distributed. Sure, there was trading and speculation. But there were no coin creators trying to scam the masses out of their money.

The first mineable ERC20 Token

A reference implementation for a mineable ERC20 token has been launched at Ethereum address 0xb6ed7644c69416d67b522e20bc294a9a9b405b31. This combines the scarcity and fair distribution model of Bitcoin with the speed and power of the Ethereum ecosystem. Thus, it is named 0xBitcoin or 0xBTC where 0x represents the Ethereum Network and ecosystem.

You will find some familiar properties. A total of 21,000,000 tokens are available to be mined. A diminishing ‘block reward’ is mined every ~10 minutes thanks to regular difficulty adjustments. Finally, you can use these tokens to interact with all ERC20 based services including Metamask, Parity, 0x, RadarRelay, EtherDelta, and other smart contracts.

New tokens are minted using the following Proof of Work contract function:

(taken from https://github.com/0xbitcoin/0xbitcoin-token)
function mint(uint256 nonce, bytes32 challenge_digest) public returns (bool success) {


uint reward_amount = getMiningReward();


bytes32 digest = keccak256(challengeNumber, msg.sender, nonce );


if (digest != challenge_digest) revert();

//the digest must be smaller than the target
if(uint256(digest) > miningTarget) revert();


uint hashFound = rewardHashesFound[digest];
rewardHashesFound[digest] = epochCount;
if(hashFound != 0) revert();
//prevent the same answer from awarding twice

balances[msg.sender] = balances[msg.sender].add(reward_amount);

tokensMinted = tokensMinted.add(reward_amount);

//set readonly diagnostics data
lastRewardTo = msg.sender;
lastRewardAmount = reward_amount;
lastRewardEthBlockNumber = block.number;

//start a new round of mining with a new 'challengeNumber'
_startNewMiningEpoch();

Mint(msg.sender, reward_amount, epochCount, challengeNumber );

return true;

}

As you can see, a special number called a ‘nonce’ has to be passed into this function in order for tokens to be dispensed. This number has to fit a special ‘puzzle’ similar to a sudoku puzzle, and this is called Proof of Work (PoW). To find this special number, it is necessary to run a mining program. A cpu miner exists for mining PoW tokens and it can be downloaded here:

So far, less than 100 rewards have been mined, but it has only been about twelve hours. Hopefully many more tokens will switch to a mining distribution model so we can stop with all of the ICOs. We will return to a time where all it took to get a new coin was a humming computer and fingers crossed.

UPDATE:

There are now open-source GPU Miners:

Nvidia: https://github.com/azlehria/0xbitcoin-gpuminer/releases

AMD: https://github.com/mining-visualizer/MVis-tokenminer/releases

GPU Mining Tutorial: https://www.youtube.com/watch?v=jNtNw-YsqQU

Join the 0xBTC Discord: https://discord.gg/JGEqqmS

--

--