What is Proof of Work and How Does it Work?

AsyncLabs-logo
Async Labs
  • Date Published
  • Categories Blog
  • Reading Time 4-Minute Read

Proof by work is the most widely used method of consensus, and it actually refers to mining.

Almost everyone knows that Blockchain is a distributed decentralized network that provides privacy, security, immutability, and transparency. There is no central validation and transaction body, and every transaction in Blockchain is considered fully secured and verified. This is only possible due to a consensus protocol that is a fundamental part of any Blockchain network.

Consensus algorithms are a big topic in the blockchain industry. This algorithm’s central idea is to solve a complex mathematical puzzle and easily give out a solution. To reach consensus on the network, Bitcoin is using proof of work (PoW).

Let’s see the overview of the proof of work consensus algorithm and check its pros and cons.

How does proof of work actually work?

Proof by work is the most widely used method of consensus, and it actually refers to mining.

Miners keep the blockchain running by providing a vast amount of computing resources competing to solve a cryptographic puzzle. Upon solving the puzzle, they generate a block and get rewarded.

During the mining process, nodes compete mutually to ensure that the information contained in each block of transactions is accurate. Proof of work ensures that blocks can’t be added to the blockchain without executing the necessary work.

Two things need to be defined in this process: nonce and hash function.

A nonce is a random number that is used only once. In the case of Bitcoin, it can be any number between 0 and 4 294 967 296.

Hash is an algorithm or very complicated formula that converts any sequence of characters into a string of 64 chars or numbers.

In a blockchain, every block has its hash. That’s a string that someone got when verifying the block. If you want to verify the next block, you have to take that hash and add the current transactions block. The next step would be to take a nonce (random number). Add nonce to the end of that block of text. This text contains a hash of the previous block, a random number, and new transactions.

Now, you are ready to start calculations. To calculate, use the hash function, and change the random number until you get a string with a certain number of zeros in front of it.

The exciting thing about hash functions, such as SHA-256: If someone changes only one transaction for a small amount, everyone will know that it is not valid.

Imagine having an agreement with your employer. If the agreement is on the blockchain, no one can change its requirements and conditions you accepted. If someone changes anything, the hash string will be different, and everyone in the blockchain network will know that agreement is not valid.

Pros and cons of proof of work

The main advantage of proof of work is the amount of security it brings into the system and the protection from DDoS-attacks (Distributed Denial of Service). PoW algorithms offer objectivity; they are tested and straightforward and link the physical to the digital.

Although it is a great consensus algorithm, proof of work is not perfect. The major drawback is the vast waste of resources — electricity and computer power needed for its execution. Just imagine if some cryptocurrency, such as Bitcoin, goes to mainstream adoption. How much electricity would be required to operate and run this network?

Another problem is mining pools and centralization. Chances for a reward for someone who is mining with only one CPU are not so good. On the other hand, someone who has a mining pool with a thousand CPUs will have a much better opportunity.

Approximately 50% of Bitcoin hash power is coming from a few mining pools. That means that only a few people have to meet at the same desk to agree on a 51% attack and change the blockchain if they have a reason to do that. This may create centralized PoW, and it goes against the idea of decentralization. Another thing is that more than 70% of the mining power is coming from China. Because the cost of electric power is not the same in every country, pools are becoming centralized.

If you are interested in finding out more about this consensus algorithm, check out our article on proof of work.