2

I know bitcoin miners compete for a reward by seeing who can solve a difficult hashing problem first (proof-of-work).

However, how does this random hash problem help validate the transactions in the next block? It seems like this hashing problem is completely irrelevant to the ledger validation issue at hand. And when do the other miner nodes validate that the proposed block is correct after one miner finishes?

2 Answers 2

2

You are mixing the two things. It is not just miners, but the entire network of full nodes that ensure only valid transactions are included in a block. When a block is mined by a miner, it is propagated on the network. All the full nodes go through a detailed checklist (see here) to ensure that the block and the transactions within the block confine with the consensus protocol. This is unlike ledger based systems where an 'authority' is appointed to vote on transactions to maintain a state of the ledger.

Since Bitcoin is peer-to-peer, there is no central authority to control it. As a result, anyone can send any kind of transaction to the network, whether or not it is valid. You could simply send a transaction that sends someone else's coins to yourself. Now, if a miner tries to mine a block with those invalid transaction, the rest of the network will reject the block. So the entire effort (read electricity and time) that the miner put in will go waste as that block will not be added to the blockchain by the rest of the participants.

The 'random hash problem' also has other benefit. It ensures that Bitcoin blocks are mined every 10 minutes. Every 2016 blocks (or ~2 weeks) the difficulty is adjusted to ensure that the average block time remains at 10 minutes.

And when do the other miner nodes validate that the proposed block is correct after one miner finishes?

As soon as the miner mines a block (finding a valid block whose header hash confines with the current network difficulty), it will propagate the block through the network. Now, the miner not just sends it to other miners, but also all the full nodes that are connected to it. If the block is valid, the full nodes/mining nodes will relay the block to the nodes connected to them. If invalid, the block will be rejected outright and not relayed. When other mining nodes see this block, they will mine the next block on top of this block (provided the block they received was valid).

1

By mining, we mean that they are searching (through modifying the block and rehashing) for a block hash that is below the current difficulty target expected by all other network participants. This "target" is adjusted every 2016 blocks to maintain an average block time of about 10 minutes.

how does this random hash problem help validate the transactions in the next block?

The network consensus rules require that the block hash meet agreed upon difficulty target as one of the many pieces of criteria for a "valid block". The list of transactions and block structure must already be valid in themselves before the Proof Of Work hashing starts. Various pieces (such as the nonce) are modified to modify the resulting hash. The randomness of hashing the block is a way to ensure that the miner exerts tremendous effort (uses electricity). This provides sybil attack resistance without the need to identify miners in that there is no difference between 1 miner (IP address) with a 1000 ASICs or 1000 pretend miners (controlled by 1 entity) with 1 ASIC each.

It also ensures that the miner has invested a significant amount of money (electricity & mining hardware) in that block. This incentivizes them to "play by the rules" and not attempt to attack the network. The block subsidy cannot be spent immediately, so if they damage bitcoin, they damage the value of their future payout as well.

when do the other miner nodes validate that the proposed block is correct after one miner finishes?

When a miner finds a valid block hash, they must broadcast that block to the the other bitcoin network participants. Each miner validates it individually, and, if it is valid (has correct structure, valid hash and valid transactions), will remove those transactions from their mempool and begin building a new block. The new block will contain a hash of the previous block which explicitly defines the order of blocks. By this process, the block is added the the "blockchain" as miners begin building on it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.