Proof of work(PoW) is a consensus mechanism, famously used in the Bitcoin blockchain to attain a certain level of security for its network. Proof of work was initially designed to curb the invasion of spam email, however, it has grown in popularity due to its effectiveness in blockchain-powered projects like Bitcoin.
● Proof-of-work is a consensus mechanism that requires network participants to prove their “work done” by solving a solution to a pre-defined problem.
● Proof-of-work requires high computing power to perform efficient work, primarily, this aids in the security of the network.
● Proof-of-work is vastly used by cryptocurrency projects as a consensus mechanism to validate transactions and create/earn new tokens.
● Bitcoin uses proof-of-work, miners run heavy hardware to compete to create blocks, validate transactions, and earn block rewards.
As aforementioned, though not limited to its vast utility in the cryptocurrency space, proof of work powers many cryptocurrencies, allowing for a more secure and decentralized network. Bitcoin uses proof of work to attain network security and decentralization. Following its launch in 2009, the potential of proof of work has materialized in the functionality and scaling prospect of Bitcoin and its distributed ledger technology, the blockchain.
The blockchain, popularly known as a public and distributed or shared ledger, makes use of different mechanisms to attain its status quo. Proof of work is one popularly used as a governance structure and security mechanism.
How Does Proof-of-Work(PoW) Work?
At first glance, proof of work may sound complicated, but it really isn’t, theoretically. Proof of work is just like any other thing, from the word “proof” that’s an upshot that it’s basically something that validates another. In this context, a direct answer as to what proof of work really is would be a “hash” which is a cryptographic signature that represents a set of data.
That’s it, the hash is the “proof” of “work”, get it? What does that mean? It means the entire concept is based on a set of numbers(hashes), which is pre-defined in the sense that a target is set to be attained by miners, in other to meet the network's difficulty requirements. A hash is a one-way function that represents a set of data. A hash can be used to validate information without gaining access to that information.
Using a block of Bitcoin transactions as a reference, each validated block is accompanied by a hash. The hash represents that block of transactions, computed with the block header content, anyone with it can validate the uniqueness of the data therein, however, what it means to not have access to the information is not being able to edit or change the data therein. Any slight change in input data results in a totally different hash, which renders that block unauthentic.
That said, proof of work is the hash, with bitcoin, there’s a step up as to how miners can get this hash. Generating a set of numbers(hashes) isn’t much of a difficult task for any computer to do, as a result, bitcoin uses the SHA-256 hash function which requires miners to utilize a great amount of computing power to solve for a target hash. This steps up the difficulty and security level of the network.
How To Solve For A Target Hash?
Hold your breath there a bit, let’s break this down better. SHA-256 is a hashing algorithm, the function is 256 bits long. A hash is a unique data structure, that typically holds more data than its output size which is fixed. A target hash is only 32 bits long which is output by running a block header through the hashing algorithm twice.
Typically, miners are not particularly trying to solve the direct value of the target hash, rather, they generate what is called a “nonce” which means “number only used once. This nonce is the key to getting the target hash.
The miner whose nonce generates a value lower but close or equal to the target hash is awarded the block rewards. This process is what is called proof-of-work, generating these hashes requires high computational power, it is unlikely that a miner gets it at the first trial, which in turn makes the network secure.
Why Does Bitcoin Use Proof-of-Work?
Proof of work is considered a secure algorithm for blockchain consensus due to its cost inefficiency. Typically, mining rigs are expensive to acquire, having this in mind and knowing that the likelihood of acquiring nearly enough is expensive breaks the thought, thus, a better question would be:
The only way for this to be a success is for a miner to re-mine subsequent blocks, inevitably, it means a miner has to do all that and still catch up with the rest of the chain. A lot of things are to be considered:
● Bitcoin Block Time
● The Likelihood Of A Fork
The bitcoin block time is limited to 10 minutes, meaning that miners are limited to verifying transactions in that approximated time frame. Considering this, let's take for instance that 700,000 bitcoin blocks have been mined so far, these translations to roughly 7,000,000 minutes or 117k hours(approximate) of work.
This means a miner needs mining rigs in quite some numbers to achieve re-mining all those blocks in a short time frame not to even mention that while at it, newer blocks are constantly being added to the chain, and considering the cost of mining hardware which are in thousands of dollars, this would require billions of dollars investment.
The likelihood of a fork is quite the game changer. Typically, if a network is under attack and is noticed real quick, a network of nodes can fork the code and abandon the old chain. This would simply leave the old chain useless alongside its cryptocurrency, the coin value would crash and the attacker would lose the money invested, the time, and the effort. For any attack to be successful, it has to be fast, and with the most mining rigs.