What does proof of work mean?
The proof of work describes a system that requires a significant but achievable effort to deter frivolous or malicious uses of computing power, such as sending spam or launching denial of service attacks. The concept was adapted to money by Hal Finney in 2004 thanks to the idea of ”proof of reusable work”. After its introduction in 2009, bitcoin became the first widely adopted application of Finney’s idea (Finney was also the recipient of the first bitcoin transaction). Proof of work also forms the basis of many other cryptocurrencies.
Explanation of proof of work
This explanation will focus on the proof of work as it works in the bitcoin network. Bitcoin is a digital currency that relies on a kind of distributed ledger called “blockchain”. This register contains a record of all bitcoin transactions, organized in sequential “blocks”, so that no user is allowed to spend twice their assets. In order to avoid any falsification, the general ledger is public or “distributed”; a modified version would be quickly rejected by other users.
The way users detect tampering in practice is by using hashes, long strings of numbers that serve as proof of work. Put a given dataset via a hash function (bitcoin uses SHA-256), and it will only generate one hash. However, due to the “avalanche effect”, even a tiny modification of part of the original data will result in a completely unrecognizable hash. Regardless of the size of the original dataset, the hash generated by a given function will have the same length. The hash is a one-way function: it cannot be used to get the original data, only to verify that the data that generated the hash matches the original data.
Generating 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 defines a certain level of “difficulty.” This parameter is adjusted so that a new block is “mined” – added to the blockchain by generating a valid hash – approximately every 10 minutes. The definition of the difficulty is obtained by establishing a “target” for the hash: the lower the target, the smaller the set of valid hashes and the more difficult it is to generate one. In practice, this means a hash that begins with a long string of zeros: the hash of the block # 429818, for example, is 000000000000000004dd3426129639082239efd583b5273b1bd75e8d78ff2e8d. This block contains 2,012 transactions involving just over 1,000 bitcoins, as well as the header of the previous block. If a user changed a transaction amount of 0.0001 bitcoin, the resulting hash would be unrecognizable and the network would reject the fraud.
Since a given dataset can generate only one hash, how do miners make sure to generate a hash below the target? They modify the entry by adding an integer, called a nonce (“number used once”). Once a valid hash is found, it is broadcast over the network and the block is added to the blockchain.
Mining is a competitive process, but it is more of a lottery than a race. On average, someone generates acceptable proof of work every ten minutes, but that will be anyone’s guess. Miners band together to increase their chances of mining blocks, which generates transaction fees and, for a limited time, a reward for newly created bitcoins.
Proof of work makes it extremely difficult to modify any aspect of the blockchain, as such modification would require re-examining all subsequent blocks. It also makes it difficult for a user or group of users to monopolize the computing power of the network, since the machinery and power required to perform the hash functions are expensive.