Thanks! We'll be in touch in the next 12 hours
Oops! Something went wrong while submitting the form.

Blockchain 101: The Simplest Guide You Will Ever Read

Shubham Hapse

Full-stack Development

Blockchain allows digital information to be distributed over multiple nodes in the network. It powers the backbone of bitcoin and cryptocurrency.

The concept of a distributed ledger found its use case beyond crypto and is now used in other infrastructure.

What is Blockchain?

Blockchain is a distributed ledger that powers bitcoin. Satoshi invented bitcoin, and blockchain was the key component. Blockchain is highly secured and works around a decentralized consensus algorithm where no one can own the control completely.

Let's divide the word blockchain into two parts: block and chain. A block is a set of transactions that happen over the network. The chain is where blocks are linked to each other in a way that the next block contains hash of the previous one. Even a small change in the previous block can change its hash and break the whole chain, making it difficult to tamper data.

Blockchain Example

Image source

Blockchain prerequisites:

These are some prerequisites that will help you understand the concepts better.

Public-key Cryptography- Used to claim the authenticity of the user. It involves a pair of public and private keys. The user creates a signature with the private key, and the network uses the public key of the user to validate that the content is untouched.

Digital Signatures:

Digital signatures employ asymmetric key cryptography.

  • Authentication: Digital signature makes the receiver believe that the data was created and sent by the claimed user.
  • Non-Repudiation: The sender cannot deny sending a message later on.
  • Integrity: This ensures that the message was not altered during the transfer.

Cryptographic hash functions:

  • One way function: This is a mathematical function that takes an input and transforms it into an output. There is no way to recover the message from the hash value.
  • No collision: No two or more messages can have the same hash(message digest). This ensures that no two account transactions can collide. 
  • Fixed hash length: Irrespective of the data size, this function returns the same hash length.

Why Blockchain?

There are a few problem statements that we can quickly solve using a distributed consensus system rather than a conventional centralized system.

Let me share some blockchain applications:

Consider an auction where people bet on artifacts, and the winner pays and takes out those artifacts. But if we try to implement the same auction over the internet, there would be trust issues. What if one wins the bet saying 10000$ and at the time of payment, he doesn't respond.

We can handle such events easily using blockchain. During betting, a token amount will be deducted from an account and will be stored in the smart contract (business logic code deployed on Ethereum). Bid transactions use a private key to sign transactions, so this way, one can not revert by saying that those transactions never happened.

Another simple but amazing solution we can develop using Ethereum is online games like tic-tac-toe, where both players will deposit `X` amount in the smart contract. Each move done by a player gets recorded on blockchain (each movement will be digitally signed), and smart contract logic will verify a player's move every time. In the end, the smart contract will decide the winner. And the winner can claim his reward.

- No one controls your game

- There is no way one can cheat 

- No frauds, the winner always gets a reward.

Bitcoin is the biggest and most well-known implementation of blockchain technology.

The list of applications based on distributed consensus systems goes on.

Note: Ethereum smart contract is the code that is deployed over Ethereum blockchain. It is written as a transaction on the block so no one can alter the logic. This is also known as Code is Law.

Check out some of the smart contract examples.

Bitcoin is the base and ideal implementation for all other cryptocurrencies. Let's dig deep into blockchain technology and cryptocurrency.

Let’s reinvent Bitcoin:

  • Bitcoin is distributed ledger technology where the ledger is a set of transactions
  • No single entity controls the system
  • High level of trust 

We have to design our bitcoin to meet above requirements.

1) Consider that bitcoin is just a string that we will send from one node to the other. Here, the string is: “I, Alice, am giving Bob one bitcoin.” It shows Alice is sending Bob one bitcoin.

One node sending Bitcoin to another


2) Sam uses the fake identity of Alice and sends bitcoin on her behalf.

A node is using fake identity during transaction


3) We can solve this fake identity problem using Digital signature. Sam can not use a fake identity.

Digital signature solves fake identity problem

But there is still one problem, double spending. This occurs when Alice sends one transaction multiple times. It's difficult to check if Alice wants to send multiple bitcoins or just retrying transactions due to high network latency or any other issue.

