The blockchain! It might sound like a medieval construction machine but it’s really a new type of distributed digital ledger, at the forefront of modern computer science.
“The Blockchain” image credit: Spells of Genesis
You’ve probably heard the media describe the blockchain as “the technology powering Bitcoin.” You may also have heard that big banks are interested in using the blockchain – but not Bitcoin itself. So, if blockchains aren’t Bitcoin, what exactly are they?
Let’s start at the beginning, with the invention of the blockchain. “Satoshi Nakomoto” is the pseudonym of this technology’s mysterious creator, whose true identity remains unknown to this day. Satoshi released blockchain tech to the public in 2009, as the free Bitcoin software and a technical “white paper” describing the system.
Satoshi’s revolutionary system allows an open computer network to create and share valuable data, without any central authority to keep the data synchronised and accurate. This is why the blockchain is sometimes called a distributed or “decentralised ledger.” It works in a strictly peer to peer way, similar to modern file-sharing systems like BitTorrent.
So, if Bitcoin trades through a public ledger book, the blockchain is the mechanism which keeps everyone on the same page and prevents accounting errors, accidental or deliberate.
This decentralised network architecture is one of several technologies which Satoshi fused together to create blockchain technology. Public-key cryptography is the second element. This technique is used to encrypt or decrypt information, without the necessity of participants first sharing and then maintaining the secrecy of a code.
The third and final element is proof-of-work hashing, which serves as evidence that computational work has been performed. Satoshi didn’t invent any of these technologies but, by combining them, he created the unique synthesis called the blockchain. Luckily, in-depth knowledge of these contributing technologies isn’t necessary to understanding our overview of the blockchain. Just keep in mind that they’re important gears in the digital machinery of the blockchain.
The first application of Satoshi’s blockchain technology was of course monetary; his creation of a secure online ledger which tracks ownership of the “digital gold” known as Bitcoin. In the future, it’s likely that blockchains will be how society tracks ownership of all kinds, such as stocks, bonds, property deeds and even legal contracts. This technology has tremendous disruptive potential across a host of industries.
But let’s focus on just Bitcoin for now… How does Bitcoin’s blockchain result in a fraud-proof public record which faithfully records all transactions, without any controlling agency to keep everyone honest? And again, just what is the blockchain?
As the name implies, the blockchain is a linear sequence of linked blocks. OK, so what are blocks? To answer this question, we need to briefly explain how the Bitcoin network functions. You may have heard of Bitcoin miners. If not, our previous video, “What is Bitcoin Mining?” explains how mining works within Bitcoin.
Basically, miners record all Bitcoin transactions into data bundles known as “blocks.” These blocks are linked together in linear sequence by means of a special code. Each transaction in a block goes into forming this code; the final output is recorded in that block. The next block forms a new code and includes the previous block’s code, and this process repeats. Code-chaining all blocks together ensures the permanency of prior transactions – you can’t change information in prior blocks without also changing all subsequent blocks. Together, these linked blocks form an ever-growing public record of all Bitcoin transactions, known of course as… the blockchain.
Now that the term makes a little more sense, let’s explain the blockchain in greater depth by using an example. Let’s say you send some bitcoins to your friend. Your transaction will be relayed across the entire Bitcoin network – everyone will see that address A, your address, is trying to send however many coins to address B, your friend’s address.
People running so-called “full nodes” – in other words, Bitcoin software clients that store the complete blockchain – will quickly receive information about your transaction. Full nodes then verify your transaction’s information against their stored copy of the blockchain. So, full nodes will check whether address A holds enough Bitcoin to pay the specified amount to address B. They’ll also check other new transactions to verify A isn’t trying to send the same coins simultaneously to B and address C or addresses C, D, E and so on.
Although there’s no upper multiplier to how many times coins might be counterfeited in such a manner, that particular form of fraud is known as a “double-spend.” It’s important to note that double-spends were a major technical problem preventing reliable peer-to-peer electronic money – at least until Satoshi’s blockchain solution!
Double-spends aside, let’s return to our example. If your transaction is approved by full nodes, it’ll soon be transmitted to a special type of full node (and sometimes, your transaction will reach the special full node first). These special full nodes have the opportunity to record blocks of transactions into the blockchain. And if you guessed that these special nodes are called “miners,” you’d be right!
Currently, the reward for the first miner to solve an equation specific to current transactional information and so form a new block is 25 bitcoins. That might sound like a lot of money just for recording blocks! But mining is how the blockchain is maintained and secured, so miners deserve a good reward.
Bitcoin’s blockchain, in which miners compete to write the next block for a reward, is known as “Proof of Work” hashing. The work in question refers to hashing, or solving a mathematical equation which reduces information of any length to a fixed length.
Elegantly, Bitcoin adjusts this equation’s difficulty, periodically and automatically, to meet the amount of computing power dedicated to its solution. Such difficulty adjustments ensure a new block is written every ten minutes, on average. In Bitcoin’s early days, difficulty was low and blocks could be reliably solved using a single laptop. As the value of Bitcoin rose, so did difficulty as mining became increasingly competitive. Today, mining is performed on specialised hardware, housed and cooled in vast data-centres, such as this one:
Setting up a competitive Bitcoin mining operation costs millions of Dollars, to say nothing of the monthly electricity bill! Such expense is in fact desirable; the security of Proof of Work blockchains is enhanced through capital investment by a diverse assortment of miners.
To explain why Bitcoin’s is somewhat dependent on economic factors, let’s unpack how these incentives work. Imagine an attacker; let’s call him “Mike,” who wants to seize control of the Bitcoin network to commit fraud or sabotage. As the network is open and permissionless, anyone can join it and begin mining, even Mike. But to reliably be able to exclude valid transactions or include fraudulent ones in his “bad blocks,” Mike needs to control the majority of the computing power directed at Bitcoin, and control it over an extended period. This is known as a “51% attack.”
If successful, Mike can double-spend coins under their control or refuse to process other people’s transaction. However, Mike’s unable to spend coins not under his control, meaning he can’t steal your coins (this neat security feature, which prevents other nodes spending your coins, is enabled through public key cryptography).
Nevertheless, Mike’s attack would likely prove highly detrimental to the value of everyone’s coins. The value of your coins would be stolen if everyone abandoned Bitcoin due to Mike’s actions. So how do Proof of Work blockchains incentivize against such a destructive outcome?
There are four inter-relating protections against a 51% attack:
First, it would require Mike to purchase sufficient mining hardware to exceed the capacity of all other miners – at an ever-rising cost, currently estimated in the low hundreds of millions of Dollars.
Second, as all transactional information on the blockchain is public, Mike’s actions would soon be noticed. Bitcoin’s price would crash as a result, rendering the attacker’s hardware investment unprofitable in short order.
Third, the mathematical equation which mining hardware is specifically designed to solve can be altered in response, permanently locking out the attacker. This renders Mike’s hardware investment practically worthless, although the same applies to honest miners as well.
Fourth, if honest miners regain control of the network, the blockchain could be reverted to a prior state before the 51% attack occurred. The attacker’s transactions would therefore be reversed, although so would all honest transactions which occurred within the attacker’s mined blocks. Less destructively, blocks could be altered to exclude only the attacker’s transactions.
The security of Proof of Work blockchains derives from this complex interplay between software, hardware and economic incentives. A Proof of Work blockchain without much miner investment, as found in several altcoins, is at far greater risk of a 51% attack. This higher level of security is one reason why Bitcoin is so much more valuable than alternative coins.
Speaking of altcoins, you may have heard that some of them, such as Peercoin, use “Proof of Stake” blockchains. Instead of expending computing resources to solve and write blocks, Proof of Stake systems give coin-holders the chance to write the next block. Their odds of doing so are proportional to the size of their holdings, in other words their financial stake in the coin. The more coins stakeholders control, the higher their odds of receiving a coin reward for finding the next block. In Proof of Stake systems, the term “minting” is used instead of mining.
There are definite pros and cons to both types of blockchain, with further modifications and hybrids under constant development. It’s even possible for coins to switch from one system to another, as with Ethereum and Bitshares. Although Proof of Stake systems require far less energy and hardware expenditure, this comes at the cost of greater centralisation. For example, to limit the susceptibility of Peercoin’s blockchain to disruption, a single developer regularly issues so-called “checkpoints.” Blocks may only be altered after these checkpoints.
In Proof of Work systems, historical alterations require command of more mining power than the cumulative total expended dating back to the block in question. 51% is the minimum share required, with that percentage rising to 100% as one goes further back in time. Check-pointing compensates somewhat for the technical ability of major coinholders to alter the blockchain, without acquiring a prohibitively-expensive share of mining power. Check-pointing thus protects the deep history of Proof of Stake chains, with the drawback that a single person or group must be trusted with this ability to checkpoint.
51% attacks aside, are there any other known threats to blockchains? Unfortunately yes, and it’s a threat which arises occasionally as a natural result of how mining works. However, it’s a threat which may also be deliberately introduced through code changes, possibly resulting in a permanent division of the Bitcoin network. You see, under certain conditions, it’s possible for a blockchain to diverge into separate branches. Such a divergence is known as a “fork.”
Let’s go back to Mike’s 51% attack for illustrative purposes. As soon as Mike mines an invalid block – for example, one which sends identical coins to multiple accounts – the blockchain might fork from that point onwards. Those miners who follow the standard rules will reject the block as illegal. They’ll continue to work on their version of the chain, from which the fraudulent block is excluded.
Mike will naturally include his own fraudulent block and base his future blocks on it. As Mike controls the majority of mining power in this example, Mike’s blockchain will grow more rapidly than the honest one. Mike and honest miners will only be accruing block rewards on their respective chains and, to the possible ruin of users, transactions recorded on one chain won’t be recognised by the other.
This soon results in a disastrous situation, in which users suspend their transactions until the fork is resolved. Under such conditions, the market value of the coin would likely crash as a result of the uncertainty and chaos.
The general rule in Proof of Work systems is that the longest majority-accepted chain is the official one. This is a necessary guideline as small forks are an inevitable event. I’ll explain how that works: imagine that two miners find a new block at roughly the same time.
Each miner has an economic incentive to broadcast their new block to the network, as this block also contains their monetary reward. Let’s assume each miner’s block is only by half of the network. A race now occurs between their two forks. Whichever fork receives its next block soonest will pull ahead of the other, until there’s a clear winner in terms of successful Proof of Work. In the interests of cementing their future block rewards into the consensus blockchain, miners still on the losing chain will quickly migrate.
Transactions exclusive to the losing blockchain, as well as any block rewards to its miners, will not be reflected in the winning blockchain so there’s a strong incentive to quickly determine and migrate to the winning chain.
It’s expected that any such fork will be resolved within 6 blocks, which should take about an hour given that new blocks are discovered on average every ten minutes. For this reason, it’s recommended that when receiving high value payments, users wait for the transaction to be “confirmed” 6 times – in other words, for 5 more blocks to be layered over the block containing their payment.
This rule of thumb ensures a good balance of transactional safety and convenience. For low value sums, this rule may be relaxed to cover fewer confirmations. Unconfirmed transactions, which have yet to be written into the blockchain, should be considered a risky proposition, as they may be reversed by unscrupulous participants.
Although forks are considered an existential threat, it may be in future become necessary to implement changes to Bitcoin’s code through means of a fork. Altering the code in a way which is not backwards-compatible inevitably forks the network between clients who upgrade and clients who don’t.
One such code change, currently a matter of contention within the Bitcoin community, is an increase to the blocksize limit. You may have seen this matter discussed lately. The gist is that having larger blocks would allow the Bitcoin blockchain to handle more transactions per second but there exists disagreement on the best method to achieve this. Directly altering the cap induces a hardfork – or a network split between old and new clients – whereas another solution proposes the limit be raised through means of a softfork – which does not split the network.
It’ll certainly be interesting to see how Bitcoin’s blockchain develops in future; as it adapts to the world’s increasing need for a reliable monetary system without a central issuer or other trusted third parties. I hope you now have a better understanding of what blockchains are and how they work, as well as their benefits and potential problems.
As you probably noticed “The blockchain” is a very wide subject that includes a lot sub-topics within it. If you still have any more questions just leave them in the comment section below and I’ll do my best to answer.