cft
Become a CreatorSign inGet Started

A Brief Introduction to Blockchain

It's the buzzword!! Blockchain is not all about crypto. It's much more than that. Let's learn more about blockchain and what it actually is


user

Arun K C

3 months ago | 8 min read
Follow

brief-introduction-blockchain-s4lys

This article was originally published at Hashnode

Unless you have been living under a rock, you might have heard about "Blockchain". It's incredibly popular nowadays and the whole tech community is excited about it. Some are crazed over the concept, some ambivalent, and some oppose. Nevertheless to say the concept itself is revolutionary if it can be fast and efficient.

Personally, I believe this is a groundbreaking technology and it can bring wonders to the Web we know as of now. It's still in its infancy stage though, anyway, we gotta start somewhere!

Let's get into the article now.

How it all started

Surprisingly a blockchain-like idea was proposed long back in 1982 by a cryptographer named David Chaum in his dissertation "Computer Systems Established, Maintained, and Trusted by Mutually Suspicious Groups."

Further work on a cryptographically secured chain of blocks was described in 1991 by Stuart Haber and W. Scott Stornetta. They wanted to implement a system wherein document timestamps could not be tampered with.

The technology actually came into life when the first decentralized blockchain was conceptualized by a person (or group of people) known as Satoshi Nakamoto in 2008. It was non-other than the most famous cryptocurrency that we are all familiar with, Bitcoin. Slowly after that different chains were formed such as Ethereum, Polygon, Avalanche, etc.

The use of a blockchain confirms that each unit of value was transferred only once, and the ingenious mechanisms put forth by Satoshi Nakamoto solved the long-standing decentralized double-spending problem.

What is a blockchain?

A blockchain is a distributed decentralized immutable ledger or database open to anyone. As the name indicates, the blockchain is a chain of blocks that contains information. It's a growing list of records, called blocks, that are linked together using cryptography. Each block contains a cryptographic hash of the previous data, a timestamp, and the information.

The timestamp proves that the data existed when the block was published in order to get into its hash. As each block contains information about its previous block, they form a chain, with each additional block reinforcing the ones before it. Therefore, blockchains are resistant to modification of their data because once recorded, the data in any given block cannot be altered retroactively without altering all subsequent blocks.

How does a blockchain work?

Imagine three friends Alice, Bob, and Jack meet up for dinner. After their dinner's done Jack pays the bill. And all of them decide to split the expense amongst each other. Let's assume both Alice and Bob have a balance of 3 bitcoins each and Jack have 7 bitcoins.

First Alice sends 2 bitcoins to Jack. A record is created in the form of a block and the transaction details between them are permanently inscribed within the block. This transaction should be verified by the nodes through mathematical calculations and determines whether they are valid based on agreed-upon rules.

A number of nodes(miners) will be competing with each other to verify the transaction. Once consensus has been achieved by the fastest node, the transaction is considered verified and the block is added to the blockchain. And thus Jack receives the 2 bitcoins. The same process is done when Bob sends 2 bitcoins to Jack. These blocks are chained together thus forming a ledger.

So the steps are:

  • New transactions are broadcast to all nodes.
  • Each node collects new transactions into a block.
  • Each node works on solving difficult consensus methods for its block.
  • When a node solves the consensus method, it broadcasts the block to all nodes.
  • Nodes accept the block only if all transactions in it are valid and not already spent.
  • Nodes express their acceptance of the block by working on creating the next block in the chain, using the hash of the accepted block as the previous hash.

Blocks

A block in a blockchain consists of two main parts, the block header, and the block body

The block header consists of

  • Hash of the previous block
  • Root hash of the Merkle tree
  • Timestamp
  • The Nonce: It is the variable incremented by the proof of work. In this way, the miner guesses a valid hash, a hash that is smaller than the target.

The block body contains all transactions that are confirmed with the block.

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 / Merkle root, 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.

The Merkle Root summarizes all of the data in the related transactions and is stored in the block header (a block header is the unique identity of a particular block on a blockchain and is hashed by miners for rewards). It maintains the integrity of the data. If a single detail in any of the transactions or the order of the transactions changes, so does the Merkle Root. They are extremely robust and are at the heart of several peer-to-peer networks such as BitTorrent, Git, Bitcoin, Ethereum, etc.

Nodes

A blockchain network is managed autonomously through a peer-to-peer distributed network of computer nodes. Nodes are nothing but computers that are designated to keep a copy of the distributed ledger and serve as communication points that execute various essential network functions.

A blockchain node’s main purpose is to verify the validity of each succeeding batch of network transactions, called blocks. Each node has a unique identifier attached to its device that allows it to be distinguished from others in the network.

State management

As you know everything has a starting point. The point where it originated. Likewise, blockchain also has an initial state called Genesis state. Bitcoins genesis state happened in 2009 when the network was launched publically. And for Ethereum, it was in 2015. Every transaction on a blockchain modifies the global state that is replicated across all nodes.

