top of page

Proof of Work Explained

Updated: Jun 15, 2021

In this blog we cover the topic proof of work which is one of the most important blockchain consensus mechanism.

Proof of Work


What does Proof of Work (POW) mean?


​Proof of Work (commonly abbreviated as PoW) is a double-spend prevention mechanism. This is utilized by most major cryptocurrencies as their consensus algorithm. That's just what we call a method of securing the ledger of the cryptocurrency.


The first consensus algorithm to the surface was Proof

of Work and, to date, remains the dominant one. It was introduced in the 2008 Bitcoin white paper by Satoshi Nakamoto, but long before then, the technology itself was conceived.


HashCash by Adam Back is an early example of a Proof of Work algorithm in the days of pre-cryptocurrency. Receivers could mitigate spam by requiring senders to conduct a small amount of computing before sending an email. This calculation would cost a legitimate sender virtually nothing, but would quickly add up to someone sending emails en masse.

.


Understanding Proof of Work


As it works in the bitcoin network, this description will concentrate on proof of work. Bitcoin is a digital currency that is backed by a sort of distributed ledger known as a "blockchain." This ledger includes a sequential "blocks," record of all bitcoin transactions, such that no user is permitted to spend any of their holdings twice. The ledger is public or "distributed" to avoid tampering; an altered version will be easily rejected by other users.


In practice, the way that users detect tampering is through hashes, long strings of numbers that function as evidence of work. Put a given data set through a hash function (bitcoin uses SHA-256), and only one hash will ever be created. However, even a minor modification to any portion of the original data would result in a fully unrecognizable hash due to the "avalanche effect," The hash generated by a given function will be the same length, whatever the size of the original data set. The hash is a one-way function: it can not be used to retrieve the original data, only to verify that the original data is matched by the data that created the hash.


In practice, through hashes, long strings of numbers that serve as proof of work are the way users detect tampering. Via a hash function (bitcoin uses SHA-256), put a given data set, and only one hash will ever be generated. However, due to the "avalanche effect," even a small change to some portion of the original data will result in a completely unrecognizable hash. The hash created by a given function would be the same length, regardless of the original data set size. The hash is a one-way feature: it can not be used to recover the original data, it can only be used to check that the original data matches the hash-creating data.



Since only one hash can be created by a given set of data, how do miners make sure that they generate a hash below the target? By inserting an integer, called a nonce, they change the input ("number used once"). It is transmitted to the network until a correct hash is identified, and the block is added to the blockchain.


Mining is a method of competition, but it is more of a draw than a contest. On average, every ten minutes, someone will produce suitable proof of work, but who it will be is anyone's guess. In order to maximize their chances of mining blocks, miners pool together, which creates transaction fees and a reward for newly generated bitcoins for a limited period.


Proof of work renders it incredibly difficult to modify some part of the blockchain, as all subsequent blocks will need to be re-mined for such an alteration. It also makes it difficult to monopolize the computing resources of the network for a user or pool of users, because the machinery and power needed to complete the hash functions are costly.



How does PoW work?


We do not add transactions one by one—we lump them into blocks instead. We announce the network transactions, then they will be included in a candidate block by users creating a block. Only once their candidate block becomes a confirmed block will the transactions be considered valid, meaning that it has been added to the blockchain.


Appending a block is not inexpensive, though. Proof of Work requires that a miner (the user creating the block) uses up some of their own resources for the privilege. That resource is computing power, which is used until a solution to a puzzle is found to hash the block's data.

Hashing the block's data means that to generate a block hash, you pass it through a hashing function. The block hash functions as a "fingerprint"-it is an identity for your input information and is unique to each block.


To get the input data, it's virtually impossible to reverse a block hash. Knowing an input, however, confirming that the hash is correct is trivial for you. All you have to do is submit the input via the function and check if the output is the same.



You must provide data whose hash matches certain conditions in Proof of Work. You don't know how to get there, however. Your only option is to pass your information through a hash function and to check if the conditions match it. If it doesn't, in order to get a different hash, you will have to change your data slightly. Changing even one character in your data will result in a totally different result, so there's no way of predicting what an output might be.

As a result, you're playing a guessing game if you want to create a block. Typically, you take data on all the transactions you want to add and some other significant information, then hash it all together. But since your dataset is not going to change, you need to add a piece of variable information. Otherwise, the same hash as output would always be given to you. This information for the variable is what we call a nonce. With every attempt, it's a number that you'll change, so you get a different hash every time. And this is what mining is what we call.

To sum up, mining is the process of gathering and hashing blockchain information along with a nonce until you find a specific hash. You get the right to broadcast the new block to the network if you find a hash that meets the conditions set out by the protocol. The other network participants update their blockchains at this point to include the new block.


Comments


bottom of page