Bitcoin : How does the mining software “guess” the correct nonce?
I was giving a tutorial to my friend about how Bitcoin works and he had a few good questions I couldn’t answer definitively.
I was explaining how a miner “guesses” randomly to solve a hash/puzzle. He is aware of how hashing works. I told him how the miner is trying to guess an input to get a desired output of a certain amount of leading zeros. Here are some scenarios he laid out and my answers to them. Was I correct?
Q1: If I’m a miner with multiple machines, why wouldn’t I tell each machine to guess random numbers within a certain range, with each range being different? That way I don’t waste time or energy potentially guessing a number I already tried.
A1: The amount of numbers to guess is infinite, even if one machine had a range of [1-100000000000], the other would have to guess between [100000000001-infinity], the amount of energy or time saved would be insignificant.
Q2: They could set a range for each machine that didn’t go to infinity, so one machine could randomly guess from [1-9999], the second machine could guess [10000-19999], and when the first machine finished its first range, it could go to [20000-29999] and so on.
A2: When guessing from a range of numbers that stretch to infinity, the chances of guessing the same number twice are so small that it likely doesn’t matter at all, and devoting even that little amount of power or memory to have the miners switch alternating sets is a worse trade off then potentially guessing an already guessed number.
Are my answers to the above scenarios correct? If not, why? And am I missing a fundamental of mining (for instance, we are assuming you can even edit the process in which a miner mines)?
I have already successfully answered two of his other scenarios:
Q: Why don’t they guess linearly to avoid guessing a number twice?
A: Because if someone else is doing the same thing, but quicker, you guarantee you will never successfully mine a block.
Q: Why doesn’t a miner with multiple machines keep track of which numbers are guessed and communicate that to all of his machines to avoid guessing the same number?
A: It would definitely take more resources to store and communicate that information than it would save to avoid guessing the same number twice.
Bitcoin is a distributed, worldwide, decentralized digital money. Bitcoins are issued and managed without any central authority.
FindCrypto scans the web for the latest Bitcoin news, so you can find all the latest and breaking news in one convenient location.Author: Gaditonecy
Don’t forget to share the post if you love it !