Have you ever heard of the term ‘blockchain’ but weren’t quite sure what it meant?Well, to put it simply, a blockchain is a decentralised database that stores a list of records, called blocks, which are secured and connected using cryptography. Now let’s learn about the working of the blockchain in simple steps:
Making a transaction smoother
The blockchain network receives a new transaction. A mix of public and private keys is used to encrypt the transaction’s information, including the quantity of tokens or assets being transferred and the sender and recipient’s identities. Only the parties participating in the transaction should have access to the appropriate keys to decrypt the information, hence the double encryption helps to protect the security and privacy of the transaction.
The transaction is broadcast to the network once it has been encrypted, where nodes receive it and verify it before adding it to the blockchain transaction. The transaction is broadcast to the network once it has been encrypted, where nodes receive it and verify it before adding it to the blockchain.
Transaction Verification
A new transaction is delivered to a network of computers connected to one another peer-to-peer (P2P) when it has been started. Together, these computers, which are dispersed across the globe, check the transaction’s legitimacy. To accomplish this, they verify that the transaction complies with all of the blockchain’s rules and regulations and that the sender has access to sufficient assets to complete the transfer. The nodes will include the transaction in the following block of transactions to be added to the blockchain if it is determined to be genuine. If the transaction is invalid, the network will reject it. This procedure aids in preserving the confidentiality and integrity of the blockchain, as all transactions must be verified before they can be recorded on the ledger.
Creation of a New Block
Multiple transactions are confirmed by numerous nodes in a blockchain network. When a transaction is judged to be valid, it is added to a temporary storage area known as the memory pool (mempool).
The mempool is made up of all the validated transactions at a given node. Multiple mempools from various nodes can be pooled to form a block and uploaded to the blockchain.
Consensus Algorithm
When a block of transactions is created, it needs to be added to the blockchain in order to be permanent. However, if any node can add blocks to the blockchain, it could cause problems with the network. To fix this, the nodes use a process called consensus to make sure that every node agrees on which block should be added to the blockchain.
The node that is chosen to add the block is called a “miner” and is rewarded for their work. The consensus process also creates a special code, called a hash, that is required to add the block to the blockchain. This helps ensure the security and integrity of the blockchain.
There are several different types of consensus algorithms, each with its own strengths and weaknesses. Here are the different methods:
Proof of Work (PoW)
This is the most well-known consensus algorithm, and it is employed by cryptocurrencies such as Bitcoin. In PoW, nodes compete to solve a computationally tough challenge, with the winner creating the next block on the blockchain. The solution is then verified by the other nodes, and if valid, the new block is added to the chain. One disadvantage of PoW is that it consumes a lot of energy to run because the nodes must do a huge number of calculations.
Proof of Stake (PoS)
The possibility of a node creating a new block in a PoS system is proportional to its stake, or the quantity of coins it owns. This means that the more coins a node holds, the more probable it is that a new block will be created. PoS systems use less energy than PoW systems since nodes do not have to do as many calculations. They are vulnerable to attacks, though, if a single entity holds a big number of the coins.
Proof of Burn (PoB)
Proof of Burn (PoB) is a consensus technique that requires nodes to demonstrate that they have burned, or destroyed, a particular quantity of tokens. PoB is based on the premise that nodes willing to destroy their own tokens are more likely to operate in the best interests of the network because they have “skin in the game.”
Nodes in a PoB system send their tokens to a “black hole” address where they cannot be recovered. The tokens are effectively burned, and they are no longer in circulation. The next block on the blockchain is created by the node that burns the most tokens.
PoB is similar to PoS in that the probability of a node creating a new block is proportional to the number of tokens burned. PoB, on the other hand, has the advantage of reducing the overall quantity of tokens, which can raise the value of the remaining tokens.
One possible disadvantage of PoB is that it is susceptible to “cheating,” in which a node manufactures and burns false tokens in order to boost its odds of creating a new block. To avoid this, some PoB systems employ a secondary proof, such as Proof of Work (PoW), to validate the legitimacy of burned tokens.
Proof of Capacity (PoC)
Proof of Capacity (PoC) is a sort of consensus mechanism that determines a node’s ability to create a new block on the blockchain based on its hard drive space rather than its processing capability. In a PoC system, nodes pre-allocate a portion of their hard drive space to store data known as “plot files,” which are used to determine their possibilities of creating a new block. The more hard drive space a node has set aside for plot files, the more likely it is to create a new block.
When a node wants to generate a new block, it gets its plot files and solves a mathematical problem with them. The new block is created by the first node that solves the block, and the remaining nodes verify the solution.
Delegated Proof Of Stake (DPoS)
In a DPoS system, nodes elect a set of “delegates” to act on their behalf and produce blocks. The delegates are chosen depending on the amount of votes cast by other nodes. Because only a few delegates are in charge of constructing new blocks, DPoS systems are quick and efficient. They are vulnerable to centralization, however, if a small group of delegates controls a considerable proportion of the votes.
Proof of Elapsed Time
Proof of elapsed time is a means of establishing that a particular amount of time has passed between two occurrences in a consensus algorithm. This is useful in distributed systems where several participants must agree on the sequence in which events occurred. Timestamps are one method for proving the elapsed time in a consensus mechanism. A timestamp is a record of the current date and time that is associated with data or a transaction. It is feasible to discern the order of events and verify that a particular amount of time has passed between them by comparing their timestamps. This can be used to prevent fraud and protect the integrity of the system.
New Block is added to the Blockchain
A block can be added to the blockchain after it has been authenticated through the consensus process and assigned a hash value. Each block contains the previous block’s hash, forming a cryptographic link between all the blocks in the chain. The new block is appended to the old blockchain.
Transaction is Complete
When a block is added to the blockchain, the transaction is considered complete, and the transaction information is permanently recorded in the blockchain. Anyone can view and verify this information.
Now let’s learn these steps through a simple example:
- Making a transaction smoother:- Alice wishes to transmit 10 ETH to Bob over the Ethereum network.
- Transaction Verification:- The message for verification is sent to all network nodes. The nodes examine the transaction’s key criteria, such as whether Alice has enough money (at least 10 ETH) to complete the transaction, if Alice and Bob are registered nodes, and whether the transaction complies with all applicable rules and regulations. If the transaction is verified, it is added to a pool of unconfirmed transactions.
- Creation of a new block:- A collection of validated transactions is compiled into a block, which is subsequently broadcast to the network.
- Consensus Algorithm:-The Ethereum network’s consensus algorithm is known as proof of work (similar to Bitcoin). This implies that miners compete to solve a complex mathematical problem, with the winner adding a new block to the blockchain and receiving a reward in ETH.
- New block is added to the blockchain:-Once a new block is uploaded to the blockchain, it becomes a permanent record that cannot be changed.
- Transaction is Complete:-The transaction is considered complete after the new block is uploaded to the blockchain, and the 10 ETH is moved from Alice’s wallet to Bob’s wallet. The transaction details are stored on the blockchain for all nodes to examine and verify.