I right clicked the transaction history in the QT client and pasted in the TxID below.


In the following test, can anyone explain what the purpose of the suffix -000 is and what it's used for?

gettransaction 54b9be14443b152b02ed0b18d27504631cccfa84ce9ada03f9558fbb85b6129c-000


Why doesn't a raw transaction support the same transaction ID format as the previous command? (I need to remove the -000 characters)

getrawtransaction 54b9be14443b152b02ed0b18d27504631cccfa84ce9ada03f9558fbb85b6129c-000
ERROR: parameter 1 must be hexadecimal string


When I enable index=1 in bitcoin.conf and reindex, why can't I call GetTransaction for transactions not in my wallet? I would like JSON friendly results


Q1: A ledger entry in the wallet view corresponds to a single output of a transaction. The suffix is there to distinguish which output of the transaction is used. It's a bit of strange choice to format it that way; in most places, ':' is used as a separator.

Q2: getrawtransaction queries the memory pool, the set of unspent transaction outputs and the blockchain (if txindex is enabled) for a transaction. It doesn't query a single output, so you pass in just the hexadecimal identifier. You can query individual unspent transaction outputs using the gettxout command (which takes a txid + the output index as separate arguments). You can pass an extra 1 as argument to getrawtransaction to have it decoded, instead of just the raw hex. decoderawtransaction can do this for arbitrary hex-encoded raw transactions. Perhaps this is the answer to Q3.

Q3: gettransaction is a wallet RPC. It cannot operate on anything else, as it needs the higher abstraction layer. It computes debit/credit and fee, which requires identifying which outputs are from/to you, and which are change. This requires knowing what keys belong to you. It does not query the blockchain, but you can use 'getrawtransaction [txid] 1' to get a decoded form of blockchain transactions (with txindex enabled).

  • I wonder how the gettransaction command, which uses the accounts feature, will list a transaction (in the GUI) and the corresponding ID when a move is issued. I also wonder about what conditions will cause something other than a -000 to appear. – halfbit Feb 18 '14 at 1:08
  • I need to generate more test data, but it seems that error checking on the "get a specific output" doesn't work as expected. e.g. I don't get an error with this gettransaction 54b9be14443b152b02ed0b18d27504631cccfa84ce9ada03f9558fbb85b6129c-Invalid – halfbit Feb 18 '14 at 1:14
  • If the sender uses sendmany, yoh are unlikely to be the first output, so that will likely result in another suffix than -000. The genesis coinbase transaction is special, and is never processed in terms of the consensus rule. For that reason, it's also not indexed. – Pieter Wuille Feb 18 '14 at 8:02
  • A move is not a transaction, and you cannot query it using gettransaction. – Pieter Wuille Feb 18 '14 at 11:12

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.