3 ms·
No, I still think you don't get it. You seem to think that mining a block is something that takes a long time, and that work is wasted if someone else managed
by jstanley 4y ago
No, I still think you don't get it.
You seem to think that mining a block is something that takes a long time, and that work is wasted if someone else managed to mine a block first. Mining a block takes an incredibly short amount of time, but pays off with incredibly low probability. You have to do lots of attempts to find a block. You don't spend 10 minutes trying to compute one hash, and then throw up your hands in disappointment if it wasn't low enough.
> Or until someone else mines a block, in which case you have to start again from scratch.
You always start again from scratch after every single hash. Billions of times per second. You're no more likely to find a block on your millionth hash than on your first. The work doesn't add up. Each hash you try is either low enough or it's not, and either way you try again.
> The "random number that satisfies some property" is dependent on the transactions included in your block, and if other miners include those transactions that are mined in blocks before yours, then you have to start from scratch.
That's correct, but you only wasted a small amount of time during the overlap between the other miner finding a new block and you hearing about it.
- jcbrand 4y agoThe random number that you're trying to find by means of (yes, repeatedly) hashing, is dependent on the transactions in your block (which are hashed together in a Merkle tree). Not only that, but the number you're trying to hash is also dependent on the previous block (hence it being called a blockchain). So as soon as another miner mines a block, the block you're mining immediately becomes invalid. For two reasons, the block height of your block is now too low (it has the wrong parent) and it (most likely) includes already mined transactions. So even if you happened to still mine your current block, it will be rejected by the nodes in the network for having the wrong block height and for including already mined transactions. So, you have to assemble a new block, which uses the latest mined block as parent and you have to include new transactions from the mempool. There's a cost to doing this, it takes time away from the actual hashing, which is what I meant with "starting from scratch". For the reasons outlined above, you're not mining blocks independently from everyone else.