Blockchain has proven to be a revolutionary technology, transforming various industries. In its literal sense, it means a chain of blocks. With blockchain, digital information, such as financial transactions, are stored in separate blocks in a chain. Robust cryptographic methods protect the transactions, and a consensus algorithm maintains the network status, enabling transparency. This blog provides a detailed look at how blockchain works.
Learn Online software programs from the World’s top Universities. Earn Executive PG Programs, Advanced Certificate Programs or Masters Programs to fast-track your career.
Understanding How Blockchain Works
For this blog and a simplified explanation of how blockchain works, here is an example of a transaction over a blockchain network. Suppose a user, say, John, wants to send a few bitcoins to his friend Amy. This transaction is broadcasted as a digital message. It has a digital signature assigned to it. This digital signature validates the transaction as genuine.
Next, this transaction is broadcast to a peer to peer network. The network’s first node receives it. The transaction is then verified and passed on to the next bitcoin node on the network. Every node carries out the verification process on the network before the transaction is completed. This ensures that only valid transactions pass through the system.
Each node creates a confirmed (mempool) pool and non-confirmed transactions (transactional) pool and propagates the transaction forward. The transaction then reaches a mining node. This node collects, validates, and propagates a new transaction. The miner node, then, aggregates the transactions into a candidate block.
Blockchain and Mining Nodes
To better understand how blockchain works concerning mining/miner nodes, suppose another user, Michael, works as a miner(mining node) in this transaction. Michael first collects all the transactions in a block and then constructs a block header. The mining node fills in six fields: Version, Previous Block Hash, Merkel Root, Timestamp, Difficult Target, and Nonce, to construct a block header. Once all these fields are filled, block mining can be started. Here is a look at each field:
- Version: Size 4 bytes – Displays the version of the block.
- Previous Block Hash: Size 32 bytes – It references a hash of the chain’s last block.
- Merkel Root: Size 32 bytes – It is a hash of the Merkel Tree’s root of the block transaction.
- Timestamp: Size 4 bytes – It shows the approximate time taken to create the block.
- Difficult Target: Size 4 bytes – The proof of work algorithm difficulty target of the block.
- Nonce: Size 4 bytes – It is used as a counter for the proof of work algorithm.
With the block header now complete, the block mining process starts. Mining aims to find a value for the nonce. Billions and trillions of nonce values need to be tested before a nonce that satisfies the requirement is found.
The next step is to find a solution to the proof of work algorithm that makes the block valid. Proof of work is a piece of data that satisfies the transaction requirements and is easily verifiable by others. Michael’s mining node has to reach the difficulty target to validate the block. The block contains difficulty targets in a notation called ‘difficulty bits.’
Successfully Mining a Block
Next in the line of how blockchain works are the successful mining of a block. Michael has various computing devices that rapidly run the SHA-256 algorithm parallel to each other. The hardware receives the block header, and testing is started at trillions of nonces per second.
Once a mining machine finds a solution, it is sent back to the mining node, and the block is transferred to the peers immediately. A new block is validated and propagated, and it is verified by each full node independently. Once the new block is validated, it is assembled into a chain by connecting the block to the existing blockchain. After verification, it becomes a part of the blockchain. The process is carried out until the entire transaction is complete. Amy then receives the bitcoins from John.
This blog has hopefully helped you understand how blockchain works. To know more about the technology and take on a career path as a blockchain developer, you can enroll for upGrad’s Advanced certificate program in blockchain technology. It provides one-on-one mentorship and 200+ hours of learning content with zero-percent EMI options.
Is blockchain technology safe?
Considering the fact that the cryptocurrency runs on blockchain technology, it is only fair to ask whether the foundation on which our money rests is prone to risks? The major safety feature of blockchain technology is called decentralization. In simple terms, the information is stored in several network nodes. If someone tries to hack into the database at one node, the other nodes will cross-check with each other and if there is a mismatch, it can be singled out fairly easily and appropriate actions can be taken.
Is Cryptocurrency the only use-case for blockchain technology?
Cryptocurrency is one of the many use-cases of blockchain technology. This technology is widely getting popular among other industries like real estate, food-ordering, insurance, healthcare, NFTs, etc. It can be used to record anything from house deeds, votes in elections, transactions of a store, etc. The fact that storing data in blockchain ensures transparency and is easily traceable, is one of the major reasons that blockchain is getting adopted by different companies such as Pfizer, HUL among others.
What is the difference between public and private blockchains?
Public blockchains are permissionless blockchains, which means anyone can join the blockchain network. This is different from that of private or permissioned blockchain in the sense that permissioned blockchains have restricted access and rights to certain nodes where the users know the identities of each other. They are more efficient as compared to permissionless ones as there is less processing time due to the fewer nodes on the blockchain but at the same time centralization of the blockchains makes them more prone to hacking and related illegal activities.