What makes it unique is that there is no central authority in charge of the blockchain file or the data it contains. Instead, each computer keeps its own copy of the file, and any update requires the approval of a majority of machines in the network.
The blockchain is made up of ‘blocks’, which each contain a section of data. The most recent data is always added at the top of the chain, while the oldest lives at the bottom in what is known as the ‘genesis block’.
The blocks are linked together by cryptography (complex mathematics), which is how the chain is formed. The mathematics involved means that any change to existing data breaks the chain, so any attempted changes can be detected and rejected by the network.
How does blockchain technology work?
The key to understanding blockchain technology is to understand the structure of the blockchain, how new blocks are added, and how conflicts are resolved.
The structure of blockchain
Each block in the chain contains some data and a ‘hash’ – a digital fingerprint that is generated from the data contained within the block using cryptography.
Every block also includes the hash from the previous block. This becomes part of the data set used to create the newer block’s hash, which is how the chain is linked together.
Even the smallest of changes to a block’s data will invalidate its hash, and the hashes of any blocks that follow, which alerts the network to any attempted changes. This helps to keep the blockchain secure.
How new blocks are added
Because blockchain files are distributed across a network of computers (nodes), updating the file is not simple – new blocks must be approved by a majority of machines in the network.
Computers compete with each other to create new blocks in a process known as ‘mining’. This involves collating new data into a block, along with the hash of the previous block, and attempting to generate a new hash. This competition can be run in two ways:
- Proof of work: under this system, all the computers in the network compete to create the hash. The difficulty of generating hashes is adjusted as the network expands, so that new blocks are created and approved at a constant rate as the computing power in the network changes. The difficulty of generating bitcoin hashes, for example, is adjusted by changing the number of zeroes they must start with, ensuring that a new hash is found only once every ten minutes or so by the entire network.
- Proof of stake: under this system, nodes are selected via a lottery that takes their ‘stake’ in the system into account. This is usually how much of a cryptocurrency they own, with this stake held in the system to demonstrate that the node has a vested interest in the reliability of the blockchain. This system was created to deal with some inherent problems with the proof of work method, particularly high energy usage.
Once a computer has generated a hash, it adds the block to its version of the blockchain file and broadcasts the update across the network. The maths involved means that hashes are difficult to generate, but easy for other computers to verify. Consensus is achieved when a majority of computers have verified the new block and updated their copy of the blockchain file.
The computer that mined the block is then rewarded. For example, with some freshly mined cryptocurrency tokens (eg bitcoins) or transaction fees.
Resolving blockchain conflicts: forks
Very occasionally, two correct hashes are generated by different computers at the same time, creating two blocks. When this happens, competing versions of the blockchain can exist temporarily. This is called a ‘fork’ because there are two potential paths the blockchain could take.
Forks are generally resolved quickly, because one chain will become longer as additional blocks are added. The blockchain then continues along the longest fork. Any data contained within the ‘orphaned block’ (on the rejected fork) will be added back to the pending queue to be reprocessed. For this reason, a block should not usually be considered to be a definitive part of the blockchain until several blocks have been mined on top of it. Bitcoin transactions, for example, are not usually considered final until at least six blocks have been mined.
Updating the blockchain: hard forks vs soft forks
Just as updating the blockchain file is not simple, any proposed update to the underlying protocol (the software’s code) must be carefully managed. There are two ways to update the software:
- Soft fork: this is a backwards compatible software update, meaning that users are not required to run the update to maintain access to the network. A soft fork is considered complete once a majority of users have updated their software.
- Hard fork: this is a more radical change, where users are required to update their software to maintain access to the network. It can happen when a network cannot reach consensus on an update, causing a minority group to break away to implement it on a separate blockchain. Both blockchain files will be identical until the point of the split, but be completely separate thereafter.
What can blockchain technology be used for?
For cryptocurrencies like bitcoin, the blockchain is used to store transaction data. But a blockchain can be used to store any type of digital data (for example, documents, photos or computer code) or to manage permissions. This makes the technology very versatile and means the potential applications are practically limitless.
Blockchain technology could be used to create new secure systems – for example, systems to record votes in an election, act as an unalterable archive, ensure citizens pay their taxes, or keep track of intellectual property rights. Some networks, such as the Ethereum network, also allow users to build decentralised software applications on the blockchain, and add ‘smart contracts’. These contracts are written as lines of code and automatically enforce their clauses.
For these reasons, some analysts have suggested that blockchain technology could be the most disruptive invention since the internet, with nearly six in ten large companies considering implementing some form of blockchain technology, according to a survey by Juniper Research.
Given its potentially disruptive nature, investors have already begun the search for blockchain investments, with the markets often moving quickly in response to blockchain announcements. Learn about trading blockchain technology.