0

Recently I have been studying on the bitcoin. while going through the double spend process, I found this link as How do I detect a double-spend?

and an answer there describes different scenarios:

Double spending is handled like this -- if two transactions spending the same input(s) happen in the same block, both will be rejected. If one transaction makes it into a block before the other, the first one will be accepted and the second will be rejected. Now, if two transactions entered the network simultaneously, but at different endpoint, by the time the next block is mined it's likely that they would have made it into the same block and thus be simultaneously rejected. It's also possible that a block is mined containing one transaction, and all subsequent blocks containing the other transaction will simply be rejected. The third and least likely scenario is that two blocks are mined simultaneously -- each containing one of the competing transactions -- and this would cause a fork in the blockchain. However, this is the purpose of having confirmations, and by the time you reach 6, it's extremely likely that the forks have been reconciled and that one of these transactions will be rejected along with the rejected fork.

however I could not grasp it.

  1. if two transactions spending the same input(s) happen in the same block, both will be rejected.

Is it possible that two transactions are in same block? To my knowledge, each node will validate the transaction before it is placed in the memory pool. So next time the same transaction appears, doesn't it invalidate the second transaction?

  1. if two transactions entered the network simultaneously, but at different endpoint, by the time the next block is mined it's likely that they would have made it into the same block and thus be simultaneously rejected.

Isn't it the same case as above???

1 Answer 1

1

is it possible that two transactions are in same block. to my knowledge, each node will validate the transaction before it place in memory pool. so next time the same transaction appears, doesn't it invalidate the second transaction????

Yes, it is possible. The transactions that a node accepts to its mempool is completely up to the node and is not governed by consensus rules. The sane thing to do is to ensure that a transaction follows the consensus rules and some other local node policy rules before accepting it to the mempool, but that is not required. Thus if a miner is running custom software that accepts all transactions, they could produce a block which contains conflicting transactions.

Also, if a block contains conflicting transactions, then the block will be rejected, not the transactions. The block is then invalid, the transactions are still valid. If the transactions were first seen in the block, I think then both will be rejected.

2)if two transactions entered the network simultaneously, but at different endpoint, by the time the next block is mined it's likely that they would have made it into the same block and thus be simultaneously rejected.

isn't it the same case as above???

I believe the first scenario may be referring to two conflicting transactions which the miner includes in a block, not that the transactions were broadcast to the network. However both scenarios operate in the same manner.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.