No Bitcoin no cry. Or was that wannacry…There has been a tidal wave of news regarding Bitcoin and crypto-currency recently. Blockchains are the engines behind crypto-currencies. However, what are blockchains and how do they work? With the help of my mate Bob Marley, we will break down the fundamental principles of blockchains. We will use Bitcoin to explain the principles of blockchains since it is the most well know application.
What is a Blockchain?
A blockchain is a an open, distributed ledger that can record transactions between two parties efficiently and in a verifiable and permanent way.
Yikes, so what does this actually mean in plain English? A blockchain is a shared (distributed) record book (ledger) that sits on many computers on the internet. An analogy of a blockchain is an excel spreadsheet with one column, where each cell is a block that contains records and is linked to the previous cell. The data for this excel spreadsheet is shared on many machines, keeping the data truly public and easily verifiable.
A shared set of records on lots of computers does not sound very complex, so what is all the fuss about? You are correct, the concept is not complex, however the cryptography and incentives that lie behind blockchains such as bitcoin are complex and novel. The key problem that blockchains solve is enabling trust between unknown parties. This trust enables the removal of centralized middlemen, such as institutions like banks.
Blockchains are not just limited to the realm of finance, there are applications in digital identities (passports), smart contracts (programmable contracts), digital voting, certification of unique physical items (aircraft parts or baby formula) and many more.
What is the Relationship Between Bitcoin and Blockchain?
Bitcoin is a peer to peer electronic cash system that enables online payments to be transferred directly, without an intermediary.
The person, or people, accredited with creating Bitcoin was Satoshi Nakamoto – see the white paper written in 2008 here. However, digital money is not a new concept, online gamers have used digital money for some time. So why is blockchain so important if digital money is not new? Well, blockchain solved two key problems that digital money had not solved at that point. The first was preventing counterfeiting and the second was double spending – successfully spending money more than once.
The solution was to use a blockchain, a publicly visible, online ledger that keeps a record of all transactions. The network relies on Bitcoin miners who use computers to validate transactions, which are aggregated into chunks called blocks. Bitcoin users protect themselves from double spending fraud by waiting for confirmations when receiving payments on the blockchain. These transactions have a higher probability of becoming irreversible as the number of confirmations rises (most exchanges use 6 confirmations.) The miners earn a reward of newly issued Bitcoin for authenticating blocks, but the network has scarcity in-built with a limit of 21 million coins.
Blockchains in the Bitcoin Network
Source: Based off Bloomberg Quicktake Dec/7/2017
How is Bitcoin Different from Current Banks?
In short, with Bitcoin, you are your own bank. The shared records of all transactions sit on many nodes within the network, meaning you do not need to trust a central financial institution to hold your money. There are currently just over 10k nodes in the Bitcoin network (Current Reachable Bitcoin Nodes). These nodes download all transactions and blocks and check them against Bitcoin’s rules. To access your funds you have a private key, like an ATM pin number. You also have a public key, like a bank account number, which you give to people to receive funds.
What is All This Hash Talk?
In blockchains, a hash algorithm takes data of any arbitrary size and transforms it into a fixed alpha numeric string. The fixed size output is called a hash.
Now say you fed through Bob’s line “Don’t worry about a thing, every little thing is gonna be alright” into a hash algorithm, you might get a hash of 0ebsad23733bf32483b34ffddm000n. Now if you modified this by just one character such as “I Don’t worry about a thing, every little thing is gonna be alright”, you would get an entirely different hash e.g. 8fdsf8fj3332jnds0gdg0gs23kl54p1ss. The reason this is important is a hash can be used to digest a lot of data into a unique alpha numeric combination such that if the Hash(X) = Hash (Y), then in the original full size data X=Y.
Hashing at work
OK, Why Does a Blockchain Care About Hashes?
In Bitcoin, the network validates new blocks by solving a puzzle that relies on hashes. The people that solve this puzzle are called miners. Solving the puzzle requires significant computing power and electricity. In order to reward the miners when a puzzle is solved, miners get newly minted Bitcoins and the charges that users pay to get their transactions onto the blockchain. The current block reward is 12.5 BTC and this reward halves every 4 years.
The puzzle requires that the hash of the block’s header combined with a number, be less than or equal to a target e.g. it must start with at least 5 zeros. The miners arrive at this output by varying a small portion of the block’s headers with a number called a nonce. The other important property of a hash, is that once the nonce has been found, other nodes can verify the solution themselves quickly. A real example at the time of writing of a solved Bitcoin Hash requires a hash starting with 18 zeros. This target difficulty gets readjusted according to the total network computing power, with an aim of ~10 min for the network to solve the blockchain puzzle.
Example of Miners Validating a Block
Where to From Here?
Blockchain technology has the potential to disrupt many industries with exciting new solutions that cut out traditional middlemen. We are only seeing the beginnings of what blockchains can do, with massive impacts expected over the coming years.
For other resources on understanding blockchains and crypto-currencies, I would recommend: