How does the Blockchain work?
Any idea about Blockchain?
Well,
Let's see first, what Blockchain is! and then we will discuss how it works.
Blockchain is a chain of data blocks stored in hundred or thousands or even millions of computers (servers) distributed over a wide geographical area. It is a complete ledger that maintains a copy of all the credit/debit transactions of digital assets. It is based on decentralized technologies.
Eg. Bitcoin is a great example of a blockchain application or we can say it works on decentralized principle. That means when a new Node(server) is added to the bitcoin network, it is impossible to modify or delete that node. It works on a Peer-to-Peer(P2P) network, where each Peer acts as a server.
This diagram describes how a P2P network is established in a blockchain network.
I'm pretty sure, now you have got an idea about blockchain and P2P networks.
Great!
Now, let's see how blockchain works.
Excited?
Me too!
We can define the blockchain as a system that allows the group of connected computers to maintain a single updated and secured ledger. As we know blockchain is consists of a chain of blocks, for every new transaction, a new block needs to create.
So, how a block(node) is created inside the blockchain network?
The very first step of creating a block is, a user must request for a transaction to be added to the blockchain network, also that transaction must include some required information(like transaction id, hash id, timestamp, etc).
After the transaction is verified, the second step is, a new block is created into the blockchain network(but not added).
Once a block is created, then it will broadcast to a P2P(Peer-to-Peer) network. P2P networks also consist of blocks(nodes). Then, the one P2P node verifies the transaction.
After successfully verifying, the transaction again moves to the next stage, that is, other nodes in that network also need to verify, since all nodes are interlinked with each other.
and here comes to the last stage, that is
Once the transaction is validated by other nodes in the network, then the block is ready to go. And now, the block(transaction) is added to the existing blockchain network.
That is how the blockchain works.
I know it is kind of a bit confusing if you are new to blockchain. But trust me, once you understand it, it will be fun for you.
Like me :) haha
Cool!
Thanks for reading my article.
See you soon with a new topic!
Till then, drink coffee and write code