3

Please let me know if I understand something wrong.

Let's say I want to create a new block and verify previous transactions. To do this, I need to:

  • Choose which transactions I want to include in my block
  • Calculate the Merkle Root of these transactions
  • I choose (?) a timestamp where I expect to 'create' this block (Is this a general concensus?)
  • I start to calculate hashes by concatenating above values and starting at nonce 0, increasing up to 2^32-1
  • When I find a hash with enough zeros, I announce my proof to the network and collect my fee

There's one problem here: there is no way to guarantee a solution exists. Since I expect mining pool members to all agree what transactions to include and which timestamp to use, it can be possible that for the given block no solution exists.

Of course, other miners also experience this problem. What if all 'big' miners choose blocks which do not have any solution? Could the network stall?

1 Answer 1

3

Since I expect mining pool members to all agree what transactions to include and which timestamp to use, it can be possible that for the given block no solution exists.

That is usually not the case. With the stratum protocol which is most widely used, miners have no say as to what goes into a block except for the nonce and extranonce (extranonce is part of the coinbase transaction). So if a given block and all of its nonces result in no solution, the mining pool just constructs a new block with either new transactions, a different transaction ordering, or just a different timestamp and tells the miners to work on that.

As for the timestamp, it does not need to match real time at all. The timestamp just needs to be greater than the previous block's Median Time Past (median timestamp of the last 11 blocks), so the timestamp can be off of real time.

What if all 'big' miners choose blocks which do not have any solution? Could the network stall?

A miner is not locked into only working on the block that they chose. They can construct another block and work on that. The network does not know nor does it care if a miner had to construct a different block to mine.

6
  • 1
    The vast majority of blocks have no solution whatsoever. The normal condition of the network is to stall for, on average, ten minutes until someone happens to be lucky enough to make a block that has a solution and then finds that solution. Oct 22, 2017 at 21:05
  • Hi @DavidSchwartz I didn't understand the concept that the vast majority of blocks have no solution whatsoever. Aren't there multiple solutions to one block? The criteria of solving a block is to get a nonce which happens to create a hash value lower than the given target. Shouldn't there be multiple solutions among 2^32-1 choices we have. Jun 25, 2020 at 4:30
  • @shubhamkumar No. Right this second, the difficulty is so high that only one in 15 trillion blocks has any nonce that produces a low enough hash. You just have to keep trying all 2^32 nonces on billions of blocks until someone finds a block (and nonce) with a low enough hash. Jun 25, 2020 at 5:05
  • @shubhamkumar 2^32 is incredibly small compared to the network hashrate. The network currently does ~2^66 hashes per second. Those 2^32 nonces for a single block are completed in a tiny fraction of a second.
    – Andrew Chow
    Jun 25, 2020 at 5:10
  • @AndrewChow Fair point, Agreed! But if a miner is trying to find the solution, why would any time he/she construct another block? He/she has no idea if he/she is close to the solution due to the arbitrariness of SHA-256. How will anyone conclude if there exists a solution or not inside 10 minutes? If the miner tries solving a new block won't it have less probability to get the solution? Jun 25, 2020 at 6:22

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.