<p>If your node received the original spend, the <a href="https://bitcoin.org/en/developer-reference#listunspent" rel="nofollow"><code>listunspent</code> RPC</a> will display the transaction with "-1" confirmations, as will any other RPCs that would normally list the transaction.  The source code <a href="https://github.com/bitcoin/bitcoin/blob/b7fe9cd04cd2756b1ce40b668d25a130441ba847/src/wallet.h#L539" rel="nofollow">calls this conflicted:</a> "not in the mempool and not in the block chain."  This feature was first included in <a href="https://bitcoin.org/en/release/v0.9.0" rel="nofollow">0.9.0</a>.</p>

<p>If your node never received the original spend (perhaps because it was offline at the time) or the now-stale block that contained it, it doesn't have any way to know about that original spend, so there's no information you can get from an RPC.</p>

CC BY-SA 3.0
2014-11-20T18:47:32.973Z
Thanks David! Now I'm really concerned about this: http://bitcoin.stackexchange.com/questions/730/what-does-the-bitcoin-client-do-when-it-receives-conflicting-transactions I wish I could find an update on that answer
Doug Peters
CC BY-SA 3.0
2014-11-20T13:36:04.667Z
2014-11-20T13:36:04.667Z
David A. Harding
<p>How can I be positive that one of the incoming payments to my bitcoin-core was double-spent after it was confirmed once by the network, through the JSON-RPC interface?</p>

<p>Related questions:</p>

<ul>
<li><a href="https://bitcoin.stackexchange.com/questions/13370/how-do-i-detect-a-double-spend">How do I detect a double-spend?</a></li>
<li><a href="https://bitcoin.stackexchange.com/questions/30750/accepting-0-confirmation-transactions-and-detecting-double-spends-with-open-sour">Accepting 0-confirmation transactions and detecting double-spends with open source solution</a></li>
<li><a href="https://bitcointalk.org/index.php?topic=327767.0" rel="nofollow noreferrer">https://bitcointalk.org/index.php?topic=327767.0</a> (GHash.IO and double-spending against BetCoin Dice)</li>
</ul>

<json-rpc><doublespend>
JSON-RPC to detect double-spent TXs
Doug Peters
# JSON-RPC to detect double-spent TXs

(Asked by: username_0 on 2014-11-20)

How can I be positive that one of the incoming payments to my bitcoin-core was double-spent after it was confirmed once by the network, through the JSON-RPC interface?

Related questions:

* [How do I detect a double-spend?](https://bitcoin.stackexchange.com/questions/13370/how-do-i-detect-a-double-spend)
* [Accepting 0-confirmation transactions and detecting double-spends with open source solution](https://bitcoin.stackexchange.com/questions/30750/accepting-0-confirmation-transactions-and-detecting-double-spends-with-open-sour)
* <https://bitcointalk.org/index.php?topic=327767.0> (GHash.IO and double-spending against BetCoin Dice)

**Tags:** json-rpc, doublespend


---

## 1 answers

### Answer by username_1 on 2014-11-20. Score: 2

If your node received the original spend, the [`listunspent` RPC](https://bitcoin.org/en/developer-reference#listunspent) will display the transaction with "-1" confirmations, as will any other RPCs that would normally list the transaction. The source code [calls this conflicted:](https://github.com/bitcoin/bitcoin/blob/b7fe9cd04cd2756b1ce40b668d25a130441ba847/src/wallet.h#L539) "not in the mempool and not in the block chain." This feature was first included in [0.9.0](https://bitcoin.org/en/release/v0.9.0).

If your node never received the original spend (perhaps because it was offline at the time) or the now-stale block that contained it, it doesn't have any way to know about that original spend, so there's no information you can get from an RPC.

> **Comments:**
> **username_0**: Thanks username_1! Now I'm really concerned about this: http://bitcoin.stackexchange.com/questions/730/what-does-the-bitcoin-client-do-when-it-receives-conflicting-transactions I wish I could find an update on that answer  

---

