Let's say the transaction got picked up into a block by miner A and into a block by miner B. Both are working on those separate blocks, and each block contains information about Alice's transaction and it is just a matter of luck which miner solves it? Or are transactions picked up as "one bunch" by every miner out there working on the next block, so that Alice's transaction is in "every" block that is currently mined?
-
Hi naequuu, please don't create long statements asking whether you understand correctly. Such questions are not inviting answers and hard for others to benefit from. Rather ask an open question about anything that you're in doubt! :) I've taken the liberty to remove your description of Bitcoin, it would be better suited as an answer on "how does Bitcoin work". You can still find the original text in the edit history.– Murch ♦Aug 30, 2017 at 7:15
-
Your description was mostly correct except that instead of 'If 51% of other miners agree that his block is "correct", it gets appended to the blockchain, the miner who solved it gets some bitcoins in reward.' I would say "if other miners build on top of the block, it will be part of the longest chain and the miner will be able to spend their reward." Miners essentially do pay themselves, see e.g. bitcoin.stackexchange.com/q/57909/5406.– Murch ♦Aug 30, 2017 at 7:16
1 Answer
Both are working on those separate blocks, and each block contains information about Alice's transaction and it is just a matter of luck which miner solves it?
Mining a block is basically a race, the successful miner is usually the first one to find a valid block and send it to the rest of the network. In one respect, there is some luck involved, because hashing is purely probabilities, it might take you only one attempt to find a valid block or it might take you quadrillions of attempts. But obviously the more attempts you make, the more likely you are to find a valid block, hence why more mining power generally means higher success rates.
Sometimes, two miners find a block at almost the same time and a small fork happens where some nodes see one block first and others see the other, but this is generally resolved as soon as the next block is mined, because the nodes will move to whichever chain becomes longer.
-
Thank you for the explanation. Still, one part I don't get is: do all the miners work on hashing the same one block, which includes one list of transactions, including Alice's?– naequuuAug 29, 2017 at 12:00
-
1Each block may be slightly different, the miner can choose which transactions they want to include in their block, usually they will include those with the highest transaction fees. Even if 2 miners choose the same transactions, they might put them in a different order. That's the miners choice :) Aug 29, 2017 at 12:23
-
Thanks again! So,there is a pool of transactions that need to be verified. Each miner selects the transactions he wants to put in a block and the selection is not exclusive. Alice's transaction can be in several blocks at once. If Alice's transaction happened to be in the "solved" block, it is then validated when the block is solved. If her transaction happened to be in a block that was not solved and discarded, she must wait until her transaction goes into a solved block. Am I missing something?– naequuuAug 29, 2017 at 12:44
-
Correct, note that it can only be I'm one 'solved' block in the blockchain though. Please remember to accept my answer if it satisfied your question too :) Aug 29, 2017 at 21:50