4) But a simple solution is to add a unique transaction ID to each transaction.

Unique transaction id to handle double spending problem

5) It’s time to add more complexity to our system. Let's check how we can validate the transaction between Alice and Bob.

In cryptocurrency, every node knows everything (nodes are the systems where blockchain clients are installed, like Geth for Ethereum).

Validate all transactions between two nodes


Every node maintains a local ledger containing whole blockchain data. Here, Alice, Sam, and Bob know how much bitcoins everyone has. This helps validate all transactions happening over the network.

As Bob receives an event from Alice containing a bitcoin transaction. He checks the local copy of the blockchain and verifies if Alice owns that one bitcoin that she wants to send. If Bob finds out that the transaction is valid, he broadcasts that to all networks and waits for others to confirm. Other peers also check their local copy and acknowledge the transaction. If maximum peers confirm the transaction valid then that transaction gets added to the blockchain. And everyone will update their copy of ledger now, and Alice has one less bitcoin.

Note: In actual cryptocurrency, validation occurs at a block-level rather than validating one transaction. Bob will validate a set of transactions and creates one block from it and will broadcast that transaction over the network to validate.

6) Still, there is one problem with this approach. Here, we are using Bob as a validator. But what if he is a fraud. He might say that transaction is valid even if its invalid, and he has thousands of automated bots to support him. This way the whole blockchain will follow bots and accept the invalid transaction (Majority wins).

Double spending use case

In this example, Alice has one bitcoin. Still, she creates two transactions: one to Bob and another to Sam. Alice waits for the network to accept the transaction to Bob. Now Alice has 0 bitcoins. If Alice validates her own transaction to Sam and says it's valid (Alice has no bitcoin left to spend), and she has a large number of bots to support her, then eventually the whole network will accept that transaction, and Alice will double spend the bitcoin.

7) We can solve this problem with the POW (Proof of Work) consensus algorithm.

Proof of Work consensus algorithm

This is a puzzle that one has to solve while validating the transactions present in the block.

Here you can see that the block has a size of around 1MB. So, you need to append any random number to the block and calculate hash, so that the hash value will have a starting string of zeros as shown in the image.

Blockchain decides this number, and then the next block miner has to calculate a random number so that hash has that many zeros in the beginning. To solve this puzzle, the miner has to try Peta combinations to get the answer. As this is a very complex process, miners get rewarded after the validation of the block.

But how can we solve the above problem using mining?

Suppose the blockchain network has 10,000 active mining nodes with the same computational power. The probability that one can mine is only 0.01%. If one wants to do fraud transactions, he should have huge mining power to validate the block and convince other nodes to accept the invalid block. To do this, one needs to own more than 50% of computational power, that is very difficult. 

Now we have a prototype cryptocurrency model ready with us.

Note: Each blockchain node follows the majority. Even if a transaction is invalid, but with more than 51% of nodes say it's valid, the whole network will be convinced and go rogue. This means that any group owns 51% of computational power(hash power), controls the whole blockchain network. This is known as a 51% attack.

Blockchain-based services:

  • Golem: Distributed computing platform.
  • Iexec: Distributed computing platform.
  • Sia distributed storage: Distributed storage, SLA is managed over the blockchain.
  • Ethrise: Insurance platform developed on Ethereum ecosystem.
  • Maecenas: Blockchain-based Auction of file arts.
  • More than 2000 cryptocurrency platforms.

Disadvantages of Blockchain:

There are a few limitations to blockchain-based solutions.

  • Crime: Due to its encryption and anonymous nature, blockchain solutions influence crimes.
  • Data size: Full nodes stores all transactional data and requires over 100 GB disk space.
  • Throughput: Blockchain systems are very slow.

Bitcoin can perform only 5 transactions per sec, while any financial bank can do more than 24000 transactions per sec.

Get the latest engineering blogs delivered straight to your inbox.
No spam. Only expert insights.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Did you like the blog? If yes, we're sure you'll also like to work with the people who write them - our best-in-class engineering team.

