Unveiling the concept of “Blockchain”.

Aman Mishra
Software Incubator
Published in
15 min readMay 5, 2020

Getting ahead with the power of blockchain.

Ever wondered about the problem of data tampering, fraud transaction, illegal manufacturing, unauthorised data access, overheads in the supply chain, secure digital currency, and many more?

Well, with an increase in the technology and web-based applications the importance of having data integrity, reliability, and durability has become far more important than it ever was. The term WEB 3.0 is closely related to these problems and their solution.

Hence to answer all these questions efficiently Blockchain Technology is the best solution available so far. Most of us already heard about the term Blockchain, but little of us have a clear understanding of this technology and its underlying principles.

Well, let’s decode this technology in the most fundamental terms.

A blockchain is a decentralized immutable digital data ledger.

Well, these terms might get confusing so let’s break it and have a crystal clear concept of it.

  • A blockchain is decentralized -: In simple term, there is no centralized governing system or a body, means each node(system on the blockchain network is called as a node) in the network has the complete information about all the transactions and records.
  • A blockchain is immutable:- Immutable means data or record that cannot be changed, hence data in the blockchain can not be changed.
  • A blockchain is a digital data ledger:- Ledger means a record or collection of the transactions. So a blockchain can be a chain of any digital record that might include transaction records, any file, etc.

Therefore, Blockchain can be described as a data structure that holds transactional records and while ensuring security, transparency, and decentralization.

In the early days of this technology, it was mainly understood as the technology that is well efficient only for cryptocurrency and digital money like bitcoin, etc but make no mistake as the scope of this beautiful technology is far beyond the cryptocurrency and digital money.

The first work on a cryptographically secured chain of blocks was described in 1991 by Stuart Haber and W. Scott Stornetta. However, the first blockchain was conceptualized by a person known as Satoshi Nakamoto in 2008. From where the cryptocurrency came into very existence and the term cryptocurrency became the synonym for the term blockchain. However, a Blockchain is not a bitcoin or cryptocurrency rather a blockchain is a technology upon which protocols like cryptocurrency and bitcoin are formulated.

Let’s see the basic principles of this technology:-

  1. Distributed or decentralized database. Each party on a blockchain has access to the whole database and its complete history. No single party regulates the data or information. Every party can validate the records of its transaction partners directly, without an intermediary.

2. Peer-to-peer transmission. Communication occurs straightforwardly between peers instead of through a central node. Each node stores and forwards information to all other nodes.

3. Irreversibility of records. Once a transaction is inputted in the database and the accounts are updated, the records cannot be changed, because they are linked to every transaction record that came before them (this is basically where the term “chain” comes from). Various computational algorithms and approaches are deployed to ensure that the recording on the database is permanent, chronologically ordered, and available to all others on the network.

Let’s see the mechanism of how this technology works and dive deeper.

What does a block in a blockchain consist of?

Well, in the simplest term each block can be thought of as a page in a ledger. Page in a ledger consists of the information about a record like transaction, date and time signature, etc. Similarly, a block is also composed of several components like previous hash, timestamp, nonce, goal(difficulty or the hash function/mathematical function that is required to solve the hash to add a block in the chain), block body, etc.

What is Genesis Block

The genesis block is the first block in any blockchain-based protocol. This block is sometimes referred to as Block 0. Every block in blockchain stores a reference to the previous block. In the case of the Genesis Block, there is no previous block for reference.

In technical terms, it means that the Genesis Block has it’s “previous hash” value set to 0. This means that no data was processed before the Genesis Block. All other blocks will have sequential numbers starting by 1 and will have a “previous hash” set to the hash of the previous block.

  1. The hash of the previous block

The hash of the previous block is, so to speak, the chain of blockchains. Because the hash of the previous block is contained in the hash of the new block, the blocks of the blockchain all build on each other. Without this component, there would be no connection and chronology between each block.

Many Different hashing algorithms are present that can be used for cryptographing, however, SHA-256 is the most famous of all cryptographic hash functions and is extensively used in blockchain technology.

2. Block timestamp

