8

I have created, signed and sent a raw transaction via bitcoind RPC. Now I want to wait for it to have n confirmations.

Considering transaction malleability, I can't just check the "confirmations" field returned by gettransaction, because the transaction with that particular txid may never be accepted, in case an equivalent transaction with some other txid was accepted instead.

So, what is the canonical way, using bitcoind JSON-RPC, to check if an equivalent transaction was accepted in place of mine? What calls are better suited for the task?

1

You can use the listtransactions JSON-RPC call to get the complete list of transactions that have to do with your addresses. This includes both sends and receives. You can filter for the transaction you're looking for by the category (should be "send"), address, amount and time. The txid and confirmations in this RPC call should be what's actually included in the blockchain and can be relied upon.

For reference, here's what the RPC call looks like:

[
{   
    "account" : "",
    "address" : "1ENnzep2ivWYqXjAodTueiZscT6kunAyYs",
    "category" : "send",
    "amount" : -0.00040000,
    "fee" : -0.00010000,
    "confirmations" : 34055,
    "blockhash" : "000000000000000019313300fa20943b3974a97c1da2de6de13ea1281f77097f",
    "blockindex" : 414,
    "blocktime" : 1404861981,
    "txid" : "8a1f0f07fb397b2aa0e77995723f2dac9aee7df63a6f05a7db7d168d62a60f94",
    "walletconflicts" : [
    ],
    "time" : 1404861981,
    "timereceived" : 1412296394
}
]
4
  • So it is organized by output addresses, but what this fee means? If my transaction has 2 output addresses, the entries returned by listtransactions for both will contain the same fee? – lvella Feb 17 '15 at 16:54
  • The fee will be the same, yes. – Jimmy Song Feb 17 '15 at 21:42
  • 2
    I am somewhat unsatisfied with this answer, because the answer for listtransactions will become increasingly large with my wallet usage. That won't be practical, if checking outgoing transactions is a routine operation. – lvella Mar 28 '15 at 6:10
  • wouldn't an answer be that you get a negative confirmation amount if a malleability tx got confirmed instead? – tobi Apr 3 '17 at 9:35

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.