In the last part of this series, we discussed the basic concepts of blockchain technology. In this post, we are going to discuss the evolution of blockchain and it the latter part of the post, I will introduce the concept of bitcoin technology at a high level.
Hashing and Hash Functions
The concept of hashing is the backbone of the blockchain technology and it helps us to speed up the searching process. Hashing allows us to map any data to a fixed size. The entity which performs hashing is called a Hash Function. For e.g, H(x) = x%n (% is the modulo operator - returns remainder when x is divided by n), as it is evident that x can be of any value but H(x) will always be in the range [0, n-1].
x is called Message
H(x) is called Message Digest
Cryptographic Hash Function
It is a mathematical algorithm that maps data of arbitrary size to a bit string of a fixed size (a hash). It is a one-way function i.e. we can find H(x) if x and n are given but if H(x) and n are given, we cannot find x. The only way to find x is by using brute-force and this gets tougher as the number of possibilities increase.
The ideal cryptographic hash function has five main properties:
- The same message should always result in the same hash.
- Significantly fast to calculate the hash of any message.
- Only one way
- A significantly different hash is generated even if there is a very small change in message.
- No two different messages should generate the same hash.
|Avalanche Effect courtesy: Wikipedia|
If you look at the above figure closely and notice the word "over", you will find that the hash function changes drastically. This is called Avalanche Effect. This is very important from the security aspect as if the message is encoded, it makes it very hard for someone to guess the message.
Merkle Trees (or hash trees) are a fundamental part of the blockchain technology. It efficiently verifies the consistency of a large content of data. Bitcoin and Ethereum both use Merkle Tree concept.
|Merkle Tree (courtesy: Medium)|
They follow the bottom-up approach by hashing pair of nodes repeatedly until only one node/hash is left. This hash is called Root Hash or Merkle Root.
Each leaf node represents the hash of the transactional data while each non-leaf node represents the hash of the combination of hashes of the previous nodes. Merkle trees are binary trees and therefore require an even number of leaf nodes. If the number of transactions is odd, the last hash will be duplicated once to create an even number of leaf nodes.
Later in 1991, Stuart Haber and W. Scott Stornetta published a paper called How to Time-Stamp a Digital Document in which they used Merkle Trees to timestamp a digital document so that the people who edited the documents and at specific timestamps can be easily determined. In this scheme, each edit depends on the previous edit's hash. Hence, if anyone tries to tamper the timestamp, the hash would change and the person can be caught easily. Thus, security increases many folds.
What is Bitcoin?
In 2009, Satoshi Nakamoto (the fact no one knows who is/are he/she/they - intrigues me 😵) published a whitepaper and introduced the concept of Bitcoin. In this section, we will discuss high-level details of Bitcoin and its working.
The bitcoin is a completely decentralized, peer-to-peer, permissionless electronic cash system. The keywords in above definition are:
- Decentralized - No central party for ordering or recording anything, not even government.
- Peer-to-peer - The software runs on the machines of all stakeholders to form the system.
- Permissionless - No identity; no need to signup anywhere to use; no access control - anyone can participate in any role - be it, sender, receiver or miner.
A sample transaction in Bitcoin
|Typical bitcoin transaction (courtesy: Twitter)|
In bitcoin, each individual has a copy of the most updated blockchain or public ledger. Let us try to understand the life cycle of a typical bitcoin transaction -
The Sender -
- Sender opens his/her account
- Provides the address of the receiver and specify the amount to transfer
- The wallet constructs a transaction and signs it using the sender's private key (to ensure the validity and authenticity of the transaction)
- Once the transaction is constructed, it is broadcast to the network.
- The network nodes validate the transaction based on the existing blockchain and propagate it to the miners.
- The miners include the transaction to the next block to be mined.
- Miners collect all transactions within a fixed time interval (10 minutes for BTC)
- Then they construct a new block and try to connect it with the existing blockchain through a cryptographic hash function
- Once the block is generated, it is included in the blockchain and the updated blockchain is broadcast to the network.
- The hash of each block is generated based on the hash of the previous block and the task of each miner is to solve this hash problem in a difficult manner (under the hood, the miners need to solve a hard mathematical problem - such as the hash should contain 20 trailing zeros - so each combination needs to be checked until the condition is met).
- The receiver opens his/her bitcoin wallet and refreshes, the blockchain gets updated.
- The transaction gets reflected in the receiver's account.
Many mainstream companies are exploring to use the blockchain for building alternate systems other than transactions for uses in manufacturing, supply chain, governance, IoT etc. This revolution is being termed as Blockchain 2.0.
Phew! we have reached the end of this post and we discussed the evolution of the blockchain and the principles it works. Later on, we discussed high-level details of a typical bitcoin transaction. In the next post of this series, we will look into the blockchain architecture. I hope you enjoyed this post. Stay tuned! 😎
Very nice introduction shared in this blog of blockchain evolution.ReplyDelete
Blockchain Tech and Revolution