Each block contains a Unix time timestamp. Timestamp can be referred to as “Proof of existence”.In the blockchain, it would say as a crypto notarization can be used as the proof of integrity.

3. The goal of the current difficulty

The goal indicates how small the new hash must be to claim validity. In other words, every hash has a size in bits. The lower the goal in bits is, the harder it is to find a matching hash. A hash with many zeros at the beginning is smaller than a hash without zeros.

4. The Nonce

A nonce is an abbreviation for “number only used once,” which is a number added to a hashed — or encrypted — block in a blockchain that, when rehashed, meets the difficulty level restrictions. The nonce is the number that blockchain miners are solving for. When the solution is found, the blockchain miners are offered cryptocurrency in exchange.

5. Block Body

The block body is conceivable as the loading space of a truck. It contains all information about a record.

The transactions in a block are not just in a list, but in a so-called Merkle Tree.

What is a Merkle Tree?

The Merkle Tree takes its name from the mathematician Ralph Merkle. The discovery was that much information can be represented in a single hash. For this, the data itself is first hashed. Then the hashes are hashed again and merged. Finally, the Merkle Tree is merged into a single hash. This last hash is also called the root hash, the root of the tree. It represents all the information of its “leaves” (individual transactions) and “branches” (hashes of the leaves) in a relatively short string.

Let’s see a very interesting scenario where a hacker wants to change/manipulate a block in the chain, to do so he has to solve the hash to decrypt the information, within a second. Since you might think that it’s not very difficult to hack into the network with a very powerful computer that can solve a hash in a second, but this is not the case. In order to prove the tempered block authentic, the hacker must have the block changed in at least 51% of the nodes that are present in the network otherwise that tempered block will be discarded by the other nodes on the network. So in simple terms, the hacker must hack at least 51% nodes in the network that too within a second which is almost impossible. That is why tempering the node in the decentralized system of the blockchain is impossible.

Since in the beginning, we discussed that blockchain is decentralised and there is no central authority to validate and authorise the transactions done and added to the blockchain. So you might have a question that how does the transactions are then validated and verified?

Well, this is possible only because of the presence of the consensus protocol which is a core part of any Blockchain network.

A consensus algorithm is a procedure through which all the peers of the Blockchain network reach a common agreement about the present state of the distributed ledger. In this way, consensus algorithms achieve reliability in the Blockchain network and establish trust between unknown peers in a distributed computing environment. Essentially, the consensus protocol makes sure that every new block that is added to the Blockchain is the only version of the truth that is agreed upon by all the nodes in the Blockchain.

But before having a dive into consensus algorithm we’ll look at a scenario that may arrive into the blockchain network and that triggers the importance of the consensus protocols.

What happens, if some of the nodes are likely to fail or to act dishonestly? how can a distributed network of computer nodes then agree on a decision?

Well, this is the very question that gives rise to what we call as Byzantine Generals’ Problem.

It is a logical dilemma that illustrates how a group of Byzantine generals may have communication problems when trying to agree on their next move.

The dilemma assumes that each general has its army and that each group is situated in different locations around the city they intend to attack. The generals need to agree on either attacking or retreating. It does not matter whether they attack or retreat, as long as all generals reach consensus, i.e., agree on a common decision to execute it in coordination.

Therefore, we may consider the following requirements:

  • Each general has to decide: attack or retreat (yes or no);
  • After the decision is made, it cannot be changed;
  • All generals have to agree on the same decision and execute it in a synchronized manner.

The aforementioned communication problems are related to the fact that one general is only able to communicate with another through messages, which are forwarded by a courier. Consequently, the central challenge of the Byzantine Generals’ Problem is that the messages can get somehow delayed, destroyed, or lost.

Besides, even if a message is successfully delivered, one or more generals may choose (for whatever reason) to act maliciously and send a fraudulent message to confuse the other generals, leading to a total failure.

If we apply the dilemma to the context of blockchains, each general represents a network node, and the nodes need to reach consensus on the current state of the system. Putting in another way, the majority of participants within a distributed network have to agree and execute the same action to avoid complete failure.

