In a Decentralized Finance ecosystem, the transactions are not restricted or controlled by the government. The entire concept of Decentralization is based on the peer-to-peer transfer of money without any intervention from a bank or financial institution. This is definitely a revolutionary concept. Proof-of-work and proof-of-stake are consensus mechanisms, or algorithms, that allow blockchains to operate securely.
These consensus mechanisms keep blockchains secure by allowing only genuine users to add new transactions. It is used to achieve agreement, trust, and security.
What is Proof of Work?
Proof of Work was introduced by Bitcoin as early as 2008. This mechanism is the backbone of peer-to-peer transactions in a secure manner without the need for a trusted third party.
As a reminder, a blockchain is a public ledger comprised of blocks of transactions for every cryptocurrency. Each block of transactions in a proof-of-work cryptocurrency has a unique hash. A crypto miner must provide a target hash that is less than or equal to the block’s hash for the block to be confirmed.
Miners employ computing-intensive mining equipment to accomplish this. The first miner with the target hash updates the blockchain and collects the incentives. Finding the desired hash is challenging, but verifying it is straightforward, which is why proof of work in cryptocurrencies works well.
The whitepaper released by Bitcoin organisation in 2008 talked about PoW as below:
To implement a distributed timestamp server on a peer-to-peer basis, we will need to use a proof- of-work system similar to Adam Back’s Hashcash [6], rather than newspaper or Usenet posts. The proof-of-work involves scanning for a value that when hashed, such as with SHA-256, the hash begins with a number of zero bits. The average work required is exponential in the number of zero bits required and can be verified by executing a single hash.
For our timestamp network, we implement the proof-of-work by incrementing a nonce in the block until a value is found that gives the block’s hash the required zero bits. Once the CPU effort has been expended to make it satisfy the proof-of-work, the block cannot be changed without redoing the work. As later blocks are chained after it, the work to change the block would include redoing all the blocks after it.
The proof-of-work also solves the problem of determining representation in majority decision making. If the majority were based on one-IP-address-one-vote, it could be subverted by anyone able to allocate many IPs. Proof-of-work is essentially one-CPU-one-vote. The majority decision is represented by the longest chain, which has the greatest proof-of-work effort invested in it. If a majority of CPU power is controlled by honest nodes, the honest chain will grow the fastest and outpace any competing chains. To modify a past block, an attacker would have to redo the proof-of-work of the block and all blocks after it and then catch up with and surpass the work of the honest nodes. We will show later that the probability of a slower attacker catching up diminishes exponentially as subsequent blocks are added.
To compensate for increasing hardware speed and varying interest in running nodes over time, the proof-of-work difficulty is determined by a moving average targeting an average number of blocks per hour. If they’re generated too fast, the difficulty increases.
POW requires a significant amount of energy to verify transactions. Since it involves a lot of validators, It is less environmentally friendly than other systems.
What is Proof of Stake?
POS was created as an alternative to PoW, the original consensus mechanism used to validate a blockchain and add new blocks. In PoS, validators are chosen based on a set of rules depending on the ‘stake’ they have in the blockchain rather than having an arbitrary competition between miners to determine which node can add a block. The owners offer their coins as collateral for the chance to validate blocks. Coin owners with staked coins become “validators.”
POS reduces the amount of computational work needed to verify blocks and transactions that keep the blockchain, and hence it is more efficient and environmentally friendly than PoW.
POS was invented by Sunny King and Scott Nadal and was first implemented in Peercoin in 2012. It is also being used by cryptocurrencies like Cardano, Tezos, and Atmos with the goal of maximizing speed and efficiency and lowering fees.
While it sounds like PoS is a very efficient alternative to PoW, it is important to note that a significant amount of responsibility and technical expertise are needed to become a validator. If their node goes offline or if they validate a block of transactions that is deemed to be “bad,” validators may lose some of their stakes through a process known as slashing. The minimum amount of cryptocurrency that validators are required to stake is frequently quite high (for ETH2, for instance, it is 32 ETH).
In order to be able to be a validator, there are rules and regulations one needs to comply. Following are some of the rules defined by Peercoin:
There are a number of rules coded into the protocol to keep minters with a high coin age from being able to dominate the process of minting new blocks. Minters are first required to hold coins in their wallet for a total of 30 days before they can become eligible to compete in the process of minting new blocks.
Once a new block is minted, a transaction is automatically generated where the participating coins that were used to mint that block are sent back to the minter. Basically minters automatically send the coins being held back to themselves. This automated transaction back to the minter of the new block causes the age of the coins to be reset. It is an automatic and forced transaction to move the coins that were used to produce a block, which resets the number of days that those coins have been held back to zero.
The minter then needs to start from scratch and wait another 30 days in order to be eligible to participate in the minting process again. This helps avoid a situation in which a minter is able to consistently produce blocks one after the other over and over again. The mandatory coin age reset institutes a 30 day wait time which gives other stakeholders a better chance of minting blocks.
A third rule also states that a minter’s probability of finding a new block reaches its maximum after 90 days. So after this period of time a minter’s stake reaches maturity and their chances of minting a new block are maxed out. All of these rules are put in place in order to prevent minters with high coin age from being able to hold a monopoly on the block generation process.
Major differences between PoW and PoS
The first major difference is energy usage. In PoW, mining new coins and validating transactions in the process takes enormous amounts of energy. This is the reason why it has been banned by many countries. As the energy is primarily sourced from fossil fuels across the world, the resulting carbon footprint equals those generated by medium-sized countries. PoS is comparatively energy-efficient.
Secondly, heavy machinery, like computers with GPUs and hard drives, is used for the PoW consensus mechanism. To carry out these mining tasks, the computer must be highly efficient. PoS does not need any tools or equipment. Nonetheless, in PoS, a significant amount of responsibility and technical expertise are needed to become a validator. If their node goes offline or if they validate a block of transactions that are deemed to be “bad,” validators may lose some of their stakes.
Thirdly, PoS is much more efficient and scalable and thus used by major protocols to deliver various blockchain-based solutions. For example, PoS is being adopted by cryptocurrencies like Cardano, Tezos, and Atmos.