How does a transaction get into the blockchain?
Before a transaction is added to the blockchain it must be authenticated and authorised.
There are several key steps a transaction must go through before it is added to the blockchain. Today, we’re going to focus on authentication using cryptographic keys, authorisation via proof of work, the role of mining, and the more recent adoption of proof of stake protocols in later blockchain networks.
The original blockchain was designed to operate without a central authority (i.e. with no bank or regulator controlling who transacts), but transactions still have to be authenticated.
This is done using cryptographic keys, a string of data (like a password) that identifies a user and gives access to their “account” or “wallet” of value on the system.
Each user has their own private key and a public key that everyone can see. Using them both creates a secure digital identity to authenticate the user via digital signatures and to ‘unlock’ the transaction they want to perform.
Once the transaction is agreed between the users, it needs to be approved, or authorised, before it is added to a block in the chain.
For a public blockchain, the decision to add a transaction to the chain is made by consensus. This means that the majority of “nodes” (or computers in the network) must agree that the transaction is valid. The people who own the computers in the network are incentivised to verify transactions through rewards. This process is known as ‘proof of work’.
Proof of Work
Proof of Work requires the people who own the computers in the network to solve a complex mathematical problem to be able to add a block to the chain. Solving the problem is known as mining, and ‘miners’ are usually rewarded for their work in cryptocurrency.
But mining isn’t easy. The mathematical problem can only be solved by trial and error and the odds of solving the problem are about 1 in 5.9 trillion. It requires substantial computing power which uses considerable amounts of energy. This means the rewards for undertaking the mining must outweigh the cost of the computers and the electricity cost of running them, as one computer alone would take years to find a solution to the mathematical problem.
The Power of Mining
The Cambridge Bitcoin Electricity Consumption Index estimates the bitcoin mining network consumes almost 70 terawatt-hours (TWh) of electricity per year, ranking it the 40th largest consumer of electricity by ‘country’. By way of comparison, Ireland (ranked 68th) uses just over a third of Bitcoin’s consumption, or 25 TWh, and Austria at number 42 consumes 64.6 TWh of electricity per year, according to 2016 data compiled by the CIA.
The Problem with Proof of Work
To create economies of scale, miners often pool their resources together through companies that aggregate a large group of miners. These miners then share the rewards and fees offered by the blockchain network.
As a blockchain grows, more computers join to try and solve the problem, the problem gets harder and the network gets larger, theoretically distributing the chain further and making it ever more difficult to sabotage or hack. In practice though, mining power has become concentrated in the hands of a few mining pools. These large organisations have the vast computing and electrical power now needed to maintain and grow a blockchain network based around Proof of Work validation.
Proof of Stake
Later blockchain networks have adopted “Proof of Stake” validation consensus protocols, where participants must have a stake in the blockchain - usually by owning some of the cryptocurrency - to be in with a chance of selecting, verifying & validating transactions. This saves substantial computing power resources because no mining is required.
In addition, blockchain technologies have evolved to include “Smart Contracts” which automatically execute transactions when certain conditions have been met.