Therefore, the only way to achieve consensus in these types of distributed systems is by having at least ⅔ or more reliable and honest network nodes. This means that if the majority of the network decides to act maliciously, the system is susceptible to failures and attacks (such as the 51% attack).

Byzantine fault tolerance (BFT)

Byzantine fault tolerance (BFT) is the property of a system that can resist the class of failures derived from the Byzantine Generals’ Problem. This means that a BFT system can continue operating even if some of the nodes fail or act maliciously.

There is more than one possible solution to the Byzantine Generals’ Problem and, therefore, multiple ways of building a BFT system. Likewise, there are different approaches for a blockchain to achieve Byzantine fault tolerance and this leads us to the so-called consensus algorithms.

There are various consensus algorithm we’ll see some of the most important consensus algorithms

Proof-of-Work

Proof-of-work (PoW) is a consensus algorithm for blockchain networks that is the underlying consensus model of Bitcoin. Proof-of-work is a mechanism for achieving agreement on the blockchain network to confirm transactions and produce new blocks to the chain.

In proof of work, a miner has to solve a complex mathematical puzzle to generate the hash required for adding a block in the network.

Well, it might seem that it’s a quite easy protocol that we just have to solve a puzzle and we can get the access to add a block in the network. Well however it’s not the case because these are highly complex mathematical puzzle which requires immense computational power to solve and it’s all a brute force approach.

The complexity of the problem depends upon many factors like the maximum number of users, the minimum current power, and the overall load of the network. There is an avalanche effect on the hash generated if the information is changed even slightly

PoW is very energy consuming and thus becomes very difficult to overpower this protocol in order to hack in the system.

Proof of Stake

Proof-of-Stake algorithms achieve consensus by requiring users to stake a number of their tokens to have a chance of being selected to validate blocks of transactions and get rewarded for doing so.

An algorithm chooses from the pool of candidates the node which will validate the new block. This selection algorithm combines the quantity of stake (amount of cryptocurrency) with other factors (like coin-age based selection, randomization process) to make the selection fair to everyone on the network.

Coin-age based selection:
The algorithm tracks the time every validator candidate node stays a validator. The older the node becomes, the higher the chances of it becoming the new validator.

Random Block selection:
The validator is chosen with a combination of ‘lowest hash value’ and ‘highest stake’. The node having the best weighted-combination of these becomes the new validator.

Now let’s see different types of blockchain networks.

1. Public Blockchain

It is a non-restrictive, permissionless distributed ledger system. It marks the beginning of the major types of blockchains we know today. Bitcoin, Litecoin, and Ethereum are the blockchain platforms that are typical examples of a public blockchain. So, what are public blockchains? As the name suggests, this blockchain is ‘for the people, by the people, and of the people.’ Anyone having access to the internet can become an authorized node by signing in to the blockchain platform. They are then considered part of the blockchain network. A node or user of a public blockchain has the authority to perform mining, access current, and records, and verify transactions, or perform the proof-of-work consensus protocol for an incoming block. In this blockchain, there is no one in charge, and anyone can participate in writing, reading, or auditing the blockchain. These blockchains are open and transparent. In a public blockchain, decision making happens through what we discussed above i.e consensus algorithms such as proof-of-work, proof of stake.

2. Private Blockchain

This refers to a closed blockchain network, and this network is not completely decentralized and distributed like a public blockchain. It is a restrictive, permitted blockchain that only operates within a closed network. It is the private property of an organization or an individual. Unlike public blockchains, there is a person who is in charge here and looks after important things like reading/writing and to whom access must be given to read. Here, consensus or decision-making is achieved on the whims of the central in-charge who will decide whom to give mining rights or will even decide not to give at all. Private blockchains comprise specific constituent nodes on the network that are given the right to create, view, and authorize transactions. The blockchains developers will decide on the node that will get the transaction rights. The authorizations, permissions, accessibility, and level of security are in the hands of the controlling organization. Public blockchains have a small and restrictive network. The blockchain platforms that fall under the private blockchain category are Hyperledger Fabric, Hyperledger Sawtooth, Corda, and Multichain.

