Bitcoin Demystified: Math vs. Government

Bitcoin Demystified: Math vs. Government

This article is part 2 of a 3 part series that becomes progressively more technical. For necessary background on Bitcoin, see part 1.
The author will be holding a Q&A call-in session this Thursday, December 5th. You can submit a question at the bottom of this article. Selected questions will be published in a podcast.

Bitcoin’s success as a currency is a feat of mathematics and cooperation of the individuals that have lent their machines as nodes to the Bitcoin network. The United States Government maintains the circulation of Dollars, but no central government or agency regulates Bitcoin. Yet there is no Bitcoin inflation, no theft, no fraud, and no lasting discrepancy over the public ledger of transactions made. This article begins to explain how Bitcoin functions so seamlessly.

First of all, there is a network of ‘nodes’. Individuals have incentives (such as mining rewards or collecting transaction fees) to contribute their computing resources and join as nodes on the network. These nodes are really just servers - computers plugged into the Internet - which are running Bitcoin software. A node might be a teenager keeping her computer on running Bitcoin software in her basement while she’s at school, or someone running software in the cloud. Anyone can be a node. Every time a new transaction is made with Bitcoin, all of the nodes in the network record the transaction in their ledgers. The nodes are in constant communication and work to share each transaction with each other so that they can come to a consensus and prevent their transaction ledgers from differing.

This ledger is a database of every Bitcoin transaction that has ever been executed. It is constantly growing with new transactions and is broken into units called blocks. The ledger is referred to as the block chain because it is a linear, chronological ordering of these blocks. Upon joining the network, each node downloads the most recent copy of the block chain in its entirety.

The block chain in its entirety is analogous to banking transactions. Bank transactions are listed chronologically, just as Bitcoin transactions are; the record of bank transactions is broken into bank statements, just as the block chain is broken into blocks. A new bank transaction will only be appended to the current statement, just as a new Bitcoin transaction will only be appended to the current block. The previous blocks in the block chain are artifacts of history that can never be revised. If the blocks could be revised, then a malicious buyer might be able to retract a transaction and the person that they paid could lose the money that they were owed.

Let’s discuss where bitcoins come from.

Adding transactions to the block chain and updating a local copy of the block chain is part of a process called mining. At the same time that miners (nodes in the network) are doing the important work of processing and recording transactions, they are also competing in a race. They are racing to “complete the current block” in order to win bitcoins.

Each time a block is “completed”, the next block is generated in the block chain. The first transaction recorded in that next block is a transaction that awards newly minted bitcoins to the winning miner who completed the previous block.

Then, the cycle continues. The next block becomes the “current block,” the completed block becomes a permanent record of the past, transactions are recorded in the new “current block” and miners adjust their goal to work on completing this new “current block.”

What does this race to “complete a block” entail? Miners are not racing to add transactions to a block. They are actually racing to solve a math problem.

Each new block in the block chain has an associated math problem that is inherently difficult to solve. Solving the problem requires “brute force.” A problem that requires a “brute force” solution is one that no one knows how to reason about. Instead, miners must work to guess a solution with trial and error: They guess a solution, test if it works, and then test another solution, until they find a valid solution. Solving a problem with brute force in this way is resource intensive. Miners have software that runs computation after computation. Software is limited by hardware, and hardware can only run a computation so quickly. Directing hardware to run so many computations, one right after the next, is exhaustive. Mining new coins is analogous to gold miners expending physical energy to add gold to circulation, but it is CPU time and electricity that is expended. When the winning miner finally finds a solution, it shares its solution with the other mining nodes in the network and those nodes verify its validity.

The math problem is hard for a reason - it should take time to solve! Each time a miner solves the problem, a new 25BTC is “minted”, awarded to that miner, and entered into circulation. This quantity is on schedule to halve every 4 years until all 21 million bitcoins are released. The fact that it takes on average 10 minutes to solve the math problem means that 25 new bitcoins are minted on average every 10 minutes. The difficulty of the math problem regulates the rate of creation of new bitcoins.

Here’s a simplified version of the math problem:

find x such that h(x)

h is a known function. The lower y is in value, the harder the problem is to solve because there is a smaller solution space.

The value of the target, y, is agreed upon by the miners in the network and adjusted depending on how quickly new blocks are being generated. As more miners join the network (or contribute more efficient hardware towards mining), more computing power goes towards solving the math problem, and the math problem is solved more quickly. To avoid inflation, the math problem must get harder - to reconcile that miners are mining faster.

The function h is a hash function. Hash functions have a few key properties that make them ideal for the Bitcoin math problem:

1. Given an input value, x, finding the value of the hash, h(x), is straightforward.
2. However, given an output value y, finding the x such that h(x) = y is difficult (h is not invertible; the pre-image space is smaller than the image space).
3. Knowing the value of h(x) does not give insight on hashing similar inputs like h(x+1) or h(2x).

Property 1 means that once a valid solution is found, the network can easily verify its validity. Properties 2 and 3 make solving the math problem a guessing game. Miners are racing to hash h(x1), h(x2), h(x3),..... and so on until they find an x satisfying h(x)

Mining is a serious competition nowadays and it consumes large computing resources. Although it’s possible to mine on a laptop, the math problems have become hard enough that a laptop’s CPU will likely never complete a block on its own. The cost of the electricity needed to run the mining software would exceed the return for mining. Macs and PC are certainly capable of computing hash functions, but are too slow compared to specialized mining hardware that is now available. Hardware designed with the purpose of computing hash functions is on sale for up to $14,500.

Fastest to the best hash wins - so how is this fair? What keeps the individuals who can invest in the best hashing hardware from completing every block and winning all the block rewards? For one, the strategy of pooling gives less sophisticated miners a share of the bounty. More importantly, the distributed nature the Bitcoin network makes the race to complete a block more complex than all nodes racing to solve the same problem.

Popular in the Community

Close

What's Hot