English module on
Bitcoin
Powered by Zft
Powered by likha

Proof-of-Work

Co-written by Raphael Bustamante, James de Jesus, and Gabriel Paningbatan
Key Takeaways
  • Proof-of-Work (PoW): the consensus mechanism Bitcoin's blockchain is based on. 
  • Through hashing, the PoW consensus mechanism keeps the network decentralized, verifiable, and secure. 
  • Proof-of-work mining equates to miners in the network continuously guessing for the correct inputs until they land a combination that works. 
  • 51% Attack: when malicious miners control more than 50% of the Bitcoin mining network.

Bitcoin's blockchain is based on a Proof-of-Work (PoW) consensus mechanism. Proof-of-Work helps keep the network decentralized, verifiable, and secure.

Proof-of-Work

In a Proof-of-Work system, the Bitcoin miners must expend work and energy to solve mathematical problems to ultimately prevent bad network actors.

Sounds like rocket science? Let’s fix that!

To better understand Proof-of-Work, let's recall what Bitcoin is. Bitcoin is a decentralized digital currency that utilizes the blockchain to store transactions happening in the network. Due to the cryptography involved, the blockchain is immutable, which means no one can manipulate or tamper with the transactions happening. It’s what helps keep the network secure from bad actors.

You can review what Bitcoin is  and what the blockchain is in previous chapters.

How hashing works with Proof-of-Work

So how does blockchain with a Proof-of-Work system protect Bitcoin from bad actors? Again, this is all thanks to hashing. You can review our previous chapter on hashing here. Hashing is responsible for stringing and securing all the blocks of data in the network together. Think of it as the “chain” in “blockchain”.

Let's go back to our good pals, Pedro and Darna. Hashing comes in at Step 3. You can view the step-by-step example here.

Step 3: Miners around the globe validate these transactions at a certain pace with a process called hashing. As I mentioned earlier, the hashing process is random — just like a lottery.

Step 3.1: A miner takes Pedro and Darna's transaction, along with other transactions, and hashes them. Let's call this miner "Miner A" and this output hash "Hash A."

Step 3.2: Miner A combines Hash A with a random nonce—short for "number used once”—and then hashes again. Let's call this hash "Hash B."

Step 3.3: Hash B is compared to a target number, but there’s a catch. Hash B has to be less than the target number.

If it’s not less than the target number, Miner A will have to keep retrying different nonces that will give a hash output that meets the criteria. In other words, Miner A needs to find a nonce that works. Say Miner A found the correct combination. Let's call this hash "Hash C."

To better understand the target number, imagine joining the lotto with your friends.

Let's say the range of numbers you can draw from the lotto machine is one to one hundred. The lotto master says that to win, you must draw a number that is less than ten. Unfortunately, you draw the number seventeen. Your friend Ervin, on the other hand, draws the number three so he wins!

In this example, ten is the target number, while the number seventeen you drew is Hash B, and your friend's number three is Hash C.

Step 3.4: Once Miner A successfully finds a nonce that works, that miner will then announce it to everyone else in the network. They will say something like:

"Hey, all! I finally solved it. Here is the transactions’ hash, the nonce I used, and the resulting hash output (Hash C) of these two. I already compared it to the target number, and it checks out! You can double-check it yourselves."

The rest of the miners in the network double-check to see if Miner A's solution is correct. Remember: hashes are both verifiable and irreversible. This means that if the miner did find a solution, the other miners in the network could quickly verify it without the possibility of tampering with it.

After that, we move on with our original, step-by-step outline.

Step 4: Once the miners give Pedro and other people’s transactions the OK signal, they are clustered into a block.

Step 5: After clustering them together, the block is added on top of previous blocks—containing previous transactions—forming a chain. These blocks are all mathematically linked to each other, making them secure.

Step 6: Darna receives the two (2) bitcoin Pedro sent.

Step 7: The miner who first validated the transaction receives bitcoin to compensate them for finding the solution.

Essentially, the Proof-of-Work mining process consists of miners in the network continuously guessing for the correct inputs (transaction data and nonces) until they land a combination that works (target number). The cost of the entire process is quite steep since the miners need to consume electricity and have the proper hardware.

It's called 'Proof-of-Work' because when they find a winning combination, the electricity and computing power used to find it prove that the miner carried out actual work to find the winning combination.

Note: The hash of the previous block is also added to the mix in step 3.2, which means the inputs for Hash C are Hash A, a random nonce, and Hash C of the previous block. 

We chose not to include this earlier to make things easier to digest!

Adding in the hash of the previous block effectively links all the blocks together. Remember how changing hash inputs even in the slightest also causes the hash output to change completely? If there were a bad actor to change past data, this would alter its respective hash. The change in this hash would then snowball onto the other hashes just like an avalanche.

This is crucial because if someone tries to change any data in the past, the rest of the network would immediately recognize the inconsistency and shut down the bad actor.

Benefits of A Proof-of-Work System

1. Miners are incentivized to do honest work because of the bitcoin they earn.

2. Bad actors are less incentivized to attack the network due to the real-world costs of mining. The monetary cost of hacking the network also largely outweighs the potential benefits.

3. It keeps everything in check and secures all the transactions.

4. It takes out the need for trust and consensus is achieved without a central party.

5. The “randomness” involved eradicates any biases or possible loopholes for manipulation.

Yet, of course, nothing is perfect. The Proof-of-Work consensus system is still no exception since it’s vulnerable to a 51% attack.

51% attack

A 51% attack is when malicious miners control more than 50% of the Bitcoin mining network.

Controlling more than 50% would give these malicious miners the power to tamper with future transactions in the network. 

It’s similar to the idea of someone owning 51% of a company's shares. They have the most power to control the company's decisions.

It’s important to note that even if a 51% attack occurs, past transactions that have already been facilitated can no longer be tampered with. The malicious miners can only dictate what happens with future transactions in the network.

For a group of people to do a 51% attack, they would need massive amounts of hardware and electricity, which would cost an arm and a leg. Moreover, the costs of doing a 51% attack hugely outweigh the financial benefits malicious miners would reap from it.

The possibility of a 51% attack is the reason miners play an important role in Bitcoin. As more miners come in, the barrier becomes harder for bad actors to penetrate. As the network grows, its security grows with it.

Satoshi's blockchain design is truly ground-breaking. No one could have ever imagined the possibility of having a fully functioning decentralized network that is efficient and secure. It has revolutionized how we do our finances today and may continue to revolutionize various daily processes in the future.

In the next chapter, we’ll cover another form of cryptography called digital signatures and how it’s involved with the crypto wallets people use.

ZFT is home for the new gen of Wealth Builders.

Learn how to trade with ZFT →

Think you've mastered "

Proof-of-Work

" now?

Take the quiz!