3. Consortium Blockchain

It is a semi-decentralized type of blockchain where a blockchain network is managed by more than one organization. It is part public and part private and hence a combination of both public and private blockchains. The split between the public and private nature happens based on the consensus. In a consortium blockchain, only a few nodes or users are given the right to authorize transactions and oversee the consensus process. The division of rights and powers will be different for each consortium blockchain. Consortium blockchains are governed by a group and not by a single entity. Some of the typical examples of consortium blockchains are Quorum, Corda, and Hyperledger.

Let’s see some of the major protocols of the blockchain technology

Bitcoin:

The protocol on which the cryptocurrency Bitcoin is transacted, this was the earliest of the blockchain protocols. We have already discussed this protocol above.

Ethereum:

Ethereum blockchain has many similarities with the Bitcoin protocol, e.g.:

  • It’s a public, permission-less blockchain;
  • It uses the same technological backbones, e.g. cryptographic hash function, private-and-public key encryption, P2P network, etc;
  • The PoW consensus algorithm is used, the PoS consensus algorithm is also used some times;
  • There’s a native cryptocurrency, called Ether. Ether has the second highest market cap, behind only Bitcoin.

However, unlike Bitcoin, which was built for allowing crypto payment transactions over a decentralized network, Ethereum was designed with much larger objectives in mind. Ethereum provides a blockchain platform, using which developers can launch their own blockchain projects, including their own cryptocurrencies. The platform, commonly called as ‘Ethereum Virtual Machine’ (EVM).

What gives so much of the liberty for the developers on the Ethereum platform?

The answer is Smart contracts. Smart contracts are pieces of code, which allow execution of legal functions, e.g. taking control of an entity based on certain conditions, and transferring crypto tokens based on fulfilling required conditions. Smart contracts on the Ethereum platform are codes using Ethereum’s proprietary language Solidity, which is inspired by C++, Java, Python, and JavaScript.

DApps may be considered as the basis for the web 3.0 which I discussed in the beginning, are applications where the backend code runs on a decentralized blockchain and comprises of smart contracts. The frontend code can be written in any language. To be considered as DApp, an app must meet the following conditions:

  • Fully open-source;
  • It must operate autonomously;
  • The app must use a crypto token, and no one entity can control the majority of the crypto tokens;
  • A consensus of the users determines future changes to the app;
  • Data must be stored in a decentralized blockchain, and meet cryptographic standards;
  • A standard cryptographic algorithm such as POW must be used, to generate the crypto tokens.

Ethereum also provides a way for the user to specify how much computing power will be expended for a transaction, by using a measure of processing power, called ‘Gas’. The user can specify a gas limit. If a transaction remains within that limit then it’s executed, however, if it exceeds the limit, then the changes are reverted.

Hyperledger:

Hyperledger Fabric is an enterprise-grade permissioned distributed ledger framework for developing solutions and applications. Its modular and versatile design satisfies a broad range of industry use cases. It offers a unique approach to the consensus that enables performance at scale while preserving privacy.

While public, permissionless blockchains have made it possible for many cryptocurrency projects to make a mark, wider adoption of blockchain is possible only when large enterprises adopt this technology. However, large enterprises have some specific requirements from blockchain technology, i.e :

  • Only trusted entities should join the network because enterprises can’t have their proprietary information visible to everyone;
  • Enterprises need blockchains with high scalability and transaction speed;
  • Even among the trusted participants, access to information should be role-based.

Finally, let’s see some of the use cases of blockchain technology.

  1. Supply chain.
  2. Healthcare Facilities.
  3. Land and asset registry.
  4. Banking and Stock Market.
  5. Cryptocurrency.
  6. Digital Identity.
  7. Voting.
  8. Food Safety.
  9. Verification of the documents(certificates, mark sheet, etc)
  10. Fake news detection.

So in this article, I’ve tried to explain all the fundamentals of the blockchain technology in the most simple terms.

I hope you all must have found this article useful.

--

--