BlockChain

Bitcoin Blockchain – What is Proof of Work?

In this post, you will learn about what is proof of work in a Bitcoin Blockchain

Simply speaking, the proof of work in computing is used to validate whether the user has put enough effort (such as computing power) or done some work for solving a mathematical problem of a given complexity, before sending the request. For example, Go to any online SHA 256 calculator tool and try using a random number with the text “Hello World” as shown in the below screenshot. If the difficulty target is set as the hash value starting with one zero, you could see that the random number 10 results in hash value starting with zero. The number 10 is guessed in the ransom manner.

Figure 1. Hash String starting with one zero

In Bitcoin Blockchain, the proof of work is represented as a nonce (a random number) which is used with the transactions Merkel root and the hash of previous block (the reference to the previous block) and passed to the cryptographic hash function (SHA-256) to find the hash value with the pre-defined value of the difficulty target. The difficulty target is the leading number of zeros (0s) with which hash value starts. Each time a different value of nonce is passed until the difficulty target is met.

Hypothetically speaking, the following is the mathematical representation:

SHA-256(SHA-256(Previous Block Header), Merkel Root, Nonce) => Difficulty target

The following diagram represents the proof of work in Bitcoin Blockchain.

Figure 2. Proof of Work in Bitcoin Blockchain

The following are some important details:

  • For the first block, the previous block header hash is a 32-byte field of just zeros and the transaction list is empty.
  • The hash Id of the block, which acts as a hash of the previous block, is created using the hash of the block header (80 bytes) which comprises of the following information:
    • Merkel root (32 bytes)
    • Previous block header hash (32 bytes)
    • Nonce (4 bytes)
    • Timestamp (4 bytes)
    • Version (4 bytes)
    • Difficulty target (4 bytes)

References

Ajitesh Kumar

I have been recently working in the area of Data analytics including Data Science and Machine Learning / Deep Learning. I am also passionate about different technologies including programming languages such as Java/JEE, Javascript, Python, R, Julia, etc, and technologies such as Blockchain, mobile computing, cloud-native technologies, application security, cloud computing platforms, big data, etc. For latest updates and blogs, follow us on Twitter. I would love to connect with you on Linkedin. Check out my latest book titled as First Principles Thinking: Building winning products using first principles thinking. Check out my other blog, Revive-n-Thrive.com

Share
Published by
Ajitesh Kumar
Tags: blockchain

Recent Posts

Feature Engineering in Machine Learning: Python Examples

Last updated: 3rd May, 2024 Have you ever wondered why some machine learning models perform…

2 days ago

Feature Selection vs Feature Extraction: Machine Learning

Last updated: 2nd May, 2024 The success of machine learning models often depends on the…

3 days ago

Model Selection by Evaluating Bias & Variance: Example

When working on a machine learning project, one of the key challenges faced by data…

3 days ago

Bias-Variance Trade-off in Machine Learning: Examples

Last updated: 1st May, 2024 The bias-variance trade-off is a fundamental concept in machine learning…

4 days ago

Mean Squared Error vs Cross Entropy Loss Function

Last updated: 1st May, 2024 As a data scientist, understanding the nuances of various cost…

4 days ago

Cross Entropy Loss Explained with Python Examples

Last updated: 1st May, 2024 In this post, you will learn the concepts related to…

4 days ago