After a ton of research, reading blogs and referring documentation, I've tried to summarize the concept of blockchain by giving an overview about what exactly it is, covering all the important foundational information one needs to get started with it.
So what is blockchain?
Well in simple words, itβs basically a distributed immutable digital ledger of transactions that is duplicated across the entire network of computer systems (nodes).
In terms of blockchain, a single transaction or record is called a block[]. Which holds all the information with respect to that transaction. Forming a chain of such blocks(transactions) is called a blockchain.
So Why should we study blockchain?
Because itβs the future, it eliminates the concept of centralized data and helps in the verification and traceability of multistep transactions. Building decentralized applications is the way, which are safer and more secure.
In short build a sense of trust in making a transaction. (I'll explain the concept of immutability further, but for now understand it this way that once a transaction has been made, nobody can alter it).
How does blockchain work?
It's an immutable ledger - All the nodes are connected in a distributed peer to peer system. So suppose, if an attacker tries to mutate the data of an existing block (change some information in a blockchain), it will be immediately corrected by other nodes connected to the network.
When a block is added or changed in a blockchain, a message is broadcast to all other nodes connected in the network. Each node match the consistency of the information with their blockchain, if something is wrong, the victim node is immediately notified and the state is corrected.
The concept of correcting an incorrect blockchain consist of majority of the nodes having same state from the one which is different, because it's present in a distributed immutable environment.
Diving deeper - Let's see how a single block looks in blockchain...
A block consists of -
- A Block number
- Data
- Previous hash
- Hash
Note: First block is called the genesis block.
The Algorithm used is SHA 256 which Encrypts the data into a 64 hexadecimal char of 4 bits each, which is equal to 256 bits.
And how the blocks are connected?
So, its something like Block1 -> Block2 -> Block3 -> Each block contains prev hash value of block and its own hash.
Note: Data cannot be decrypted once encrypted.
What is a distributed P2P network?
Thousands (even more) of node connected to each other in a network, where each node contains a copy of the blockchain. Whenever a node adds a transaction, it transmits a message to all the other nodes connected and everyone adds that transaction to their chain(if course they verify whether the transaction is valid or not, but we'll talk about it later), maintaining the consistency of the network.
The advantage of having a distributed p2p network is that it eliminates data tampering. Suppose Aβs data gets changed, it gets notified by all the other nodes connected to it about data tampering and since the majority of connected nodes have different data as compared to what A has now, it correct its mutated data and balances the integrity again. This scenario is also called the byzantine fault tolerance problem.
Consensus protocol - > which prevents attacks on blockchain and also validate each transaction addition.
POW(Proof of work) -> This is something which comes into play when a blockchain miner mines a particular transaction to add it into their blockchain. Miners have to solve a math problem and then a block is mined.
So suppose, a transaction is added to a blockchain in a node. When a miner solves a math problem and adds that transaction to the chain, they are rewarded, solving a problem and adding it into the blockchain is not at all an easy job, so they show their proof of work before adding the transaction to the blockchain and every other node runs an algorithm to verify that the added transaction is valid or not. Once verified, all the other nodes in the network add that block to their chains.
Curious question - What if two nodes add two transaction simultaneously? Which one will be added first?
So, if two nodes transact a two blocks simultaneously at the same time, then the entire network waits until one of the adjacent nodes or the main node(from where the initial transaction blocks were added) add one more block to them increasing their length. In such case the all the other nodes have to accept the that particular nodes added block and add it to their blockchain, discarding their initial node (which is also called the orphan node).
Thatβs why we follow a six-step confirmation approach to have a successful transaction.
Finally, I would like to conclude by emphasizing to research more about this technology which could revolutionize the concept of application security and transaction transparency. Not only this, blockchain has much more to offer, it can be an effective addition to some vital sectors like government, supply chain, healthcare, cyber security and many more...
Top comments (0)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.