Figure 3: Merkle Tree
replicated ensures that the blockchain is a shared, synchronized, immutable, distributed ledger created through distributed consensus; all nodes have access to the ledger and can verify the truth. Simply speaking, the blockchain elegantly implements tamper-proof record keeping. The blockchain protocol is decentralized and eliminates the need for intermediation by trusted third parties. Blockchain technology thus represents a deep one that combines cryptography, data structuring, and distributed consensus in a brilliant way.
Blockchain technology provides a way to implement a distributed, shared ledger without the need for a central trusted entity or trusted third parties. Theere are other ways to implement a distributed, shared ledger but blockchain technology is superior to the existing approaches because of the above features.
2.2 Mining of Blocks
The addition of a new block to a blockchain is based on inverting a hash function, whose computational complexity is believed to grow exponentially in the length of the input. This process is known as mining (the word validation is also used but we prefer to use the word mining in this article). Mining secures the blockchain system from fraudulent transactions. Mining could be done by any node in the blockchain (in a public blockchain). The task of a miner is two fold : (1) to validate the data in the block and (2) to append the valid block to the already existing blockchain. Note that the success of the blockchain is attributed to the way mining is done i.e. how the verification of data is done in a decentralized, anonymous fashion. In the next two subsections, we present how this is achieved via the standarad process called proof-of-work and a modified process called proof-of-stake.
This section assumes a bitcoin type of (public) blockchain. However, the principles are relevant for other types of blockchains as well. For a detailed treatment of this topic, the reader is referred to , .
The key idea behind proof-of-work is to make the selection of a miner in a way that nobody can monopolize the system by creating fake nodes. This is ensured in proof-of-work by making the nodes to compete to mine the block using their computation power. This would imply that no single node can monopolize the blockchain protocol as buying that much computation power would be next to impossible.
The proof-of-work is based on inverting a hash function where the hardness of the computation can be controlled. For example, in the bitcoin network, the parameters for proof-of-work are set in
a way that one block is mined in a certain time duration. This cryptographic computation is a hash function based computation where each miner is required to find a random numeric value nonce such that the cryptographic hash function of the nonce when combined with the data and the hash value of the previous block results in a hash value that is less then a specific target value. More specifically,
The hardness of this hash computation can be increased or decreased by adjusting the targetvalue appropriately. This targetvalue is adjusted automatically between the nodes in the blockchain so as to maintain the difficulty of mining to be a certain time duration (in the case of bitcoin blockchain, 10 minutes per mining a block is usually chosen). Note that given a value of nonce and the block, it is easy to verify that the hash function of this block is in fact less than the targetvalue. Thus, once a miner broadcasts a mined block, every other node can verify that the mined block is valid and thus will append this block to its own blockchain.
Proof-of-work described above prevents a serious problem called double-spend. Suppose Alice tries to send the same bitcoin to Bob and Carol. The transactions are not completed unless both the transactions are recorded on the blockchain. If an honest node tries to mine these transactions, it will immediately invalidate one of the transactions as the money is already spent. Another possibility is Alice herself tries to mine the block. In this case, if both the transactions are in one block, then other honest nodes will refuse to accept this block as a valid node. Thus, the only possibility for Alice is that the two transactions should be included in two different blocks. In this case if one of the transactions (say from Alice to Bob) has already appeared in the blockchain, then the other transaction will be invalidated by the honest nodes. The other possibility is that both the blocks are mined at the same time thus creating a fork in the blockchain. When such a fork appears, the blockchain chosen by a majority of the nodes is considered as legal. The trasaction that appears in this legal blockchain will be considered as valid and the other transaction will be invalidated. For other types of attacks, the readers are referred to .
A disadvantage of proof-of-work is that it needs a massive amount of computation power (hence, energy) to validate a single block. “The ever-expanding racks of processors used by miners already consume as much electricity as a small city” . Another problem is that mining has become rather proprietary hardware centric which leads to centralization issues as people who are manufacturing such hardware can control the blockchain system. Therefore, people are shifting to other mining techniques like proof-of-stake which is discussed in the next subsection.