Hi everyone, I am pretty new to the Bitcoin & Blockchain world. I am currently reading Mastering Bitcoin, but I have a doubt I can't solve.
Let me use an easy example:
Let's say there are only 2 mining nodes (A and B), which are both mining the block 5 to to add it to the chain.
Now, from what I have understood, the transactions the 2 nodes have in their block 5 can differ. E.g. the transaction "Alice buys a coffee for 5 BTC" can be in the block 5 that the node A is mining, but not in the block 5 that the node B is mining (e.g. because this transaction arrived later to the node B compared to the node A).
Now, if the winning node for this block is the node B, the transaction "Alice...." won't be stamped in the ledger.
When the competition for the block 5 is over, are the "loosing" nodes (in this case the node A) giving up all the transactions in the block they were working on? and take new transactions from the memory pool?
In this case, if the nodes start again mining for the block 6, the transaction "Alice...." will be in the block 6 for node B, but not in the block 6 for node A (node A has given up the transaction from the block 5)
What if node A wins the mining? Won't the transaction "Alice...." be lost forever?
Please correct me
Cheers
It's not the nodes that do the mining process right now, it's the pools of miners.
Furthermore, (transactions *basically* have nothing to do with the mining process). Mining is simply discovering a hash that is valid. Then they'll ( most likely) choose the transaction with the highest fees until the block is filled up.
If miner B is ( significantly) faster then miner A, all the transactions from miner b will be added to the blockchain, and as you said, none from miner A .
So, if Alice wasn't chosen by miner B to be in the block, she will still be in the mempool. If miner A mines block 6, and Alice her transaction fee is high enough, there's a good chance miner A takes and puts her transaction in block 6.
(node A has given up the transaction from the block 5)
Miner A has given up looking for said hash, but the transaction still remains valid to be added in future blocks.
It seems to me that you interpret it as if the transactions itself are "mined", or need significant work to be added into the blockckhain, however this isn't the case.