In our last article, which you can read here, we discussed the basics of what a blockchain is. We highly recommend you read that article before starting this, as there are terms explained there which we will be using here.
A blockchain can concisely be defined as “a distributed ledger in which transactions involving a particular group of assets are stored in a secure, verifiable and permanent way”. (1)
Part of what we discussed in that article is that a blockchain can be visually imagined as a chain of blocks each containing a set of transactions that are linked, from the most recent block to the first block recorded in the system, in the order they are created. This article will delve further into the components of a ‘block’, different implementations of blockchains, and how new blocks are validated.
The transaction data in a block is stored as a merkle tree (shown above) (P2)
Contents of a Block
Looking closer at a block we can break down its structure into 4 parts:
The Block Identifier – Blocks use a cryptographic hash function as its unique identifier, like a digital fingerprint. This block identifier is created by ‘hashing the block header twice with the SHA256 algorithm’. To understand more about what a hash function is click here.
The Previous Block Identifier –To maintain legacy and traceability, new blocks in a chain are created using the previous blocks identifier. This means that every block in a chain links all the way back to the 1st block.
Transaction Details – The average block is a 1MB file containing upwards of 500 transactions. All the transactions in are contained in a ‘binary hash tree’ or Merkle Tree structure, shown in the image above this section. The ‘root’ of a Merkle Tree is a hashed summary of all transactions in the block, stored as a text string.
Mining Completion details – As mentioned above the block contains a unique block identifier which is a cryptographic hash. To validate that this hash is in-fact correct, the block also stores additional mining relevant data, which includes; a nonce (random number), a timestamp and the difficulty of the mathematical problem (hash function) which must be solved by a miner as part of processing a transaction and giving this block a valid unique identifier. (2) The process of Mining will not be elaborated on in this article.
Blockchain networks can be public or private as detailed below (P3)
Types of Blockchain Implementations
The blockchain system can be implemented in several ways, the most popular of which is the not permissioned public blockchain; Bitcoin.
Below we list the 4 main ways that blockchain technology is being implemented and how they differ from each other:
Public – In a public blockchain network anyone is able to join, edit, contribute, access or audit any ongoing activities in any block at any time. Helping the blockchain maintain its ability to self-govern it uses protocols based on open sourced Proof of Work (PoW) consensus algorithms, which are not permissioned. We will go into more details about consensus algorithms below.
Private – Businesses and government institutions wishing to use blockchain technology, while keeping the information out of the public domain, can do so by creating a private blockchain. Such systems require a participant be granted access by an arbitrator (such as a system admin), or by presenting a verifiable invitation, or even by satisfying a strict set of automated network protocols. Permission to write to a private blockchain is governed centrally, or dependent on an arbitrary set of rules.
Federated/Consortium – In a Federated Blockchain only a pre-selected set of nodes can participate in the consensus process of validating a block. This type of blockchain therefore can be controlled, for example, by a group of companies where each company operates and controls its own node. The verification of a new block, or set of transactions, would require consensus from a minimum number of those nodes. Federated blockchains offer better transaction privacy, reduce transaction costs, replaces legacy systems, has greater scalability, and as a result are being employed primarily by the global finance, insurance and energy sectors.
Permissioned – A permissioned blockchain allows for better control over who can access what information in a block (rather than having all information available to everyone) and is highly customizable, lying somewhere between a public and private blockchain. A good example is that of a farmer who uses a blockchain to manage his goods as they go through the process of getting from his farm to his customers. If the farmer sells his product overseas, it will involve transport, warehousing and customs when crossing borders. Each of these activities require some, but not all, the information contained in the farmers blockchain, and using a permissioned blockchain he can grant access to relevant information to specific parties while keeping the rest inaccessible and therefore private. (3) (4) The potential of such blockchains are extremely exciting as they help ensure quality and good practices down the supply chain.
Blockchain networks can be public or private as detailed below (P3)
Validation of a New Block
Given their decentralized nature, it is next to impossible to make unauthorized changes to a blockchain. But that does not prevent those with malicious intentions from trying to do so.
A validation system must prevent fake or erroneous requests, as well as reject any attempts to alter previously validated blocks.
This is achieved by using a consensus algorithm, which ‘elects a leader who will decide the contents of the next block’. It is important that in such a system; the process of validating a block is difficult, and the process of verifying the validated block is easy. Which will prevent leaders from cheating the system without the rest of the network knowing about it. (5)
There are 3 methods of validating or reaching a consensus on a block:
Proof of Work (Mining) - In the Proof of Work (PoW) method miners compete to solve a complex cryptographic calculation attached to the block. And the successful miner or group of miners receive a reward. The value of this reward is set by the developers of the blockchain as an incentive for individuals and companies to set up and maintain “mining rigs” with the computational power needed to verify new blocks of transactions. In the validation process of Bitcoin, this reward is 12.5 newly minted Bitcoins plus a small transaction fee.
While the Bitcoin method is regarded as ‘a masterpiece in its own right’ it is not without fault. Three common criticisms are that this method requires great deals of energy, huge amounts of computational power, and that mining is limited to countries with low cost energy.
Proof of Stake (PoS) - In this system a total number of coins is decided on creation of the blockchain. A ‘validator’, or stakeholder, invests in the coins themselves and the more coins held by a validator, the higher their chances are of being selected to validate a block. Validators are rewarded for their work with a transaction fee. PoS validation was first used by Peercoin and its big advantage is that it does not require expensive mining rigs to validate new blocks of transactions. Once a new block is validated, it must be verified by the other members of the blockchain and different types of PoS systems employ different methods to do this.
For example under the Tendermint system each node must verify the block, until a majority consensus is reached. In other systems a randomly selected group of validators are chosen to complete the validation. The issue faced by the Proof of Stake (PoS) system is described as the ‘nothing at stake’ problem i.e. ‘a participant with nothing to lose has no reason not to behave badly’. For example there is nothing to prevent fraudulent validators from creating two sets of transactions and claiming transaction fees for both, or prevent them from signing off on both transactions.
The still-evolving science of cryptocurrencies and blockchain are testing several solutions to this problem; one possible solution is to require validators to lock their coins in a virtual vault, where any misconduct on their part will result in the coins being forfeit.
Proof of Elapsed Time (PoET) - Created by the Intel Corp. this method uses Intel’s Guard Extension (SGX) CPU instruction set, which allows applications to run a trusted code to ensure participants are acting fairly. To choose the node to validate a block the nodes are required to wait a random length of time, and the first node to wait their allotted time wins the responsibility of validating the block. The advantage here also is the fact that no expensive mining rigs are needed to validate new blocks.
Two issues crop up in this method; first, was the waiting period actually chosen randomly, or did the winning node manipulate the period of time it needed to wait to win? Second, did the winning node actually wait for the correct amount of time to elapse?
Intels SGX instruction set is what keeps this in check, validating whether each node waited its randomly set period of time to win the right to verify a new block. Hence the weak point in this consensus method is the trust users must have in Intel’s integrity and software. (6)
Blockchain technologies have the potential to simplify many of our current ledger systems both private and public (P5)
While validation methods are still adjusting themselves to reach an optimal balance between trustworthiness, security and simplicity, but there is still a long way to go. For now, Proof of Work is the best method to validate new blocks in a blockchain, though it is not without fault.
The cost of becoming a miner is still high, but that cost is dropping year on year with the continuously reducing cost of computational power. With the advent, and broader adoption of Quantum Computing this computational cost will reduce even more so. These technology trends supplemented by newer evolutions of consensus algorithms ensures that blockchain technology is sure to penetrate more of our public and private leger systems.