Bitcoin – PoW mechanism in Bitcoin

This note will see how Bitcoin Proof of Work extends the Hashcash Proof of Work base system and developed the methodology to protect the blockchain by applying a distributed consensus mechanism. Along with this, we will also look into several other consensus algorithms applied on a permission-less model of blockchain, which are most similar to bitcoin-based architecture, and how they utilize the concept of consensus to ensure a secure tamper-proof blockchain.

Proof of Work (PoW): It is an economic measure to deter service abuses by requiring some work from the service requester, usually processing time by a computer. If you are requesting a service, you have to show the service provider that you have spent significant interest on the service that you are requesting for.

Bitcoin is a peer-to-peer network, and when a node broadcasts a transaction in this peer-to-peer network, all the nodes in this network need to agree on the correctness of this transaction. There are mainly two types of nodes in the network.

  • User Node:  This node validates the received transaction, and if the transaction is valid and not for him/her and first time seeing this transaction, then flood it into the network. If it is for him/her, add this transaction into his/her wallet. For any other case, drop it.
  • Miner Node: This node collects all the valid transactions for a certain duration, creates a new block, solves the network challenge or Proof of Work, and tries to add a newly generated block to the existing blockchain.

There can be multiple miners in the bitcoin network. Individual miners can propose their new block based on the transactions they have seen or received and validated after the last addition of a new block in the blockchain.

Bitcoin Proof of Work (PoW)

Bitcoin PoW is based on the Hashcash PoW system. In the Bitcoin network, the miners are the special nodes who participate in the consensus procedure, and they need to prove that they have done some work before proposing a new block. If they can complete that work, they can submit that block as a part of the existing longest chain of the blockchain. However, there is a possibility that attackers may exist in the network, and this will discourage them from proposing a new block or making a change in the existing blocks because they have to do the entire work of the blockchain, which is computationally difficult in a generic environment. 

Methodology of Bitcoin PoW

In the basic blockchain architecture, every block is connected with previous blocks with the hash value. PH is the previous block hash value, N is for the nonce value and it is included for every block. we need to include one of these existing 3 proposed blocks in an existing blockchain.  Every miner will try to find out a nonce (N) value, which will satisfy a certain hash equation. So, the hash equation is BH = Hash(PH:MR: N) N =? . we have a previous block hash along with we have the Merkle root of the transactions and nonce value. BH is hash block and the challenge is that a certain number of zeros at the prefix, it is just similar to Hashcash. This is termed as the difficulty of the system. The miners they will try with different value of nonce which will satisfy the difficulty. 

Bitcoin proof of work
Bitcoin Proof of Work

Every individual miner will independently try to find out this nonce value and the minor who will be able to first find out the nonce value for his own block then he or she will be able to include the new block as a part of blockchain. This is the proof of work based system which is utilized in bitcoin to ensure that consensus by utilizing the challenge response base system. 

Most implementations of Bitcoin proof of work use the double SHA256 hash function. The miners collect the transactions for 10 minutes, a default setup and starts mining the PoW. Within that duration if they get an updated blockchain then they find out that which transactions have already been included in the block by excluding those transactions which have already been included in the existing blockchain. They take the next new set of transactions to propose a new block and start the mining procedure. 

The probability of getting a PoW is low and it is difficult to say which miner will be able to generate the block. So we have multiple miners who are simultaneously trying to generate a block and once of the minors out of those the hundreds or thousands of miners who are in the bitcoin network, one of them will generate the block and that way because this probability was low no minors will be able to control the bitcoin network single-handedly. However, ideally, it will not happen that no minors will be able to generate the all the blocks in the bitcoin network. That level of randomization is supported by the bitcoin consensus protocol which is proof of work system. 

Why bitcoin mechanism is Tamper-proof

Every individual block miners need to find out the nonce and curr_hash is current value of hash. The curr_hash and prev_Hash are same. So if some attacker wants to make some changes in one block then they have to actually do the collective work or they have to do more work compared to the collective work of all the blocks in the chain. So every block in the chain it has been obtained by doing some work by individual minors. The attacker have to do a collective work which is more than the total collective work of all the blocks in the current blockchain. So this is difficult with the current hardware. 

The blockchain together contain a large amount of work and the attacker needs to perform more work to tamper the blockchain and this is difficult with the current hardware but it is not impossible. 

Blockchain bitcoin
Bitcoin blockchain

Solving the Double Spending Problem

The attack: Successful use of the same fund twice. A transaction is generated with BTC 10 to both Bob and Carol at the same time. 

Solution: The transactions are irreversible, computationally impractical to modify and every transaction can be validated against the existing blockchain. 

The Pow also solves the double spending problem. because transactions that we are putting in the block they are irreversible or at least they are computationally impractical to modify. The attacker have to do a significant amount of work or more than the work than the collective work of the blockchain. And that way it is computational impractical and that is why that attacker will not be encourage to launch this kind of attack. That way what ever transactions which have been alreay submitted in the block they are kind of permanent transactions means you can think of them as the permanent ledger and whenever some new transaciton comes you can always validate that whether the new transaction confirm with the existing transactions which are there in the blockchain. So that way if this initial transaction has already committed in the blockchain from there you can find out that the attacker has only how many bitcoin left. If attacker is going to initiate two different transactions, the node or miners in the bitcoin network can verify that and they can actually block such kind of double spending to happen over the bitcoin network. So that way by making the entire system tamper proof the proof of work mechansim ensures that a dobule spending does not happen. 

 1,087 total views,  2 views today

Scroll to Top
Scroll to Top