Connect with us

Proof of Work

Introduction to Proof of Work

Proof of Work describes a system that requires a not-insignificant but feasible amount of effort in order to deter frivolous or malicious uses of computing power. Examples may include sending spam emails or launching denial of service attacks. The concept was adapted to money by Hal Finney in 2004 through the idea of “reusable proof of work.” Following its introduction in 2009, bitcoin became the first widely adopted application of Finney’s idea. In fact, Finney was also the recipient of the first bitcoin transaction. Proof of work forms the basis of many other cryptocurrencies as well.

proof of work

How does Proof of Work (PoW)…actually work?!

proof of work vs proof of stake

Proof of Work & Bitcoin

We will look at Proof of Work in terms of how it functions in the bitcoin network. Bitcoin is a digital currency that is underpinned by a kind of distributed ledger known as a “blockchain.” This ledger contains a record of all bitcoin transactions, arranged in sequential “blocks,” so that no user is allowed to spend any of their holdings twice. In order to prevent tampering, the ledger is public, or “distributed”; an altered version would quickly be rejected by other users.

The way that users detect tampering in practice is through hashes, long strings of numbers that serve as Proof of Work. Put a given set of data through a hash function (bitcoin uses SHA-256), and it will only ever generate one hash. However, due to the “avalanche effect,” even a tiny change to any portion of the original data will result in a totally unrecognizable hash. Whatever the size of the original data set, the hash generated by a given function will be the same length. The hash is a one-way function. It cannot be used to obtain the original data, only to check that the data that generated the hash matches the original data.

proof of work blockchain workflow

Generating just any hash for a set of Bitcoin transactions would be trivial for a modern computer, so in order to turn the process into “work,” the bitcoin network sets a certain level of “difficulty.” This setting is adjusted so that a new block is “mined” – added to the blockchain by generating a valid hash – approximately every 10 minutes. Setting difficulty is accomplished by establishing a “target” for the hash: the lower the target, the smaller the set of valid hashes, and the harder it is to generate one. In practice, this means a hash that starts with a long string of zeros: the hash for block #429818, for example, is 000000000000000004dd3426129639082239efd583b5273b1bd75e8d78ff2e8d. That block contains 2,012 transactions involving just over 1,000 bitcoin, as well as the header of the previous block. If a user changed one transaction amount by 0.0001 bitcoin, the resultant hash would be unrecognizable, and the network would reject the fraud.

So how do miners make sure they generate a hash below the target since a given set of data can only generate one hash,? Well, they alter the input by adding an integer, called a nonce (“number used once”). Once a valid hash is found, it is broadcast to the network, and the block is added to the blockchain.

Mining is a competitive process. However, it is more of a lottery than a race. On average, someone will generate acceptable Proof of Work every ten minutes or so.  But, who it will be is anyone’s guess. Miners pool together to increase their chances of mining blocks, which generates transaction fees and, for a limited time, a reward of newly-created bitcoins.

Proof of work makes it extremely difficult to alter any aspect of the blockchain. This is because such an alteration would require re-mining all subsequent blocks. It also makes it difficult for a user or pool of users to monopolize the network’s computing power, since the machinery and power required to complete the hash functions are expensive. See our post on why PoW uses so much energy.

Did that make sense? If so, read up on Proof of Stake the newer mining technology.

 

Copyright © 2017 Planet Blockchain. Coin data provided by https://www.cryptocompare.com