- Proof of Work is the algorithm that powers various blockchains, like Bitcoin, Ethereum, Litecoin, and Monero.
- Miners solve complex mathematical puzzles using computer power to produce a “block” of transactions.
- When a block is produced, the miner is rewarded with the native cryptocurrency: bitcoin, ether, or litecoin, for example.
- Proof of work ensures that blocks are produced at a stable rate and are accurately verified.
Cryptocurrencies work on the principle of a blockchain, where blocks containing transactions are added to the chain to make transactions happen.
The issue is, the speed and validity of blocks must be kept in check. Proof of Work solves this issue, let’s check out how.
Blocks on the blockchain are quite powerful as they confirm the transaction of money between addresses. They also distribute new currency by issuing rewards to the block creator.
For these reasons, there are two important rules for block production.
- Blocks need to be verified some way, so that we know what order transactions happened, among other things.
- We need to control the speed at which blocks are added. If the speed is not controlled, block rewards are added to the network quickly and the worth of the currency plummets.
Bitcoin, for example, has a target block time of ten minutes. If blocks are created too fast, too much bitcoin will be given out to miners, thus flooding the market. Something has to keep that block time regulated.
Enter Proof Of Work
Proof of work solves both of our issues. It’s based on the idea that we include some data in the block that is hard to calculate, but easy to verify.
In most proof of work cryptocurrencies, this comes in the form of a cryptographic hash.
What is a Hash Function?
A hash function takes a message or piece of data and scrambles it into a long cryptographic, alphanumeric code.
But the smallest change to the message or data creates huge changes in the code.
The SHA1 hash of “Armin Davis” is:
But change the capital letters to lower-case…
The SHA1 hash of “armin davis” is:
The hashes are completely different and seemingly random.
But it’s not random. The same input data will always return the same hash. Meaning that we can easily verify that a given hash is right for a given block easily.
And, if we include the hash of the previous block in ours, we can prove order too.
What About the Timing Issue?
Hash algorithms are perfect for our verification problem but don’t fix the issue of timing on their own.
Hashes are designed to be fast to compute, very fast in fact. The time it took to calculate the above two hashes was less than one-hundredth of a second.
But we need to regulate the time, so blocks aren’t produced too quickly.
We have a simple solution to this: network difficulty.
Simply put, you can change how long it takes to create a block by making it harder to solve the cryptographic puzzle.
Usually, that means including a constraint that the hash must be below a specific number. And that that number is calculated at specific intervals.
Now miners have to hash their blocks many times, with each one taking up some time and lots of computer power. In order for the block creator to change the hash of their block, an additional bit of information is added to the block called the nonce.
A nonce is simply a number that can be modified as the block creator sees fit to change the output hash.
Each time a hash is calculated and does not meet the requirements of the network at that time, the nonce is incremented or otherwise changed and the hash re-calculated.
Often a miner will try a very large number of different nonces before they find one that will be accepted by the network. The total time all miners take to find a block should be somewhere around the block time (ten minutes for Bitcoin).
And if not, the difficulty is adjusted to keep the timing in line.
Not all Proof of Work Algorithms are the Same…
The hashing algorithm a cryptocurrency uses directly affects how difficulty will work, and what hardware you can run the mining software on.
To use Bitcoin as an example again; Bitcoin uses the algorithm SHA-256, which is an industry standard hashing algorithm used in many places.
If you’ve saved a password on a website, odds are it was hashed with Secure Hash Algorithm (SHA)-256 before it was stored. Using industry standard hashing algorithms means they are proven secure and worked on by massive communities.
However, using industry-standard algorithms is both a blessing and a curse.
A blessing because most hardware will be able to run your software. But a curse (depending on how you look at it) due to one word: ASICs.
ASIC (Application Specific Integrated Circuits) are mining hardware that gives your network a massive amount of mining power. That increases centralization due to price and power demands. The more ASICs you own or control, the more of the network you command.
Some other cryptocurrencies, like Monero, use their own hashing algorithm specifically designed for use in proof of work systems. These have the advantage that developers have complete control over what hardware the algorithm works on best.
Downsides to Proof of Work
There are a few downsides to Proof of Work when compared to other solutions.
First, Proof of Work requires a lot of computing power. And, the more mining power on the network, the higher the difficulty. Meaning that you very quickly run into a situation where those with the cash to buy hardware do. And when you have a lot of hardware, you tend to store all their hardware in one place, leading to centralization.
At worst, this could lead to a 51% attack, whereby one actor, or group of actors, control more than half of the network. If that happens, they could theoretically “double spend” the cryptocurrency on the network.
And second, that computing power needs a lot of electricity to run, and at the high end, miners go looking for the cheapest power possible. This means that miners start to congregate in cities or countries where the power is cheap, again leading to centralization.
Learned something new in this article? Subscribe to the Block Explorer newsletter to get exclusive crypto insights before they appear on the site.