Skip to main content

Introduction to Blockchain - Evolution (Part 2)

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

                                        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

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:
  1. Decentralized - No central party for ordering or recording anything, not even government.
  2. Peer-to-peer - The software runs on the machines of all stakeholders to form the system.
  3. 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
  • Sends

The Network

  • 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.

The Miners

  • 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

  • The receiver opens his/her bitcoin wallet and refreshes, the blockchain gets updated.
  • The transaction gets reflected in the receiver's account.

 Blockchain 2.0

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! 😎




Comments

Post a Comment

Popular posts from this blog

Introduction to Blockchain - Conceptualization and Applications (Part 4)

It's been a long time since my last post as I got stuck in some work. This is the last part of the introduction to blockchain series. In this post, we will touch upon a few more concepts of blockchain and their applications. At the end of the post, we will also look into the concept of Hyperledger Fabric in brief. Permission-less model In this model, anyone can join the network, participate in the process of block verification to create consensus and also create smart contracts. For e.g. Bitcoin and Ethereum network.  In a permissionless world, one does not have to prove their identity to the ledger.  As long as you are willing to commit processing power to be part of the network and extending the blockchain, you are allowed to play.  Any miner who is playing the game by the rule may be able to solve the hash puzzle and verify the block of transactions to win the mining reward (Higher the mining power, better the chances of winning the mining reward). It is good for fin

Introduction to Blockchain - Basics (Part 1)

The blockchain isn't just the backbone of cryptocurrency - it could change the world. Applications are endless. It is one of the most sought-after skills these days. Blockchain developers are in huge demand but there are only a few who can elegantly develop a blockchain application. I will admit that I am a newbie to this field and all the related terminology. Recently I have decided to dive into this field and after learning a few nuances, I thought it would be a good idea to share my understanding with everyone. Hence, this blog. This is the first blog of this series and without further ado let's learn together the awesome concepts of Blockchain technology.  What is a blockchain? It is a decentralized  platform which enables multiple domains , who do not trust each other to collaborate in a decision-making process . Main keywords from the above definition are -  Decentralized - There is no single centralized authority that makes decisions on behalf of a