Consensus algorithms are key in the deployment of a decentralized system. The smooth functioning of a blockchain system depends on the establishment of a fair and open consensus or majority. Hence the role of a consensus algorithm is to establish this majority and fend against dangers like a 51% attack. There are many consensus algorithms like Proof of Work(PoW), Proof of Stake(PoS), Proof of Capacity(PoC) and many more. Each algorithm has it's own advantages and disadvantages. Hence each algorithm has a particular use case where it outshines any other consensus algorithm. In this article, we will have a look at the Poof of Capacity(PoC) consensus algorithm. We will discuss its working, its advantages, disadvantages and its use cases.
Proof of Capacity is also known as Proof of Space algorithm. From its name, we can derive that it is dependent on space or memory of a computer. It is a unique and eco-friendly consensus algorithm. In PoC, the participants of a network allot the empty space in their hard drives to form a consensus. Hence, block validation is done using this free space, instead of using the processing power of a computer. This is achieved by solving the cryptographic problem before the block validation phase and storing the solutions on the hard drive. This is different from Proof of Work where numbers in the block headers are constantly changed and hashed for the solution in real-time and as soon as the solution is found, the block is validated and added to the universal ledger.
PoC algorithm can be divided into two parts, plotting and mining. In plotting, the nonce is calculated through repeated hashing of data and stored in the allocated memory space. The number of nonces that can be stored in the memory is directly proportional to the memory provided. The reason why nonces are precalculated is that PoC uses the Shabal hash. It is extremely difficult to compute a Shabal hash and depending on the hard drive size, it may take days or even weeks to fill it with valid nonces. Usually, one nonce contains 8192 hashes. These hashes are stored in pairs called a scoop. Every scoop is labelled from 0 to 4095.
In the mining stage of the algorithm, a scoop between 0 to 4095 is calculated. For example, if a scoop number 118 was calculated, then the data in scoop 118 of nonce 1 would be used to calculate an amount of time called deadline. This process will be repeated for scoop 118 of all the nonces stored in the hard drive. Out of all the deadlines calculated, the minimum deadline is picked. It represents the number of seconds that must elapse since the last block was forged before a miner is allowed to forge a block. If no one else has forged a block within this time, a miner can forge a block and claim a block reward. This is the mining stage of PoC.
Proof of Space is analogous to having all the possible answers to an exam, and guessing each one of them till the right answer is accepted!
So we can conclude that Proof of Capacity offers a fresh perspective at establishing consensus in a decentralized environment. It seems like an excellent choice for private blockchains where it is not feasible to invest in processing power to generate blocks. But because it is yet to be thoroughly tested against various types of attacks, we cannot say for sure whether it can be the ultimate consensus algorithm which can replace all others. It certainly is a right step in the direction of green and cost-effective algorithms.