Consensus protocols are used to verify and validate transactions. There are different kinds of consensus protocols and their different ways for the verification and validation of the transactions.
In Proof-of-work, miners will share their computing power and solve a mathematical equation to add a new block of a transaction. The first miner to solve the mathematical equation will add the block in the existing blockchain. The miner will be rewarded with validated tokens.
An American computer scientist called Cynthia Dwork and an Israeli computer scientist called Moni Naor invented the concept of PoW. The concept was presented in a journal article in the year 1993. The current Chief Scientist at Agari called Markus Jakobsson and a researcher called Ari Juels both coined and formalized PoW in a paper in the year 1999 for the first time.
PoW is based upon SHA-256. The National Security Agency is a US-based intelligence agency who has designed cryptographic hash functions like SHA or SHA-0, SHA1, and SHA2. While the National Institute of Standards and Technology (NIST) is a physical sciences laboratory published SHA or SHA-0 in 1993, SHA-1 was published in 1995, and SHA-2 in 2001 as a US-based Federal Information Processing Standard. SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224, and SHA-512/256 are the six hash functions of the SHA-2 family. SHA or SHA-0 is known as a predecessor of SHA1 while SHA-1 is known as a predecessor SHA-2. SHA-3 is designed by Guido Bertoni, Joan Daemen, Michaël Peeters, and Gilles Van Assche. It was published in 2015 by NIST. SHA-2 is known as a predecessor of SHA-2. The main purpose of SHA-256 is to generate a fixed size 256-bit (32-byte) hash.
Cryptographic Hash Function
A hash function which is used in cryptography called as a cryptographic hash function. A cryptographic hash function is a basic tool of modern cryptography. It is a mathematical equation which converts data of arbitrary size into a bit string of a fixed size. Hash, hash value and the message digest are the names of the bit string. The cryptographic hash function has multiple information security applications in a mathematical scheme called digital signature and a tag called message authentication code (MAC). The mathematical scheme digital signature is used for verifying the authenticity of digital messages. The tag MAC is a short piece of information used for the authentication of messages.
The properties of an ideal cryptographic hash function are:
- The same message will be the same hash
- The hash for any kinds of messages will be computed instantly
- The same hash will not be generated for two different messages
- The new hash will be generated if a message is changed slightly. The new hash will be different from the old hash.
Mining of a cryptocurrency depends upon how much amounts a person has.
If the person has 3% of the cryptocurrency, then he can mine only 3% of a block. Peercoin (PPC) is the first cryptocurrency to adopt PoS. NXT (NXT), Blackcoin (BLK), and ShadowCoin (SDC) adopt PoS later on. When Alice sends a cryptocurrency to Bob. A block of this transaction data will be created. The block will be distributed to every miner or node on the network. Miners will try to solve a mathematical equation. The block will be added to the existing blockchain if the mathematical equation is solved. The first miner will be rewarded with validated tokens.
The main purpose of creating PoS was to tackle inherent issues in PoW. Computing power is required immensely to mine cryptocurrency. Most miners convert their rewards into fiat currencies to pay their electricity bill. This thing makes falls in the price of a cryptocurrency. Mining power is distributed to cryptocurrency amounts which miners have.
More issues to solve in PoW:
- PoW can face Tragedy of Commons in the future. No block rewards from mining can reduce Bitcoin miners.
- Fees earning will be done through transaction fees. It will also be reduced due to lower fees which users like to pay for their transactions.
- The network will be more vulnerable due to a few Bitcoin miners. If a miner or mining pool controls a 51% consensus, then he will be able to create a fraudulent block.
An attacker will face difficulties to accumulate 51% of a cryptocurrency in PoS. Accumulating 51% of the cryptocurrency is not only difficult, but it is expensive also. A miner with 51% of a cryptocurrency is likely to show the least interest to attack the network because he has a majority stake. A majority stake owner will try to maintain a secure network because falls in the value of a cryptocurrency lead to falls in the value of his holding.
Delegated Proof-of-Stake (DPoS)
The creator of DPOS (Delegated Proof of Stake Algorithm) a software programmer and cryptocurrency entrepreneur called Daniel Larimer.
Coin holders elect witnesses or delegates. The main purpose of the witnesses is to generate and add blocks. The witnesses will have to perform to the highest level, otherwise, they can lose their position because the voting for witnesses is a continuous process. One vote per witness will be accepted from each coin holder. Witnesses with the majority votes will be elected.
An elected group of witnesses faces replacement at a fixed time. They can be replaced once a day or once a week. This is done to give a turn to each witness to generate and add a block. If a witness is skipped, then failure to generate and add a block at the given time will be the result. BitShares, Lisk (LSK), EOS (EOS), Steem (STEEM), Ark (ARK), Nano (NANO), Cardano (ADA), and Tezos (XTZ).
Witnesses are responsible to maintain the network. Changes are proposed by witnesses in the network. The changes can be related to block sizes, transaction fees, and the amount that witnesses should be paid. When the changes are submitted, then coin holders will take decisions on the implementation of the changes.
A specific time schedule is required to add a new block in DPoS. Intense competition for adding a new block becomes impractical due to the specific time schedule. DPoS doesn’t require ASICs to solve mathematical equations. Coin holders will elect an unlimited number of individual validators until achieving a sufficient decentralization.
A large amount of energy is required to add a new block in PoW. PoW requires ASICs to solve mathematical equations. The miner with ASICs will have a higher chance of finding a valid block.
A network can’t have more numbers of validators in reality. If a network has more numbers of validators, then it will be slow down.
In Proof-of-Capacity (PoC), mining devices use their available hard drive space to decide the mining rights. Computing powers of mining devices and stakes of miners are not used. It has a lower adoption rate. Burstcoin (BURST) uses proof of capacity.
High energy is consumed in Proof-of-Work (PoW). PoC comes as a solution to the problem of high energy consumption. Crypto coin hoarding is promoted inherently by the problem instead of spending in Proof-of-Stake (PoS).
Miners try to change a number in the block header quickly with the objective to find a correct nonce. The first miner to find the correct nonce will inform other miners. The other miners move on working on the next block, but they validate and authenticate the transaction at the first. This shows a lottery system because miners change the hash continuously with the objective to find the nonce.
Mining devices are allowed to use the empty space of their hard drives to mine the available crypto coins. Miners no need to change numbers in block headers repeatedly in PoC. PoC stores a list of possible solutions on hard drives of mining devices, then a mining activity is started.
A larger hard drive can store a list of possible solutions in large numbers. A miner can have more chances with the larger hard drive to match the required hash value from his list of possible solutions and win mining rewards.
Plotting and mining are the two-step processes involved in PoC.
In the first step:
A hard drive is plotted. Repeated hashing of data creates a list of all possible nonce values. A miner account is created. 8192 hashes which are numbered from 0 to 8191 contained in each nonce. The hashes are paired into scoops.
Eg: 1. hash 0 and 1 constitute scoop 0
- hash 2 and 3 constitute scoop 1
In the second step:
Mining will be carried out. A miner will try to calculate a scoop number. If the miner starts the mining and a scoop number 38 is generated, then he will have to go to the scoop number 38 of nonce 1. Scoop data will be used for the calculation of a deadline value. The deadline for each nonce on the hard drive will be calculated through the repetition of the process. The miner has to select the minimum deadline from the calculation of all the deadlines. The duration of time in seconds is represented through a deadline. The last block is created before the creation of a new block. If a block was not created within this time, then a block could be created and block rewards could be claimed.
If a miner has a minimum deadline of 36 seconds and other miners didn’t create a block within the next 36 seconds, then the miner will be able to create a new block and gain rewards.
Android-based Mining is said to be more energy-efficient as compared to ASIC-based Mining. Miners can use Android-based systems for mining with PoC. Dedicated hardware and constant upgrading of hard drives are not required. Miners can wiped-off mining data. They can re-use their drives for other data storage purposes.
Proof-of-Activity (PoA) is a blockchain consensus algorithm used to ensure that transactions are genuine and users reach a consensus. It is a combination of PoW and PoS. Decred (DCR) is an autonomous cryptocurrency who use PoA.
PoW increases the difficulty in mining as time goes. Spamming and hacking on the network are prevented through PoW. A large amount of computing power is consumed in PoW. Power consumption costs are more. New-age mining hardware devices are used in PoW. They are expensive. If a miner validates transactions. This validation will depend upon his effective work contribution to the blockchain network.
PoS can be an alternative to PoW when the energy and hardware costs increase constantly. Mining of a cryptocurrency in PoS depends upon the amount of the cryptocurrency a miner holds. Reducing the electricity bills and using low-cost hardware in mining are purposes of PoS which it achieves. Crypto coin hoarding is promoted in PoS, but crypto coin spending is not promoted.
A 51% attack chance is prevented by PoW and PoS. A 51% attack is a hypothetical situation. An individual attacker or a group of attackers can gain a 51% consensus to create a fraudulent block. They will be able to control the network completely. New transactions can be halted from confirmation. Payments can be stopped between various blockchain users. A completed transaction can be reversed. Double-spending of crypto coins can be allowed.
PoA tries to bring the best of PoW and PoS.
How PoA works:
- The starting of a PoA mining process is just like a PoW mining process.
Miners in the blockchain network will try to solve a mathematical equation to mine a new block with more computing power. When the new block is mined, the system will be directed into PoS. The new block will contain a header and a reward address of the first miner.
- A new group of validators will be selected randomly to sign the new block. Validators with the huge amount of the cryptocurrency will sign the new block hugely. If the validators have 8% of the cryptocurrency, then he will sign 8% of the new block. If all the validators sign the new block, the status of a complete block will be received by the new block. The new block gets its recognition. It will be added to the existing network. The transaction will be recorded.
- If a few selected miners from the total selected miners are not present for signing the block for its completion, then the process will be shifted to a new random group of validators for the next winning block. If a group of selected miners is not received completely, then the process will be like this continuously. The miner and the various validators will receive rewards for their contributions in mining, signing, and adding a block.
PoA is criticized as it uses PoW and PoS partially. Block mining in PoA still requires too much power during the PoW phase. Coin holders with a huge amount can be selected on a list of signers and gain rewards during the PoS phase. An attacker controls a 51% consensus, but it will be impossible for attackers to predict who will be a group of random validators.