BlockChain 101 - Part 2
Hi friends, I know that this post has been long overdue since my last article on BlockChain 101 - Part 1 (https://www.dhirubhai.net/pulse/blockchain-101-part-1-wesley-tan/?trackingId=nXKDDsPlSdypmdv4xo1Eyw%3D%3D). My sincere apologies as I had been busy in building new exciting payment products over the past 1 year with dtcpay (check my posts on these products)! The topic for this article will be on one of the fundamental design of blockchain i.e. Consensus Mechanism i.e. PoW & PoS. The following information have been complied with my own research for ease and accuracy.
What Is a Consensus Mechanism?
A consensus mechanism is the programming and process used in blockchain systems to achieve distributed agreement about the ledger's state or the state of a data set. Cryptocurrencies, blockchains, and distributed ledgers benefit from their use because consensus mechanisms replace much slower and sometimes inaccurate or untrustworthy human verifiers and auditors.
What Is Proof of Work (PoW)?
Proof of work (PoW) is a blockchain consensus mechanism that requires significant computing effort from a network of devices. The concept was adapted from digital tokens by Hal Finney in 2004 through the idea of "reusable proof of work" using the 160-bit secure hash algorithm 1 (SHA-1). To summarise:
What Is Proof-of-Stake (PoS)?
Proof-of-stake (PoS) is a blockchain consensus mechanism for processing transactions and creating new blocks. With Proof of Stake, the rules are simple: some people (Validators) are selected to check and confirm blockchain transactions. If they follow the rules, they’re rewarded. If they don’t follow the rules, they’re penalized. To summarise:
How does PoW works?
PoW is provided by sending the information in a block through a hashing algorithm, then adjusting variable fields until a hexadecimal number is reached that has a lower value than the network's?difficulty target. This serves as proof that the program expended the computational effort to "hash" the block until a solution was reached. As an example to illustrate the process: First, the worker, which is called a miner, creates a temporary file (a block). If it wins the competition to solve for a winning hash, this file will be stored on the blockchain. The block has the four following fields:
The block header contains the following fields:
领英推荐
The mining program assembles this block and places the transactions it has prioritized in the transaction field. It continuously adjusts the?nonce?and the extra nonce and sends the information in the block through a hashing algorithm. It repeats this process until it finds a solution, which is a value less than or equal to the difficulty target. The difficulty target is set so that a certain number of hashes per second must be attempted before a solution is found. For example, on May 17, 2024, block 843,900 had a difficulty target of 83.148T, or 83.148 trillion attempts per second per miner.
The winning?hash?for that block was: 000000000000000000033028b3c8296ed776653032030cd01290f4345f5a9b6e. This hash provided proof to the network that the miner did the work. The block was added to the blockchain, and the network began its process of reaching consensus.
How does PoS works?
In a proof of stake system, staking serves a similar function to proof of work’s mining, in that it’s the process by which a network participant gets selected to add the latest batch of transactions to the blockchain and earn some crypto in exchange.?
The exact details vary by project, but in general proof of stake blockchains employ a network of “validators” who contribute —?or “stake” —?their? own crypto in exchange for a chance of getting to validate new transaction, update the blockchain, and earn a reward.?
Becoming a validator is a major responsibility and requires a fairly high level of technical knowledge. The minimum amount of crypto that validators are required to stake is often relatively high (for ETH2, for example, it’s 32 ETH) and validators can lose some of their stake via a process called slashing if their node goes offline or if they validate a “bad” block of transactions.
But even if that sounds like too much responsibility, you can still participate in staking by joining a staking pool run by someone else —?and earn rewards for crypto that would otherwise be sitting around. This process is often referred to as delegating, and tools offered by exchanges by Coinbase can make it simple and seamless.
PoW VS PoS
Both consensus mechanisms help blockchains synchronize data, validate information, and process transactions. Each method has proven successful at maintaining a blockchain, although each has pros and cons. However, the two algorithms have very different approaches as summarised below:
Final Thoughts
Consensus mechanisms have become an essential aspect of distributed ledgers, databases, and blockchains because much of the world is becoming more digital. Ownership of physical assets is being tokenized on ledgers and blockchains, people without access to financial services access through blockchains, and businesses need data security more than ever.
Consensus mechanisms verify data inputs and outputs, which translates to automatically auditing the digital transactions that are common today - without human oversight or intervention. They create an environment where you don't need to trust that the other party in a transaction is honest because it ensures the information is unalterable and secure.