The ABCs of Blockchain
Back to blockchain – Blocks and chains?
Not sure you know of Russian dolls? The set of dolls that you find a slightly smaller one inside (almost) every time when you open up the current one.
Now imagine that you wrote a note on the innermost doll. To read or amend the note, one have to open up all the bigger dolls to reach the it.
Blockchain is similar in the sense that they are blocks (of information) chained together to form a single chain of blocks. To amend the information in a particular block, some blocks will be affected. Hence, blockchain. How aptly named.
How are the blocks chained together?
So how are they chained together? The header information of the previous block is used as one of the inputs to calculate the header information of the current block (i.e. the proof-of-work in the above diagram), and the header information from current block is used for the next.
Merkle Tree and Merkle Root?
That information is the value of the Merkle root, or root of the hash tree or Merkle tree. Merkle tree allows efficient verification of the contents of large data structures. The hash values of the individual contents (with value of the Merkle root in previous block) forms the leaf nodes of the Merkle tree. They are paired (e.g. hash 1 with 2, hash 3 with 4) and hash together to form a single hash. This pairing and hashing is repeated until a single hash value is derived and that is the root of the Merkle tree – Merkle root.
To prove the existence of a particular item (i.e. HK), one will just need the other value in the pair (i.e. HL) and every non-leaf (i.e. HIJ, HMNOP, HABCDEFGH) along the way up to the root (HABCDEFGHIJKLMNOP). One should arrive at the same Merkle root value.
Hash are essentially unique fingerprints of data. One of the requirements of a good hash function is that they don’t have collisions. That is, no two unique data should have the same hash value.
The first block of the blockchain network is called the genesis block (or block #0).
Imagine changing a particular transaction stored in one of the blocks, you will need to calculate the entire chain of blocks following it and ensure that the block’s header hash is the same as the values stored in the rest of the participants in the blockchain network. Hence, it has a prohibitively high cost of modifying these cryptographic protected transactions.
In cryptocurrencies, there is a deliberate difficulty or handicap set in place when calculating the Merkle root. The Merkle root has to be below (or smaller than) the target. To achieve this, the miner introduces a nonce into the calculation of the Merkle tree to vary the value of the Merkle root. The miner goes through an exhaustive trial-and-error process to find the correct nonce to get a Merkle root that meets the requirement. Decreasing the value of the nonce does not necessarily means a decrease in the value of Merkle root.
Blockchain – Permissionless or permissioned?
The blockchain network can be operated as a public network or private network. In a public or permissionless blockchain, anybody can participate as various roles (e.g. validator, user). On the other hand, only allowed parties can take part in these activities in a private or permissioned blockchain network.
Which setup is better? Honestly, it depends on the type of problem you are trying to solve. Regardless of which setup you choose, I felt that operational resilience should always be considered. Can your blockchain still deliver its intended benefits if there are malicious users or participants? Blockchain is not the silver bullet to all problems you are facing now.
For payment networks that users are global and can perform fund transfers between them, it makes whole lot of sense for it to be a public blockchain with the necessary smart contracts in place to perform all the necessary consensus checks before fund movement occurs.
On the other hand, to protect the integrity of Intellectual Property (IP) works of an R&D firm, one might opt for a private (or permissioned) blockchain network to ensure the consistencies and integrity during the life-cycle of the intellectual property in information systems.