Crypto Academy week 13- Homework Post for Professor @alphafx on Consensus Algorithm
Overview of Consensus algorithm
Consensus algorithms aim towards restoring the integrity of a system. Blockchain platforms functions in a decentralised manner and transactions are recorded in a distributed database. The integrity of the system needs to be maintained through a consensus as users do not trust each other. This is to ensure the security of a system and also avoid fraudulent activities like double-spending attacks on the system.
Consensus algorithm is used to maintain the integrity of a system through a sequence of well-implemented codes. Through a consensus algorithm, participants on a blockchain network reach an agreement in a distributed systems. Consensus algorithm is designed to be fault-tolerant thus guaranteeing that all parties involved in a system agree on a single truth.
There are different consensus algorithm used by different blockchain platforms as explained by professor @alphafx. The two most common ones are the Proof of Work(PoW) and Proof of Stake (PoS) consensus algorithm.
Blockchain platforms like Bitcoin the Proof of Work consensus algorithm for mining processes. In PoW, miners make use of extensive equipment to solve mathematical algorithms. PoW is capital intensive due to the high energy consumption required and the operating cost of the machines needed as in the case of Bitcoin. As the demand for Bitcoin increased, PoW mining became very difficult and much more expensive.
Proof of Stake consensus algorithm solves the setback of high energy consumption in PoW. In this system, miners have to be stakeholders of a particular cryptocurrency to take part in the settlement of transactions. PoS doesn't require hardware or massive consumption of electricity. All you need to do to participate in the mining services is to stake some of the cryptocurrency in a wallet.
Though PoS offer a better alternative to PoW, it also has its setback which is centralisation. We all know the aim of blockchain is decentralisation where every user has equal right in the system. But in PoW, users who have higher stakes have more power and control over the decisions that are made in the system.
For this reason, there is a need for a mining algorithm that consumes less power and at the same time offer decentralisation where users have equal right in decision making.
Proof of Capacity
Proof of Capacity (PoC) is an alternative to the challenges in PoW and PoS consensus algorithm. Proof of Capacity enables miners to take part in transaction verification by plotting hard drives with solutions to the mining problem. In the PoC system, solutions to previously generated blocks are stored in hard drives and this is used to fasten the verification of subsequent blocks. This system enables miners to have solutions before the mining begins.
Solutions to a particular block are complicated and it takes time. It takes an average of 1 to 4 minutes for block time. This is the reason why it's necessary to store the solutions ahead of time. A miner can increase his chances of winning a block reward by having more solutions stored in a hard drive. Because the higher the amount of solutions (plots) you store in your hard drive, the greater your chances of having the possible solution to the puzzle.
How Proof of Capacity Works
There are two processes involved in proof of capacity. This includes plotting and mining. Plotting is the first process in PoC that involves creating a plot file. Unlike the Bitcoin network that uses SHA-256, plotting uses a slower hash known as Shabal. Shabal hashes are slow and hard to calculate, this is why it is necessary to compute them and save them in a hard drive before the mining process. This process of computing and storing solutions in a hard drive is known as plotting
Plotting
During plotting, nonces are produced by repeated hashing of data from the plot file. The larger the size of your hard drive, the more nonces you can store. Each nonce contains 8292 hashes which are organized in pairs called scoops.
Mining the Hardware
This is the second process in proof of capacity mining. Here the scoop number is calculated between 0 to 4095. The data of the scoop number gotten from the calculation is used to calculate the deadline for all the nonces in the hard drive. After all the nonces have been calculated, the miner who submitted the minimum deadline is awarded the right to forge the related block and earn mining rewards. Deadline is the number of seconds that must elapse in the previous block before a new block is formed 1.
Burstcoin is the first cryptocurrency project to implement proof of capacity for verifying transactions. This consensus algorithm hasn't been adopted by many platforms though. Another cryptocurrency project that runs on a proof of capacity is Chia Network.
Advantages of Proof of Capacity
- PoC uses a regular hard drive for mining which is more cost-efficient than ASIC machines used in PoW.
- PoC aim at decentralizing mining making it possible for every participant to have equal right in the mining process. This is an issue in PoW where miners with more advanced computers have high chances of solving the puzzle. Similarly, in PoS, miners with a high amount of stake has a higher right in the decision making the mining process.
- There is no need for system or equipment update as hard drives can always store data.
- It saves cost as mining data on a hard drive can be easily erased and used again for another mining purpose.
- Using hardware drives is more energy-efficient than ASIC based mining used in PoW. This will also reduce the running cost of mining as ASIC miners pay huge amount of money for electricity.
Disadvantages of Proof of Capacity
- Malware in hard drives can disrupt mining activities as this is already an issue in Bitcoin mining.
- Arms race to produce a higher capacity of hard drives can be stirred up if PoC mining becomes widely adopted.
- The consensus algorithm hasn't been adopted by many platforms or developers. This will difficult to analyse the potential risk of this system.
- A lot of space is left redundant on the hard drive as data plotted on the drives is specifically for mining activities.
Proof of Capacity Vs Proof of Work
Overview | PoC | PoW |
---|---|---|
Participants nodes | Participants nodes are called miners | Participant nodes are called miners |
Mining capacity | Mining capacity depends on plotted drive | Mining capacity depends on computational power |
Mining reward | Miners receive block reward and transaction fees | Miners receive block reward |
Energy consumption | Lesser energy consumption | Massive energy consumption |
Algorithm | Shabal Hash | SHA-256, Ethash, scrypt |
Mode of transaction verification | Verify transaction by plotting solution of previous blocks on a hard drive | Verify transaction by solving a puzzle using ASIC machines and GPU's |
Block time | 1-4 minutes block time | Roughly 10 mins block time |
Result of mining | Mining produces new coins | Mining produces new coins |
Proof of Capacity vs Proof of Stake
Overview | PoC | PoS |
---|---|---|
Participant node | Participants nodes are called miners | Participant nodes are called validators or forgers |
Mining capacity | Mining capacity depends on plotted drive | Mining capacity depends on the amount of coin you hold |
Mining reward | Miners receive block reward and transaction fees | Miners receive transaction fees |
Energy consumption | Lesser energy consumption | lesser energy consumption |
Mode of verification | Verify transaction by plotting solution of previous blocks on a hard drive | Verify transaction by holding a coin |
Result of mining | Mining produces new coins | No new coin is produced |
In conclusion, consensus algorithms important roles in protecting the integrity of a blockchain platform. There are many consensus algorithms utilized by different blockchain platforms and this depends on the objective of the platform. Though proof of capacity aims at solving the challenges in proof of stake and proof of work, it also has its disadvantages which can limit its adoption by developers. Proof of capacity is yet to be adopted by developers and I hope to see more blockchain platforms run on it.
Thank you professor @alphafx for this amazing lecture.
Twitter Promotion
Well done, well organised too. See you next time
Task satisfactorily completed
Thanks for participating
Thank you professor @alphafx