There are lots of transactions over the mempool of the bitoin. However, there might be double spends. How can we verify whether two transactions are conflicting, i.e. they are double spends of a bitcoin?

P.S. Given two transactions are conflicting, then they both have at least one common input transactions. So, what else should be checked to verify that two transactions are conflicting (double spend).



Firstly, there is no "the mempool". There is no global mempool. Rather each node maintains its own mempool and accepts and rejects transaction to that mempool using their own internal policies. Most nodes have the same policies, but due to different start times, relay delays, and other factors, not every node has the same mempool, although they may be very similar.

When it comes to doublespends, the typical node policy is that if a transaction conflicts with another transaction, it will not be accepted by that node, thus the conflicting transaction doesn't enter that node's mempool. So unless you modify your node to accept conflicts, your node's mempool will never contain conflicting transactions.

  • Thanks for the answer. My question is exactly here that how to detect that two transactions are double spends and delete them. I mean the algorithm behind that. What I am curious to know is identifying double spends and the algorithmics behind it. Given two transactions as conflicting transactions, they both have at least one common input transaction. However, what else should we check to find if two transactions are conflicting and double spend? Aug 17 '20 at 16:09
  • 2
    That's all that you have to check. Two different transactions (different txids) that have at least one identical input (same txid and vout in one input).
    – Andrew Chow
    Aug 17 '20 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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