As you know blocks are chained together in a cryptographically verifiable way so they are historically traceable. The current state of a blockchain can be recalculated at any point in time by starting from the genesis block and transitioning the state according to each block's information up until now.

Consensus methods

Naturally, the first question that pops into your mind might be "What the heck is consensus?". Let me explain. Consensus is nothing but mutual agreement. Let's take an example. You are going out for a film with your friends. If you propose a film and all of your friends agree, then consensus is achieved.

In regards to blockchain, the process is formalized, and reaching consensus means that at least 51% of the nodes on the network agree on the next global state of the network.

Currently, there are two main consensus methods/protocols

Proof-of-Work (PoW)

Both Bitcoin and Ethereum currently use proof-of-work (PoW) consensus protocol.

  • Block creation: Proof-of-work is done by miners, who compete to create new blocks full of processed transactions. The winner shares the new block with the rest of the network and earns some freshly minted ETH. The race is won by whosever computer can solve a math puzzle fastest – this produces the cryptographic link between the current block and the block that went before. Solving this puzzle is the work in "proof-of-work"
  • Security: The network is kept secure by the fact that you'd need 51% of the network's computing power to defraud the chain. This would require such huge investments in equipment and energy. You're likely to spend more than you'd gain!

Proof-of-Stake (PoS)

Ethereum is planning to switch to PoS soon. There are many other famous chains that are already using PoS such as Polygon, Avalanche, Polkadot, Solana, Tezos, etc.

  • Block creation: Proof-of-stake is done by validators who have staked ETH to participate in the system. A validator is chosen at random to create new blocks, share them with the network and earn rewards. Instead of needing to do intense computational work, you simply need to have staked your ETH in the network. This is what incentivizes healthy network behavior.
  • Security: A proof-of-stake system is kept secure by the fact that you'd need 51% of the total staked ETH to defraud the chain. And that your stake is slashed for malicious behavior.

Decentralization

By storing data in a peer-to-peer network of nodes, the blockchain is a decentralized network. This has significant benefits over the traditional approach of storing data in a centralized manner. There are significant examples of problems with centralization, some of them are :

  • Data breaches in centralized systems expose a lot of data
  • Centralized authorities can censor and shut down speech
  • Reliance on a central authority means upstream problems affect downstream consumers (e.g. AWS going down means most of the internet goes down with it)

On the other hand, decentralization brings about the opposite benefits.

  • No censorship as there is no single authority or middleman that can censor you
  • No downtime as the overall network is running across 1000's of nodes across the globe
  • Highly attack resistant making it infeasible to manipulate or destroy data

Peer-to-peer network

The underlying blockchain technology leverages the power of Peer-to-Peer (P2P) networks and provides a shared and trusted ledger of transactions. Peer-to-peer networks are defined as the group of devices that are connected together to create a network that is often known as peer to peer network(P2P) network.

The network, once formed, can be used to share files and store them as well. In any of the peer-to-peer networks, all the nodes generally have equal power and can use the same tasks. So essentially this network is what blockchain is using. So yea, it's not a new concept and most of you might have already used it unknowingly. Don't be surprised, it's BitTorrent.(Piracy!!! XD How many times have you used torrent? ) If you paid attention till this point, then it's not surprising to you because I already pointed it out in the Merkle tree section XD

Conclusion

If you read till now, well done!! This really was a long article, if you sticked together with me till this point then you are awesome! Seems you are really interested in this technology.

Now as this article came to an end you have a basic understanding of what a blockchain is, how it works, and it's core components.

Let's summarize :

  • A blockchain is a distributed decentralized immutable public ledger or database
  • It's a chain of blocks that contains information
  • A block contains two main parts, a header, and a body
  • Blockchain utilizes the Merkle tree as its data structure and it's a fundamental part of the blockchain
  • Nodes are the verifiers of the blockchain and each of them has a unique identifier that fundamentally distinguishes them from other devices in the network
  • In a blockchain, we are able to recalculate the current state with the information stored up in each block
  • Consensus methods are used to achieve mutual agreement - Proof of Work and Proof of Stake are the most famous ones
  • Blockchain is a peer to peer decentralized network

That's it for today folks!! Thanks for reading this long article. I hope it was a great read for you and you learned one or two from it. If you have any doubts or feedback shoot them away in the comments.

If you found this article helpful, please like and hit the follow button on the top right corner. Subscribe to my newsletter if you don't wanna miss any content!

Let's connect on Twitter

Upvote


user
Created by

Arun K C

Follow

Data Engineer by day Web3 Hacker by night

I'm a backend developer focused on data here to share my learning journey on Web3. I will help you in your developer journey.


people
Post

Upvote

Downvote

Comment

Bookmark

Share


Related Articles