How 21 Mining Works

Posted by Balaji S. Srinivasan

How 21 Mining Works

This article applies to the 21 Bitcoin Computer only. If you use another platform, please see the Introduction to 21.


Mining bitcoin used to be easier than buying it; indeed, before the first bitcoin exchanges arose, it wasn't even possible to buy bitcoin at all.

The 21 Bitcoin Computer is a step along the path towards redecentralizing mining. To do this, we've introduced a concept we call "buffered pool mining", which smooths out undesirable variance in the time to mine bitcoin.

At a high level, the goal of buffered pooled mining is to allow each participant in a mining pool to draw bitcoin on demand from their current and future hashrate contribution without waiting for a long or unpredictable amount of time. This quantity of bitcoin is large enough for many programming purposes, such as micropayments.

To explain how it works in detail, let's review how traditional mining works, and then pool mining, and then get into buffered pool mining.

Traditional Mining

Back when it was still possible to mine in a reasonable amount of time with a CPU, you could just take a standard laptop, connect to the bitcoin network, and mine a block with some nonzero probability. However, the block reward multiplied by the fiat-denominated price was initially zero and for a time very low; this is why there wasn't much in the way of competition. Still, any curious developer could just connect to the network, mine some bitcoin, and play around with the technology.

Pool Mining: Reducing Reward Variance

As the price of bitcoin rose, and as mining moved from CPUs through FPGAs and GPUs, a fundamental issue came to the fore: the stochasticity of block rewards. Recall that there are approximately 10 minutes between each mined block, and thus on average about 144 blocks per day (leaving aside certain situations where the hashrate is accelerating extremely rapidly, as it was in 2014).

Due to this aspect of the protocol, any miner with 0.1% of the global hashrate would win only 0.144 blocks per day, or 1.008 blocks per week. A miner with a hashrate considerably less than that might never win a block over the course of a month, or even a year. As such the protocol favored returns to scale - in a word, centralization - in order to smooth out the variance of block rewards.

The embarassingly parallel nature of bitcoin mining assisted in this process; groups of individual bitcoin miners could distribute the problem and pool their hashing power to win blocks much more consistently than either of them could win alone. This is the concept of "pool mining", which smoothed out the reward variance in bitcoin mining.

Rather than have a 0.01% chance of winning 25 BTC and a 99.99% chance of winning 0 BTC in each block, a pooled miner with the same hashrate receives roughly (25)(.0001) BTC or 250,000 satoshis per block (before accounting for transaction fees and any cut the pool operator might take). This reduction in reward variance made it possible for individuals to continue to mine small quantities of bitcoin.

Redecentralizing Bitcoin with Distributed Mining

As FPGAs/GPUs gave way to ASICs and ultimately to ASIC farms, however, even pools became dominated by large warehouse mining operations rather than agglomerations of individual miners. It is fair to say today that it is difficult for an individual to make a "profit" by mining bitcoin at home and trying to sell it at market price.

But that's actually also how it was in the beginning of Bitcoin: people could mine full blocks, but the price was so low that the total value was very small. The question is: can we return to that phase? Can we return to the period where home mining for small dollar quantities of bitcoin is again possible, and indeed the standard way of getting bitcoin for curious individuals?

We know that the computer industry has gone through phases of centralization and decentralization, from mainframes to PCs to cloud services to mobile, and we believe Bitcoin is no different.

Specifically, we think that the next step after pooled datacenter mining is massively distributed and decentralized mining, such that millions of mining chips worldwide each generate a small stream of bitcoin. One of the key reasons we believe this is that bitcoin mining has caught up to Moore's law. Now that mining chips are typically manufactured at the latest process nodes, further improvements in mining chips will not come fast and furious as they did over the March 2013-October 2014 time period. Instead they will be gated by the 18-24 month wait of Moore's law - just like CPUs.

This indicates that we may be able to distribute mining chips with CPUs, as a new kind of co-processor - much like GPUs or networking cards added new functionality to complement CPUs.

Buffered Pool Mining: Reducing Time Variance

As a first step towards establishing the utility of an embedded mining chip, we wanted to make bitcoin available on demand as a system resource to processes that needed to buy or sell digital goods over the network. On demand availability is important because time has value; otherwise we wouldn't have Big O analysis, realtime operating systems, or on-demand Chipotle delivery services.

So just like pool mining reduced reward variance, we've developed something we call "buffered pool mining" to reduce time variance. Recall that even as a pooled miner, there are several limitations of the mining process:

  • You must suffer a random wait time between your last block and your next block
  • If you are a small contributor to the pool, you have to wait to receive a payout until your block reward portion exceeds a certain threshold
  • You need to wait till the block maturation time of 100 blocks before the pool operator can pay your portion of the block reward
  • If you run out of bitcoin, you need to again suffer a random wait time till your pool mines the next block

With the 21 mine command, we have set up a way to buffer against all of that.

  • You do not need to wait for a block to be mined. Instead, as soon as your 21 Chip connects to the 21 Pool we begin streaming you a pro-rata share of your mined bitcoin.

  • You do not need to wait for payouts or pay transaction fees on each of the small awards of bitcoin you mine. Instead, we buffer the bitcoin for you at You can use this to buy digital goods from other 21 developers, and you can also do 21 flush to move the bitcoin to the blockchain at any time where you control the private keys.

  • You do not need to wait for 100 blocks before accessing your mined bitcoin.

  • Finally, you do not need to send N hashes to the server before getting N hashes worth of mined bitcoin. That is, by invoking 21 mine your 21 Bitcoin Computer can receive bitcoin in advance of future mining at the expense of a small asymptotic slowdown in the rate of bitcoin streamed to your device.

Essentially, we have modified the process of mining to reduce the time variance. This is a critical first step towards making bitcoin an on-demand system resource that can be rapidly acquired for programming purposes.

The basic idea is that buffered pool mining is a new way of getting bitcoin: not by buying huge quantities slowly for investment purposes on an exchange, but by mining tiny quantities rapidly for programming purposes at the command line, rate-limited by a mining chip.

Today that mining chip is present in a 21 Bitcoin Computer and you can call on it with the "21 mine" command line tool. In this form factor it is once again possible to just connect to the network, mine some bitcoin, and play around with the technology.