This series wants to define the characteristics of consensus mechanisms and elaborate on the strengths and weaknesses of each. Proof of Work is the ideal first subject, being the consensus mechanism of Bitcoin, the original blockchain.
A note on nomenclature: throughout the site we refer to those who add transactions to the blockchain as “validators”, as we believe this to be the clearest indicator of their function for those new to the terminology of blockchain. Most consensus mechanisms have their own name for validators; in Proof of Work, that name is “miner”, as their are performing work to bring out nuggets of gold (the bitcoin and fees they receive as reward for their work).
I need to understand this STAT!
We got your back, here’s the rundown of how it works:
- To create a valid block, validators must compute a “hash” (an alphanumeric string) that has at least a certain number of zeros at the beginning. The number of zeroes is known as the “difficulty”.
- Finding a valid hash is very computationally intensive; this is the “work” in Proof of Work.
- When a valid hash has been found the validator broadcasts its solution. If the solution is the first to reach the majority of the network for that block, the validator receives a reward.
Proof of Work has its advantages over other consensus algorithms, in that it is the most battle-tested one and it favors reaching a consensus quickly, i.e. validators tend to converge on a single block as the “valid” one to build upon quite quickly.
There are also drawbacks to using Proof of Work, mainly that it’s very resource intensive and it tends toward centralization, which might not be desirable for your use case.
Through a humanitarian aid and development lens, PoW is extremely cumbersome. It’s costly to setup, costly to run, and costly to maintain, and for very little return – the security of a PoW blockchain from malicious actors is guaranteed by the amount of computational power spent validating blocks, so smaller chains are much more vulnerable.
If Proof of Work is the choice, the preferable solution is to rely on a public blockchain like Ethereum or Bitcoin instead, which have considerable hashing power behind them. If it isn’t the only choice, a permissioned blockchain (or other consensus algorithm) is going to be much more cost-effective.
Now, how does this work, in depth?
The process to reach a consensus in proof of work is very computationally intensive.
1. Collecting the data
The first action required for block creation is to decide what transactions should go into a block. These are usually the transactions that have the highest fee offered for the node that validates them.
After the transactions to be included in the block have been selected, a “nonce” is added. This is usually a number (an integer). Its purpose will become clear in the next step, but strictly speaking it is to add some randomness. 2. Forming the data
2. Hashing the data
With the whole of the data now being chosen, the node “hashes” it. A hash is the output of a hashing function, which is a process that takes some data as input, and produces a random, fixed-length string of alphanumeric characters as output.
This string is highly variable, as even marginally different sets of data will produce very different outputs (here is a nice website if you want to see what a hash looks like: https://anders.com/blockchain/hash.html), and it is also deterministic, i.e. the same input data will produce the same output; this is the reason why the nonce is added, so that even if two nodes try to validate the same set of transactions, there is still some randomness in the hashes they compute. Why is randomness needed? Because:
3. The hash is checked against the “difficulty”.
The algorithm to reach consensus has a certain “difficulty” that hashes need to satisfy, which is expressed by the number of zeros at the beginning of a hash, where more zeros mean a higher difficulty. This makes no sense until one reflects on the hashes themselves: since they have a fixed length, the number of hashes that start with one zero is naturally higher than the number of hashes starting with two zeros: all hashes with two zeros are also hashes that start with one zero, so the two groups have at minimum the same number of items; but in the first group, we also have hashes like 0x3a…, 01ts…, 0pr2…, and so the number of hashes with only one zero at the beginning is higher than the number of hashes with two. The same applies with higher numbers of zeros. Please note that this is a somewhat simplified version of what actually happens, but it is good enough to understand the concept).
A natural question that follows this process, then, is: if the hash is random, couldn’t I get a hash with the required number of zeros on the first try? And the answer to that is yes, but it’s not an issue. The difficulty is based on the _probability_ of getting a hash that satisfies the requirement. In an infinite pool of choices (the nonce is a number, and there are infinite numbers), the higher the difficulty the less probable it is for a set of data to result in a hash that satisfies the requirement.
Now, with our newly obtained hash, we simply check whether or not it’s good for our current difficulty, that is if the number of zeroes at the beginning of the hash is equal or higher to the difficulty currently required. If it is, we proceed and broadcast the solution to other nodes. Ifit isn’t, the process goes back to step 2, and we choose another nonce.
4. The rest
As with other consensus mechanisms, the node broadcasts its solution to all nodes, and at some point the “winning” block is chosen. The difficulty is also re-evaluated periodically, so that the speed at which new blocks are created is kept constant. If there’s a decrease in “block time” (how long it takes for a new block to be created), difficulty is scaled up; if there is a slowdown, difficulty is scaled down.
Advantages of Proof of Work consensus
It is currently the most battle-tested
Bitcoin was the first Proof of Work blockchain, and is currently the one with the biggest valuation. It is arguably the most appealing for attackers in terms of rewards, and has weathered a number of challenges to its security and stability. While in theory other mechanisms can be considered superior, they are at a disadvantage in the sense that they simply haven’t been in active use long enough to definitely prove it.
It favors reaching a consensus quickly
To optimize the process of consensus-forming, all distributed protocols must incentivize validators to work on a single chain, and at the same time punish those who work on multiple chains concurrently, because that has the potential to create a split history. Following two chains at the same time is very expensive with Proof of Work: it’s costly in a strictly economic sense, since it requires power to be dedicated to both chains, and in the sense of opportunity cost, as the resources dedicated to the alternative chain could have been used to bolster one’s chances of validating a new block in the original one. Additionally, all work done on the secondary chain is wasted as soon as a primary one is selected, a cost validators are keenly aware of.
Drawbacks of Proof of Work consensus
It is resource intensive
Block creation is based upon solving a computational puzzle, which directly translates into electrical consumption. Only one validator receives the reward for validating a block, however, and so the vast majority of these computations are, so to speak, “wasted” (quotes used because these computations secure the network, which is their purpose). The amount of this effort should not be underestimated – different sources pin it at different levels, but the amount reported is generally around 70 Terawatt-hours per year – at the same level of Algeria, a country with 40 million inhabitants. There are proposed solutions to this (described as “Useful Proof of Work”), but they are not implemented widely, most Proof of Work mechanisms still rely on random puzzles.
It tends toward centralisation
If there is value to be extracted, and bigger actors receive a comparatively bigger share of the value (because more computational power means a bigger chance to solve the puzzle first) (because more computational power means a bigger chance to solve the puzzle first), the extractors will tend to centralise. In the current class of Proof of Work blockchain, this is kept in check by a strong belief in decentralization, but the ideological drive is not intrinsic to the blockchain – it is simply a natural extension of the founding principles of Bitcoin, which begat the rest. Future implementations might lack this drive, and one could argue it isn’t even preventing consolidation to 51% in Bitcoin itself; unless checks and incentives are put in place there is a natural tendency towards clustering.
This is not necessarily bad, since as seen in Proof of Authority systems some centralization has its benefits, but in the context of Proof of Work, where much of the value found in the system is its resistance to censorship and double-spending (and is derived from the impossibility of a 51% attack, a state in which validators can both censor transactions and successfully double-spend), centralization considered a risk.
Variants of Proof of Work
Useful Proof of Work
This consensus algorithm is a variation on normal Proof of Work, tasking validators with solving mathematical problems that contribute to the public good instead of just computing hashes – e.g calculating chains of prime numbers (Primecoin).
Building such systems is a challenge in and of itself, however – the problem to be solved must be formulated as a mathematical function, and its result must be easily verifiable, otherwise it’s trivial to fake results. Moreover, there might be issues even after defining a “good” problem: taking Primecoin as an example, the real-world usefulness of its chains of prime numbers is itself disputed.
Another option is to decouple the solution to the problem from the validation of blocks: part of the network’s computational power is devoted to hashing, and another part of it is dedicated to a certain objective, like contributing to @Home projects, which use computing power offered by volunteers (home desktops, laptops, universities – anybody is welcome) to help with research projects. CureCoin and GridCoin are a type of this, although GridCoin also uses Proof of Stake, and CureCoin has announced plans to move to Proof of Stake too.
In closing, Useful Proof of Work shows some potential, as widespread adoption would have important side effects such as increasing the efficiency of hardware, which did happen with Bitcoin: in the case of calculating primes, even if Primecoin’s chains were absolutely worthless as a scientific tool, increases in hardware efficiency would have far-reaching repercussions. Useful Proof of Work, however, has not to date seen widespread adoption.
Is it a good fit for humanitarian action and development?
For every consensus mechanism the answer is “it depends”, but for Proof of Work it will be “no” more often than not. A mature Proof of Work network, one that cannot be overtaken by a malicious actor, requires capital and a good amount of technological infrastructure; it might be worth the investment for particularly high-value projects that cannot be created as a permissioned network (i.e. projects in which only selected validators can create blocks), otherwise the investment necessary to secure the system makes no financial sense.
For a resource-poor context, Proof of Work is going to be a suboptimal choice in the overwhelming majority of situations, and it is always worthwhile considering alternatives that are not blockchain but better adapted to needs (e.g. ). If blockchain is the best approach, however, the most secure course of action is relying on an existing and established Proof of Work chain like Bitcoin or Ethereum: the computing power invested in their security dwarfs what any single organization might sustain, and even most governments (though not all!) that attempt to censor that information will have quite a challenge on their hands. This comes with the caveat that any information stored on those blockchains will be public, which might not be an appealing tradeoff.
Further reading (if you’re interested)
Papers, articles, and other written resources
- Proof of Stake versus Proof of Work: http://bitfury.com/content/5-white-papers-research/pos-vs-pow-1.0.2.pdf
- Bitcoin mining and its energy footprint: http://karlodwyer.com/publications/pdf/bitcoin_KJOD_2014.pdf
- What Proof of Stake is and why it matters: https://bitcoinmagazine.com/articles/what-proof-of-stake-is-and-why-it-matters-1377531463/
- Proof-of-Work system: https://en.wikipedia.org/wiki/Proof-of-work_system
- Bitcoin currency could have been destroyed by ‘51%’ attack: https://www.theguardian.com/technology/2014/jun/16/bitcoin-currency-destroyed-51-attack-ghash-io
- The Proof-of-Work Concept: http://nakamotoinstitute.org/mempool/the-proof-of-work-concept/
- Bitcoin mining is a waste of energy and harmful for ecology: https://en.bitcoin.it/wiki/Myths#Bitcoin_mining_is_a_waste_of_energy_and_harmful_for_ecology
- Primecoin: https://en.m.wikipedia.org/wiki/Primecoin
- CureCoin: https://curecoin.net
- GridCoin: https://www.gridcoin.us/
- Bitcoin energy consumption: https://digiconomist.net/bitcoin-energy-consumption
- Bitcoin hashrate distribution: https://blockchain.info/pools