Header Ads

How Proof of work Works ?

This is the most popular algorithm being used by currencies such as Bitcoin and Ethereum, each one with its own differences.
Before continuing, for the non-technical readers:
hash function is any function that can be used to map data of arbitrary size to data of fixed size¹.
If a hash function is secure, its output is indistinguishable from random.
Example:
keccak256("hello") = 1c8aff950685c2ed4bc3174f3472287b56d9517b9c948127319a09a7a36deac8
keccak256("hello1") = 57c65f1718e8297f4048beff2419e134656b7a856872b27ad77846e395f13ffe
In Proof of Work, in order for an actor to be elected as a leader and choose the next block to be added to the blockchain they have to find a solution to a particular mathematical problem.
Let that mathematical problem be:
Given data X, find a number n such as that the hash of n appended to X results is a number less than Y.
Example - hash is a hypothetical hash function that has the outputs listed as below
Y = 10, X = 'test'
hash(X) = hash('test') = 0x0f = 15 > 10
hash(X+1) = hash('test1') = 0xff = 255 > 10 
hash(X+2) = hash('test2') = 0x09 = 9 < 10 OK, Solved.
Given that the hash function used is cryptographically secure [1,2], the only way to find a solution to that problem is by bruteforce (trying all possible combinations). In other words, probabilistically speaking, the actor who will solve the aforementioned problem first the majority of the time is the one who has access to the most computing power. These actors are also called miners.
It has been widely successful primarily due to its following properties:
  1. It is hard to find a solution for that given problem
  2. When given a solution to that problem it is easy to verify that it is correct
Whenever a new block is mined, that miner gets rewarded with some currency (block reward, transaction fees) and thus are incentivized to keep mining. In Proof of Work, other nodes verify the validity of the block by checking that the hash of the data of the block is less than a preset number.
Due to the limited supply of computational power, miners are also incentivized not to cheat. Attacking the network would cost a lot because of the high cost of hardware, energy, and potential mining profits missed.
The picture illustrates very well how Bitcoin, and any other coin that uses Proof of Work, discourages malicious behavior.


Proof of Work provides the needed security and has been proven to work pretty well so far. However, it is very energy consuming:

Almost all African countries (separately) consume less electricity than the Bitcoin Mining industry
Powered by Blogger.