The Whats and Whys of Blockchain
The easy next step after familiarizing yourself with the basics is trying to get a hang of what makes Blockchain tick. In this blog, let’s work at peeling off each layer to better understand why Blockchains are faster, safer, and far more efficient than most other technologies out there today.
A typical blockchain structure is made up of blocks and transactions, where each transaction represents a digital record of a transfer of assets. These assets vary depending on the industry to which the Blockchain belongs.
Essentially, a transaction is an event that triggers the update of the Blockchain distributed ledger. Read more about distributed ledgers a little below.
For example, transactions in a personal bank account would depict transfer of financial assets of the account owner.
Figure 1: Sample of a Transaction
A block is the smallest component of a Blockchain structure and typically consists of a Block Header and one or more Transactions. Each block is connected to the previous one using a Hash value that is calculated based on the details stored in the previous block header.
Figure 2: Sample of a Block with a Single Transaction
Figure 3: Sample of a Block with Multiple Transactions
Merkle trees, aka Hash Trees, are a means of securing and verifying data stored in and transacted through Blockchains. Each leaf of this tree stores a hash value of a transaction and the leaves higher up in the tree store hash values of their child leaves. A typical Merkle tree is binary, that is, each parent would have two children. This, however, can vary depending on the structure of the Blockchain.
The topmost node of the Merkle tree is known as the top or root hash. This node is used to verify the identity and integrity of incoming data (also in the form of hash trees).
Figure 4: Merkle Tree
In a distributed ledger, a copy of the data is maintained across multiple locations and systems. There is no central authority for these structures and data integrity is maintained using consensus algorithms.
Data in a distributed ledger is stored on a peer-to-peer network and any changes to this data triggers automatic updates on all copies of the data. Each time the ledger is updated, the nodes reach a consensus on the ‘correct’ new copy and update themselves accordingly.
The typical consensus algorithms used are: Proof of Work and Proof of Stake.
Figure 5: Distributed Ledger
Blockchain uses hashing algorithms to encrypt data by turning an input of variable length into an output string of fixed length, known as the hash value. The hash value along with knowledge of the hashing algorithm is used to decrypt the relevant data.
Bitcoin, Blockchain’s cryptocurrency uses the Secure Hashing Algorithm 256 (SHA256) to create hash values for block headers. Each block in the Blockchain is connected to the previous block by its hash value. If a block is tampered with, the hash values would not match and thus, the blockchain would fail.
Figure 6: Hashing
Like handwritten signatures, digital signatures are used as a means for a user to sign off on and verify their data.
In cryptography, users possess a pair of linked keys, the public and private keys. While public keys are used to distribute data across a network, private keys are used to sign off on this data (that is, uses a digital signature before sending). A sender’s identity is confirmed using their public key.
Have you heard of another building block of Blockchain that you would like to discuss further?