Check whether a mempool spend hides a confirmed outpoint

Bitcoin Core can look up one outpoint in the confirmed UTXO set or include local pending transactions. Reading both views explains some apparently missing coins.

Query both views

Set TXID and N to the creating transaction and output number. The final boolean controls inclusion of the mempool. Keep the calls close together to reduce races with new blocks.

bitcoin-cli gettxout "$TXID" "$N" false
bitcoin-cli gettxout "$TXID" "$N" true

Read asymmetric results

An object in the first query and no result in the second is consistent with a confirmed output already spent by a local mempool transaction. The opposite pattern can occur for an output created by an unconfirmed transaction. If both queries are empty, the possibilities include a spent coin and an incorrect outpoint. This RPC describes availability and does not identify a historical spender.

bitcoincore.org gettxout