We're looking for talented developers who are passionate about new emerging technologies. If that's you, get in touch with us.

Explore current openings

Blockchain 101: The Simplest Guide You Will Ever Read

Blockchain allows digital information to be distributed over multiple nodes in the network. It powers the backbone of bitcoin and cryptocurrency.

The concept of a distributed ledger found its use case beyond crypto and is now used in other infrastructure.

What is Blockchain?

Blockchain is a distributed ledger that powers bitcoin. Satoshi invented bitcoin, and blockchain was the key component. Blockchain is highly secured and works around a decentralized consensus algorithm where no one can own the control completely.

Let's divide the word blockchain into two parts: block and chain. A block is a set of transactions that happen over the network. The chain is where blocks are linked to each other in a way that the next block contains hash of the previous one. Even a small change in the previous block can change its hash and break the whole chain, making it difficult to tamper data.

Blockchain Example

Image source

Blockchain prerequisites:

These are some prerequisites that will help you understand the concepts better.

Public-key Cryptography- Used to claim the authenticity of the user. It involves a pair of public and private keys. The user creates a signature with the private key, and the network uses the public key of the user to validate that the content is untouched.

Digital Signatures:

Digital signatures employ asymmetric key cryptography.

  • Authentication: Digital signature makes the receiver believe that the data was created and sent by the claimed user.
  • Non-Repudiation: The sender cannot deny sending a message later on.
  • Integrity: This ensures that the message was not altered during the transfer.

Cryptographic hash functions:

  • One way function: This is a mathematical function that takes an input and transforms it into an output. There is no way to recover the message from the hash value.
  • No collision: No two or more messages can have the same hash(message digest). This ensures that no two account transactions can collide. 
  • Fixed hash length: Irrespective of the data size, this function returns the same hash length.

Why Blockchain?

There are a few problem statements that we can quickly solve using a distributed consensus system rather than a conventional centralized system.

Let me share some blockchain applications:

Consider an auction where people bet on artifacts, and the winner pays and takes out those artifacts. But if we try to implement the same auction over the internet, there would be trust issues. What if one wins the bet saying 10000$ and at the time of payment, he doesn't respond.

We can handle such events easily using blockchain. During betting, a token amount will be deducted from an account and will be stored in the smart contract (business logic code deployed on Ethereum). Bid transactions use a private key to sign transactions, so this way, one can not revert by saying that those transactions never happened.

Another simple but amazing solution we can develop using Ethereum is online games like tic-tac-toe, where both players will deposit `X` amount in the smart contract. Each move done by a player gets recorded on blockchain (each movement will be digitally signed), and smart contract logic will verify a player's move every time. In the end, the smart contract will decide the winner. And the winner can claim his reward.

- No one controls your game

- There is no way one can cheat 

- No frauds, the winner always gets a reward.

Bitcoin is the biggest and most well-known implementation of blockchain technology.

The list of applications based on distributed consensus systems goes on.

Note: Ethereum smart contract is the code that is deployed over Ethereum blockchain. It is written as a transaction on the block so no one can alter the logic. This is also known as Code is Law.

Check out some of the smart contract examples.

Bitcoin is the base and ideal implementation for all other cryptocurrencies. Let's dig deep into blockchain technology and cryptocurrency.

Let’s reinvent Bitcoin:

  • Bitcoin is distributed ledger technology where the ledger is a set of transactions
  • No single entity controls the system
  • High level of trust 

We have to design our bitcoin to meet above requirements.

1) Consider that bitcoin is just a string that we will send from one node to the other. Here, the string is: “I, Alice, am giving Bob one bitcoin.” It shows Alice is sending Bob one bitcoin.

One node sending Bitcoin to another


2) Sam uses the fake identity of Alice and sends bitcoin on her behalf.

A node is using fake identity during transaction


3) We can solve this fake identity problem using Digital signature. Sam can not use a fake identity.

Digital signature solves fake identity problem

But there is still one problem, double spending. This occurs when Alice sends one transaction multiple times. It's difficult to check if Alice wants to send multiple bitcoins or just retrying transactions due to high network latency or any other issue.

