- The problem bitcoin is trying to solve: how to transfer value in a digital-only decentralised system
- Roots of money
- From ledgers to blockchain
- Solving the double-spending problem
- Distributed ledger technology
- Coins: How tokens became money
- Bearer and registry instruments
- Traditional metallic coins used three methods to safeguard their integrity:
- Bitcoin uses the first two methods: scarcity and difficult to replicate signs
- How to establish trust in a purely digital monetary system
- How public-key encryption works
- Genesis of the decentralised ledger – what is a blockchain?
- How bitcoin works
- Bitcoin explainer: What is mining?
- Bitcoin wallets
- The four types of bitcoin wallet
- 3. Custodial (or exchange) wallets
- 4. Paper wallets
- Bitcoin explainer Part 2 – more on hashing and adding blocks
- Who can vote in consensus process?
- How the selection process works
- What do the miners hash exactly?
- What is Difficulty?
- Consistency – what is the confirmation time?
- How miners are incentivised and new bitcoin minted
- Bitcoin has problems
- Beyond bitcoin
The problem bitcoin is trying to solve: how to transfer value in a digital-only decentralised system
In this bitcoin explainer we show how bitcoin conforms with four key properties of a successful money system:
- Issuance of currency needs to be created and controlled by an authority
- Forgery prevention
- Verify ownership and validity of units
- Means to transfer value, must be able to circulate
Roots of money
Tokens were used to track ownership as far back as 7500 BC.
From ledgers to blockchain
The history of writing is bound up with accountancy and currency – early tablets were a ledger to track who owns what.
Double-entry bookkeeping developed in the Middle Ages to solve the problem of competing claims to ownership – the idea underlying this is the simple ledger.
Solving the double-spending problem
Blockchain attempts to solve the problem of how to prevent double spending in a purely digital system. Why a purely digital system? Because that’s where the world is headed.
Distributed ledger technology
So a blockchain is a ledger. But unlike traditional ledgers where there is one version of records recorded on clay tablets, sheep skin or paper, the key difference with a blockchain is that it is a distributed ledger.
There are many copies of the same ledger stored on multiple computing devices. That’s why blockchains are often referred to as distributed ledger technology.
Bitcoin is a currency system based on blockchain technology.
Coins: How tokens became money
Ledgers and tokens evolved into coinage – a portable representation of value. In fact the value of the gold, silver or copper would be equal to the face value recorded on the coin, so unlike a token it was more than a representation but instead a universal equivalent.
Metal coins are sometimes referred to as commodity money as distinct from paper money that originated as paper notes from a bank that bestowed upon the owner the right to the coupon value (face value) of the note.
Bearer and registry instruments
Coins are a bearer instrument, which means they are a financial instrument that do not carry a record of ownership. Physical possession of the bearer instrument bestows ownership rights.
By contrast a share certificate is a registered instrument because it has a record of ownership. That ownership is recorded by a central authority.
Cryptocurrencies combine elements of both types of instrument.
Bitcoin, for example, has a registry that is maintained on the blockchain but the owners of the coins are anonymous, although associated with a public key.
Traditional metallic coins used three methods to safeguard their integrity:
- Create from a scare resource
- Sign the coins with a symbol that is difficult to replicate
- Threat of violence – sentenced to death by a state authority for forging until of the currency
Bitcoin uses the first two methods: scarcity and difficult to replicate signs
- Scare resource is computational power
- Signature that is difficult to replicate – a digital signature
How to establish trust in a purely digital monetary system
At the centre of a workable monetary system is trust – faith that the currency is a secure and reliable store of value, measure of value and unit of exchange.
Blockchain and bitcoin seeks to solve this problem:
- A public database (like a spreadsheet) that everyone can read all the time
- Each users has their own account
But who runs the database, who confirms transactions are valid, how can it be made tamper proof?
Digital signatures to the rescue
How public-key encryption works
A KeyGen (key generator) algorithm randomly generates a unique pair of related keys – a private key (kept secret) and a public key for each account/user on the system. The keys are a string of bits (alphanumeric characters).
A second Sign algorithm takes a message as an input and the private key and outputs another bit string. This is the digital signature.
A third Verify algorithm takes a message as an input, along with the digital signature and the public key. Using this information – and the magic of prime numbers – the Verify algorithm is able to verify that the signature is created with the private key corresponding with the associated public key.
But this system is still not tamper proof because there is still a central authority (the maintainer of the database) who could censor transactions. Although the central authority cannot alter (forge) the amounts involved in a transaction, they are anonymous and cannot be sent to an unintended recipient – they can still be erased them from the system.
Genesis of the decentralised ledger – what is a blockchain?
To stop that the central authority could put in place a system that publishes publicly intermittent batches of transactions. These batches, or blocks, of transactions could be chained together in a sequence. This would make it difficult to erase or change the history of transactions.
This is almost a workable digital monetary system but there is one more problem – the central authority may not be able to erase of reorder transactions but it could choose to not record them in the ledger in the first place.
Blockchain to the rescue
The chain of blocks – blockchain – can solve the problem as it can dispense with a central authority and instead become a decentralised system in which the ledger is recorded on multiple copies that are kept in sync.
Using a mathematical puzzle we will look at in a moment, the blocks are chained together using cryptography. By being distributed, blockchain solves the problem of a central authority tampering with the transaction record.
Blockchains must have four properties for effective functioning:
- Transaction record is indelible, sometimes referred to as immutability (cannot be changed)
- Globally readable
- Anyone can write to the blockchain that follows its pre-determined rules (protocol)
- The sequencing of transaction blocks is not open to doubt. In other words it is strictly ordered.
How bitcoin works
We described bitcoin as anonymous. That isn’t entirely accurate. Rather, bitcoin is a pseudonymous system. To transact with bitcoin you must “write with a pseudonym” – those public-private key pairs we described earlier.
The bitcoin KeyGen algorithm can be invoked an unlimited number of times by anyone to generate a public-private key pair.
What is a public-private key pair?
A private key is a random-looking 32-byte alphanumeric string.
A public key is a 65-byte alphanumeric string derived from the private key.
The public key is used to create addresses and these are the identifiers on the bitcoin network.
A public key can generate any number of addresses. In fact a new address can be generated (and often is) for each transaction.
Bitcoin public keys are typically made up of 34 alphanumeric characters, but can sometimes be slightly longer in length.
The smallest unit of the bitcoin digital currency is a Satoshi, named after the anonymous inventor(s) of bitcoin Satoshi Nakamoto.
1 Satoshi = 0.00000001 BTC
What are UTXOs?
Assets are recorded on the blockchain as unspent transaction outputs, known as UTXOs.
Think of a UTXO as a purse and its contents – it can only be spent once.
When a transaction is initiated, a collection of UTXOs are bundled together for the amount of the transaction.
Only the address holder can spend the UTXO.
A digital signature created with a private key has to be used to spend the UTXO.
A bitcoin transaction takes UTXOs as its input. The spent UTXOs are used by the transaction to create new UTXOs. The spent (inputs) UTXO become an output for the new UTXO.
Where the input amount is larger than the output amount (i.e. there is some left over) and that change is not explicitly sent back to the sender, it goes to the miner – a computer node on the network that verifies transactions – as fees.
Bitcoin explainer: What is mining?
The mining mechanism is responsible for arriving at a consensus across the decentralised network of computers regarding the strict ordering of transactions on the blockchain.
Mining is a competitive activity where each miner seeks to be the first to solve a mathematical puzzle based on the current block of transactions.
Proof of work
Whoever solves it first broadcasts their work to the network to check. This system of mining is known as proof of work.
Miner reward – the coinbase
Whoever wins the race is able to add the block to the chain and claim a special payment – the coinbase – as the reward.
What is hashing?
Solving the puzzle can only be done through repeated invocation of a cryptographic technique called hashing.
What is SHA-256?
Hashing is a cryptographic technique that turns any given digital input into an encrypted output using a given algorithm. There are many such algorithms but bitcoin uses SHA-256.
Preventing a 51% attack
For a malicious entity to succeed in taking control of the bitcoin network, they would have to control the majority of the computing power (hash power), known as a 51% attack. This would require an investment of hundred of millions of pounds worth of computing power, perhaps billions.
Tracking UTXOs and the associated addresses can become complicated, which is where wallets come in. These are user applications that hide much of transaction complexity.
A wallet handles the key-pair generation, deriving addresses from the public key, securing the private key, tracking all those UTXOs in addition to managing the signing of transaction messages with the digital signature.
Wallets make sending and receiving easy, usually by scanning a QR code to avoid making a mistake with the address.
The four types of bitcoin wallet
1. A hardware wallet
This is the most secure storage solution.
A hardware wallet is an encrypted USB memory stick that has a a small screen for interaction with the user and is only connected to the internet when the owner wishes to conduct a transaction.
Market leaders in hardware wallets include Trezor and Ledger.
2. A non-custodial software wallet
- Desktop computer application
Sometimes referred to as non-custodial because you do not rely on a third-party to manage the custody of the private key. This means you have full control of your bitcoin.
The mobile wallet (blockchain.com has one of the oldest and most popular such wallets) is probably the most convenient of wallets but not necessarily the most secure.
There are also desktop computer applications such as Exodus and web-based ones. This latter method of storage is one of the most insecure ways of storing bitcoin because the wallet is always connected to the internet.
Software wallets will create a mnemonic seed: typically a 12-, 18- or 24-word phrase that allows an owner to recover their private key and regenerate account (addresses derived from the public key) balances and access to the funds.
The private key will be stored in raw form directly in the wallet.
3. Custodial (or exchange) wallets
Many crypto users store their assets on the exchange where they purchased their crypto. This means that the private key is not under the direct control of the owner and the asset is open to being stolen if the exchange is hacked.
One of the most popular exchanges is US-based Coinbase, which at last count had 43 million users.
Exchange wallets are sometimes referred to as custodial wallets because the private key is held by the exchange.
4. Paper wallets
The final form of wallet is simply to write down the alphanumeric string that makes up the private key on pieces of paper and store copies in a number of secure locations. This is effectively what some custody services do.
One of the oldest bitcoin custodians – Xapo – reportedly uses old nuclear bunkers, among other secured locations, to store customer private keys. Xapo’s custody business was bought by Coinbase in August 2019.
For extra security, in case the paper is destroyed, the raw key can be etched into metal to make it waterproof and fireproof, assuming in the case of latter the heat doesn’t reach the level of a furnace and turn the metal into its molten form.
Bitcoin explainer Part 2 – more on hashing and adding blocks
We said that mining was the name given to a process of arriving at universal agreement (consensus) as to the ordering of transactions.
Who can vote in consensus process?
That implies a voting system. But there needs to be a way to stop nodes (computers) being able to game the system by, for example, voting more than once.
This is achieved by forcing each participating node to waste computational power to get a certificate entitling them to vote. This is what we referred to earlier as the proof of work.
How the selection process works
The more you mine the higher the chances are that you will be selected as the node that adds a block and receives the block reward (currently 6.25 BTC per block).
This is done through applying a hash function where a given input generates an output, with the aim of finding an output that ends with a certain number of zeros.
The job of the miner is to find the input that maps to an output that produces a string of random-looking characters that ends in the right number of zeros.
In order to get the right result the miner has to test successive inputs util they get the right output.
Actually it is a little bit more involved than that.
What do the miners hash exactly?
Instead of just any random input to the hash function, the miner uses:
- the end of the last block,
- the beginning of the block we would like to add
- and a random string (nonce*)
If the output ends with the correct number of zeros then the first miner to achieve this is selected to add the block to the chain.
*A nonce in cryptography is a number or string that is used only once
What is Difficulty?
The bitcoin protocol (rules set down by the computer program that the bitcoin network is built on) is designed so that a block is found every 10 minutes.
However, if more computing power joins the network, then more hashing can be done, and so the puzzle becomes easier.
Because of this, a difficulty adjustment was built into the protocol. To increase difficulty more zeros are required for the hash output and to reduce difficulty less zeros are required for the hash output.
Bitcoin difficulty adjusts every 2,016 blocks, which is roughly every two weeks.
Consistency – what is the confirmation time?
Let’s return to the matter of the blockchain being strictly ordered, or to be more precise, being consistent.
To maintain consistency the designer of the protocol added a tweak to take account of the fact that across the network as a whole each node may not have the same view of the most recent transactions for whatever reason – perhaps they have a slower internet connection.
The bitcoin protocol’s designer stipulated that miners ignore the last six blocks added to the chain, therefore effectively treating the chain as everything barring the last six blocks. To increase the probability of consensus more blocks can be lopped off.
Let’s put this another way – to be sure a transaction has been confirmed, wait for say 10 blocks to be mined after the block that includes your transactions. This is the so-called confirmation time and explains why the ‘the number of confirmations’ may vary between exchanges, which may insist on a longer confirmation time than that built into the protocol.
How miners are incentivised and new bitcoin minted
As mention early in this bitcoin explainer, a node that is selected to add a block receives a block reward of 6.25 BTC. At the time of writing (9 March 2021) one bitcoin is valued at $54,000. So for each block the successful miner is paid $337,500 (6.25 x 54,000).
This is how new coins are minted.
Bitcoin is coded to have a total supply of 21 million.
What is halving?
Every 210,000 blocks (which works out at being approximately every four years) the reward is halved. This year (2020) was a halving year – from 12.5 to 6.25 BTC.
When bitcoin’s life began in January 2009 the block reward was set at 50.
The last bitcoin will be minted in 2140 or later.
Bitcoin has problems
The proof-of-work consensus mechanism requires by design the wasting of computational power.
Estimates vary, but one determination the energy consumption of the bitcoin network was as much as the total annual solar power generation of the US or the annual energy consumption of Kuwait (61.85 TerraWatt hours per year).
Bitcoin could originally be mined with an ordinary CPU. After the first year of its life it was realised that mining could be carried out more efficiently with GPUs and today most mining is conducted with specially designed chips that do nothing but mine called ASICs
- CPU = central processing unit
- GPU = graphic processing unit
- ASIC = application-specific integrated circuits
Not so decentralised after all
As the bitcoin network developed, mining was no longer something that could be done at home on a laptop on an individual’s own account. Instead people (and companies) came together to pool their resources and to share out the block reward among participants.
Mining pools now control most of the mining on the network, and key players include Chinese firm Bitmain, which also makes ASIC machines used to mine.
A cheap supply of energy and cooling are now required for mining and it currently is conducted on an industrial scale.
Transaction speeds slow
Because of the proof of work mining mechanism and the confirmation times mentioned earlier, the transaction throughput of the system is slow.
This means there are technical roadblocks – among others – to the bitcoin network realising the ambition of being “a peer-to-peer electronic cash system” as laid out in the white paper.
The bitcoin network completes a transaction every 3 to 7 seconds. Compared that to Visa with transaction speeds of around 2,000 per second.
This is often referred to in the crypto industry as the scaling problem and many competing coins are developed with the aim of solving this critical issue.
In this bitcoin explainer we have shown that blockchains are distributed databases that do not require a centralised trusted third party.
Theoretically this can make the technology well-suited for areas beyond cryptocurrencies, from decentralised social networks to decentralised management of land titles and everything in-between.
So-called second-generation blockchains can run applications. The most prominent of these is Ethereum.
Ethereum can be used to run smart contracts and many other coins are built on top of it.
Smart contracts recreate in a computer program business logic and rules and accept data inputs from the outside world.
These decentralised applications can, for example, automate financial instruments services such as bond issuance and interest payments.
As with bitcoin, Ethereum also uses a proof of work consensus mechanism, which means it also has a scaling problem.
A system upgrade roadmap known as Ethereum 2.0 aims to solve the scaling problem by migrating to a proof-of-stake system that would not depend on mining but instead on nodes qualifying for node status by staking the native token of the network, ETH.
Thank you for reading our bitcoin explainer. You are now an expert!