Introduction to blockchain

Blockchain is a distributed ledger that store information in it. In other words, it is a synchronized database distributed over the network. The structure of blockchain is similar to a linked list data structure. Bock stores data and each block can any number of information depending upon the use case. A block can even contain no information or data. Every block links to its previous block like a linked list or pearls in a necklace. These features of blockchain provide immutability and eliminate a single point of authority and failure.

Blockchain is a distributed network of untrusted nodes synchronized with each other and share identical copies of the ledger. These untrusted nodes come to a consensus and keep the network running.

A blockchain block

A blockchain block mainly consists of two parts.

  1. A Block Header
  2. Transaction List (Body of block)
Blockchain-illustration
Blockchain illustration

Block Header

Block header links the block to its previous block and provides information about the block. Generally, there are 6 fields in a block header.

  1. Hash of the previous block
  2. Timestamp.
  3. The version number of the software
  4. Hash of the Merkle root
  5. Difficulty target
  6. Nonce

Depending on the blockchain, the fields may vary and additional fields can be found. The Hash of the previous block links the current block with the previous block. When someone tries to change the content in the block, the hash of the block will change and thus it will not match the hash in the succeeding block. Merkle root is the hash of all hashes of previous blocks. This also ensures immutability among the blocks.

The timestamp is the time when the block was created. The version number helps in tracking the updates and changes in the blockchain network. Every block is added to the blockchain by solving a cryptographic puzzle. Nonce and difficulty target is used in solving this cryptographic puzzle. These will be discussed in detail in upcoming sections.

Transaction List

It is the body of the block. It contains the information that is stored in the block. The body of the block can be empty. During the creation of the blockchain, the first block created is called as ‘genesis block’. Usually, the genesis block contains no information and is empty. In the Bitcoin blockchain, the block contains transaction information. All transactions will be broadcasted to the network and go into the network pool. Transactions from the pool are used to create a new block. Depending on the use case of blockchain, information changes. In ethereum and other blockchains, blocks can contain code snippets that can run inside the blockchain.

How blockchain reaches consensus

As we discussed in the earlier section, blockchain is a network of untrusted nodes. These nodes come under consensus by solving a cryptographic puzzle. There are special nodes called ‘miners’ in the blockchain. In the classic blockchain, miners compete against each other to solve the cryptographic puzzle. The miner node that solves the puzzle first will add the new block to the blockchain. The miner who solves the puzzle will get incentives.  In cryptocurrencies, the miner who solves the puzzle will get a certain number of cryptocurrencies and this is how new currencies are generated in a classic blockchain cryptocurrency.

The difficulty target in the block header determines the level of the difficulty level of the cryptographic puzzle. A nonce is a random number used by the miners to solve the cryptographic puzzle. The nonce can only be incremented by 1 and starts at 0.

In bitcoin blockchain, the consensus algorithm is called Proof of Work (PoW). In PoW, the miners will compete against each other to find the hash of the current block. The difficulty target will specify the condition for the hash. In classic bitcoin, it will specify the number of zeroes at the start of the hash. For example, the hash of the block should have 3 zeroes at the beginning.  Miners will compute the hash of the block and the miner that computes first will broadcast the result to the network. Other miners will verify the result and the winner miner gets to add the block.

History of blockchain

The concept of blockchain existed before bitcoin but the term ‘blockchain’ was coined much later. In 1982, a cryptographer named David Lee Chaum proposed a protocol similar to blockchain in his dissertation  “Computer Systems Established, Maintained, and Trusted by Mutually Suspicious Groups”. Followed by this, the first chain of blocks that are cryptographically secure was proposed by Stuart Haber and W. Scott Stornetta in 1991. In 1992, Haber and Stornetta improved the design by including Merkle root.

It was in 2008, Satoshi Nakomoto first conceptualized the blockchain and used it in his cryptocurrency ‘bitcoin’. Before Satoshi, many tried to make distributed and decentralized systems but failed to achieve consensus. Later in 2015, a young Canadian-Russian programmer named Vitalik Buterin introduced Ethereum cryptocurrency. While bitcoin could only store transactions, ethereum was more general-purpose and the advantage of ethereum over bitcoin was a special feature called ‘smart contracts’.

Smart contracts are codes that can run on the blockchain and it allowed to implement business logic onto the blockchain and this boosted the popularity of blockchain to the next level. In the same year, the Linux foundation developed a blockchain framework called Hyperledger. While bitcoin and ethereum were public blockchains, hyperledger was private. With the introduction of the hyper ledger, companies started adopting blockchain and in the present day, researchers and companies are exploring areas where blockchain can be used to solve problems.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.