4) But a simple solution is to add a unique transaction ID to each transaction.

Unique transaction id to handle double spending problem

5) It’s time to add more complexity to our system. Let's check how we can validate the transaction between Alice and Bob.

In cryptocurrency, every node knows everything (nodes are the systems where blockchain clients are installed, like Geth for Ethereum).

Validate all transactions between two nodes


Every node maintains a local ledger containing whole blockchain data. Here, Alice, Sam, and Bob know how much bitcoins everyone has. This helps validate all transactions happening over the network.

As Bob receives an event from Alice containing a bitcoin transaction. He checks the local copy of the blockchain and verifies if Alice owns that one bitcoin that she wants to send. If Bob finds out that the transaction is valid, he broadcasts that to all networks and waits for others to confirm. Other peers also check their local copy and acknowledge the transaction. If maximum peers confirm the transaction valid then that transaction gets added to the blockchain. And everyone will update their copy of ledger now, and Alice has one less bitcoin.

Note: In actual cryptocurrency, validation occurs at a block-level rather than validating one transaction. Bob will validate a set of transactions and creates one block from it and will broadcast that transaction over the network to validate.

6) Still, there is one problem with this approach. Here, we are using Bob as a validator. But what if he is a fraud. He might say that transaction is valid even if its invalid, and he has thousands of automated bots to support him. This way the whole blockchain will follow bots and accept the invalid transaction (Majority wins).

Double spending use case

In this example, Alice has one bitcoin. Still, she creates two transactions: one to Bob and another to Sam. Alice waits for the network to accept the transaction to Bob. Now Alice has 0 bitcoins. If Alice validates her own transaction to Sam and says it's valid (Alice has no bitcoin left to spend), and she has a large number of bots to support her, then eventually the whole network will accept that transaction, and Alice will double spend the bitcoin.

7) We can solve this problem with the POW (Proof of Work) consensus algorithm.

Proof of Work consensus algorithm

This is a puzzle that one has to solve while validating the transactions present in the block.

Here you can see that the block has a size of around 1MB. So, you need to append any random number to the block and calculate hash, so that the hash value will have a starting string of zeros as shown in the image.

Blockchain decides this number, and then the next block miner has to calculate a random number so that hash has that many zeros in the beginning. To solve this puzzle, the miner has to try Peta combinations to get the answer. As this is a very complex process, miners get rewarded after the validation of the block.

But how can we solve the above problem using mining?

Suppose the blockchain network has 10,000 active mining nodes with the same computational power. The probability that one can mine is only 0.01%. If one wants to do fraud transactions, he should have huge mining power to validate the block and convince other nodes to accept the invalid block. To do this, one needs to own more than 50% of computational power, that is very difficult. 

Now we have a prototype cryptocurrency model ready with us.

Note: Each blockchain node follows the majority. Even if a transaction is invalid, but with more than 51% of nodes say it's valid, the whole network will be convinced and go rogue. This means that any group owns 51% of computational power(hash power), controls the whole blockchain network. This is known as a 51% attack.

Blockchain-based services:

  • Golem: Distributed computing platform.
  • Iexec: Distributed computing platform.
  • Sia distributed storage: Distributed storage, SLA is managed over the blockchain.
  • Ethrise: Insurance platform developed on Ethereum ecosystem.
  • Maecenas: Blockchain-based Auction of file arts.
  • More than 2000 cryptocurrency platforms.

Disadvantages of Blockchain:

There are a few limitations to blockchain-based solutions.

  • Crime: Due to its encryption and anonymous nature, blockchain solutions influence crimes.
  • Data size: Full nodes stores all transactional data and requires over 100 GB disk space.
  • Throughput: Blockchain systems are very slow.

Bitcoin can perform only 5 transactions per sec, while any financial bank can do more than 24000 transactions per sec.

Did you like the blog? If yes, we're sure you'll also like to work with the people who write them - our best-in-class engineering team.

We're looking for talented developers who are passionate about new emerging technologies. If that's you, get in touch with us.

Explore current openings