I read that the transactions in the outpaced blocks go back in the mempool, waiting to come to another block
This is effectively only true for the transactions that are not already in block in the other chain.
- Let's assume there were to blocks mined simultaneously. Did both get new bitcoins?
The entire network will be split. Nodes, merchants, and users that accept one of the blocks will see that the miner of THAT block got new bitcoins and that the miner of the other block did not. Nodes, merchants, and users that accept the other blocks will see the opposite. The network will remain in this split state until one of the chains establishes "longer chain", and at that time the "shorter chain" will become orphaned.
What happenes with the one who will "lose the race" for the longest chain? Are his new bitcoins cancelled?
As far as the entire bitcoin system is concerned, his bitcoins never existed. All history associated with that chain is ignored as if it never happened.
And if, what if he already spent it?
The consensus rules do not allow a coinbase output to be spent until it has 101 confirmations (100 more blocks after that block is created). This means that the fork would need to continue to exist for nearly 17 hours without either side becoming "longer". This is extremely unlikely, however if it did happen and if the miner did spend the bitcoins after that 101st block, then the transaction would disappear along with the miner's reward. If you find that the network is
split for more than a block or two, and you aren't 100% certain that you are on the chain that will become the longer chain, then
YOU SHOULD NOT ACCEPT ANY TRANSACTION AS COMPLETED UNTIL THE SPLIT RESOLVES.
- And: If there is a fork: Everyone who has a transaction in it would be able to do a double spending attack?
Most of the transactions in one side of the split will also ALREADY be confirmed in the other side of the split as well. However, this is the reason that many services require 3 or 6 confirmations before accepting a transaction as completed. It is extremely unlikely for a split to last than many blocks without being resolved.
- Assumed that one makes a double-spend attack (waiting for more than several blocks, theoretically). I always read that the vendor then will "lose" his bitcoins (clear), since the transaction will get invalid. But: Theoretically, the vendor who gets attacked may already spent the amount he got from the fauld transaction. What then? Isn't he the one who lose, but the one he payed with this bitcoins?
Correct. If any transaction becomes invalid, then all the transactions that are built off of that transaction are also invalid.
I hope someone can answer these questions.......
I tried.
I hope I was clear.