An old adage says: “Don’t invest in what you don’t understand”. Many people interested in buying bitcoin and other cryptocurrencies have been put off by the apparent complexity of these new forms of money and the jargon involved in describing them. But cryptocurrencies don’t have to be inaccessible.
In a three-part series, we explain where cryptocurrencies came from, what powers their networks and how they are governed.
In this, the second article of the series, we examine how bitcoin works.
If I ask you to spin an unbiased coin, the probability of it landing heads up is 50%, or ½.
If I ask you to spin it five times in a row, the probability of it landing heads up every time is the same fraction, multiplied by itself five times. That’s a one in 32 chance.
Now imagine a game where I invite a hundred players into a room, give them each a coin and ask them to toss it until one person gets ten heads in a row. The main rule of this imaginary game is that each time a player’s attempt fails, he or she has to start a new sequence of coin tosses.
We can estimate the amount of time it will take for the game to end. It will depend on the number of people participating and the speed at which each participant tosses his or her coin.
The computer that wins the hashing ‘game’ is rewarded by a number of new tokens.
This is essentially how the computers in the bitcoin network get to verify the network’s transaction history. It’s done a bit differently, but the underlying idea is the same.
How does the bitcoin version of the game work? The computers in the bitcoin network put together a so-called “block” of data. This consists of a few important bits of information. First, there’s a list of the bitcoin transactions that took place in the latest period. It’s not necessary for the transactions be recorded in full in the block: the transaction data is compressed into a single string of code, called a Merkle root, using a clever cryptographic process.
Apart from the Merkle root, the block also includes three other things: a cryptographic link to the previous block in the chain, a timestamp, and a counting mechanism called a “nonce”.
A bitcoin block
Image courtesy of Pluralsight
Then the computers in the network undertake their own version of the coin spinning game. Rather than spinning an actual coin, they perform a mathematical calculation repeatedly.
In the previous article of this series we explained that a hash function is a mathematical operation that’s easy to do one way around but effectively impossible to reverse.
So what the bitcoin network computers are calculating is a hash of the block header over and over again. They the nonce counter to order their attempts, only finishing when one of them produces the winning combination.
In our coin-tossing game the winner needed ten heads in a row to declare victory. In bitcoin’s case, the requirement is to produce a hash with a certain number of zeros at the front of a 64-digit sequence.
The successful computer shows this hash to the rest of the network—remember that it’s easy to verify a hash, once produced. The block is then added to the unforgeable record of the currency’s transactions, called the blockchain.
Linking bitcoin blocks in a chain
Image courtesy of Pluralsight
Miners, the block reward and proof of work
Why would anyone volunteer to join a computer network and set their computer to perform a large number of apparently arbitrary calculations? After all, this costs money—both in terms of acquiring the necessary hardware and of the electricity needed to power the computer’s processor.
This ‘longest chain’ rule ensures consensus across the network—without the need for meetings, votes or political parties.
They do it because there’s an incentive to do so. The computer that wins the hashing “game” is rewarded by a number of new tokens, called bitcoins.
This prize is called the “block reward”. It was set at 50 coins per block when the currency was launched in 2009. The reward halves in size after every 210,000 blocks and is currently (as at March 2018) 12.5 bitcoins. At a bitcoin/US dollar exchange rate of $8,700 on March 14 2018, that’s worth $108,750. Bitcoin issuance is set in stone by the currency’s protocol. Eventually, there will be 21 million coins in existence.
Bitcoin’s block reward
Since they are involved in work to calculate the answer to the guessing game, and because of the monetary reward for winning it, the computers participating in the chase are called “miners”. In addition to earning the block reward, miners earn fees from handling transactions in bitcoin—effectively, for printing those transactions into the blockchain.
The incentive mechanism designed to keep miners involved in the processing game is called “proof-of-work”, since by producing the right string of code miners are demonstrating that, on average, they have expended a given amount of energy to perform the number of hashes required to win the game.
Bitcoin has a clever feature to ensure blocks are produced at fairly steady intervals. By design, bitcoin blocks are supposed to arrive around every ten minutes.
Let’s return to our coin-tossing game from earlier, which had a hundred participants. If a million people started playing, we would expect the time taken for one person to throw heads ten times in a row to drop dramatically.
Similarly, in bitcoin, the more and the faster the computers participating in the race to produce those leading zeros on a line of code, the quicker you’d expect solutions to emerge. To manage this, the difficulty of the puzzle is adjusted automatically every 2016 blocks, helping keep the block processing times roughly stable.
If more computers join the network and/or start using more powerful processors, the difficulty of the calculation is increased. If miners drop out, the difficulty adjustment falls. So far, the difficulty adjustment in bitcoin has gone in one direction—upwards—reflecting the increasing investment made in bitcoin mining, which has been reflected both in the number of computers in the network and the speed of the processors they are using.
“Consensus”—the longest chain
But what if two miners in different parts of the world find a solution to the hashing puzzle simultaneously, or near-simultaneously? Each will broadcast its solution for other nodes in the network to verify.
The correct version of history is always the longest chain
In theory, this seems to lead to a split version of history, with the possibility for coin owners to spend their currency tokens twice, once on each version of the network.
It turns out that the bitcoin network has a way of handling such a divergence. It follows a rule which says that the correct version of history is always the longest chain.
In the words of the Bitcoin Manifesto, “nodes always consider the longest chain to be the correct one and will keep working on extending it.”
So if two nodes broadcast different versions of the next block, some nodes may receive one or the other first. In that case, they work on the first one they received, but save the other branch in case it becomes longer. The tie will be broken when the next proof-of-work is found and one branch becomes longer; the nodes that were working on the other branch will then switch to the longer one.
This “longest chain” rule ensures consensus across the network—without the need for meetings, votes or political parties.
Settlement on the bitcoin network is therefore a probabilistic process, rather than something that becomes completely final at a point in time (as in conventional settlement systems).
By convention, bitcoin exchanges and those trading peer-to-peer wait for up to six new bitcoin blocks to be processed for a trade to be confirmed and fiat money to change hands (if there’s a fiat leg to the trade).
Why? If you waited just one block, you could be subject to variant versions of history, such as the example just described. These are usually resolved—and the blockchain reordered—after another block or two. But if you wait six blocks it’s considered infeasible for the bitcoin blockchain to be rewritten.
Bitcoin’s consensus mechanism involves benefits and costs, such as the electricity needed to keep the network going. Other cryptocurrencies use versions of bitcoin’s “proof-of-work” incentive scheme, or are working on other ways to keep computers processing their blockchains. This is an area of ongoing
Settlement on the bitcoin network is therefore a probabilistic process, rather than something that becomes completely final at a point in time.
What makes bitcoin money?
We’ve described some of the important rules of the bitcoin network.
But what says that the tokens handed out for solving the bitcoin processing game have any value at all? Effectively, nothing. Bitcoin appears to be conjured up out of thin air and has nothing to back it.
This has led to repeated claims that a bitcoin has an intrinsic value of zero.
“In our view, [bitcoin’s] intrinsic value must be zero: a bitcoin is a claim on nobody—in contrast to, for instance, sovereign bonds, equities or paper money—and it does not generate any income stream,” Stefan Hofrichter, head of global economics and strategy at financial services firm Allianz, wrote in March 2018.
But many people appear ready to impute a theoretical value to bitcoins because they are backed by apparently unbreakable cryptographic functions, which ensure that transactions are recorded accurately and transparently. Think of the hash functions underlying bitcoin as the mathematical equivalent to the holograms and watermarks on banknotes.
This cryptographic security is then allied to a key property of the bitcoin network—its decentralised nature. The collective processing power of the miners in the network helps ensure resistance to censorship.
There is no central book of records for bitcoin, since all the nodes keep an identical version of the bitcoin transaction history. This makes the network very difficult to hack, restrict geographically or close down. That security arguably also offers value to the network’s users.
These considerations don’t tell us whether a single bitcoin’s value should be $1, $100, $10,000 or even $1 million. Other things being equal, the greater the scale of the network, and the greater the computer processing power allocated to it, the higher the likely value of a token.
Other things being equal, the greater the scale of the network, and the greater the computer processing power allocated to it, the higher the likely value of a token.
But nor is there any intrinsic value to the banknotes in our pocket. Nothing says that a £20 note is worth £20 of goods or services except our expectation that a vendor will take it as that. We are also collectively relying on trust in the issuer of the currency not to debase it or confiscate it.
Whatever the value of a single bitcoin token should be, bitcoin as an experimental technology has proved its worth in another way. Its introduction has shown that we can design an incentive mechanism to maintain a network of data across users who do not have to trust each other.