<p>Q1: A ledger entry in the wallet view corresponds to a single <em>output</em> 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.</p>

<p>Q2: <code>getrawtransaction</code> queries the memory pool, the set of unspent transaction outputs and the blockchain (if <code>txindex</code> 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 <code>gettxout</code> 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. <code>decoderawtransaction</code> can do this for arbitrary hex-encoded raw transactions. Perhaps this is the answer to Q3.</p>

<p>Q3: <code>gettransaction</code> 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 '<code>getrawtransaction</code> [txid] 1' to get a decoded form of blockchain transactions (with <code>txindex</code> enabled).</p>

CC BY-SA 3.0
2014-02-18T01:08:11.203Z
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.
makerofthings7
CC BY-SA 3.0
2014-02-18T01:14:58.517Z
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`
makerofthings7
CC BY-SA 3.0
2014-02-18T08:02:52.260Z
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
CC BY-SA 3.0
2014-02-18T11:12:01.170Z
A move is not a transaction, and you cannot query it using gettransaction.
Pieter Wuille
CC BY-SA 3.0
2014-02-18T00:53:31.517Z
2014-02-18T00:53:31.517Z
Pieter Wuille
<p>I right clicked the transaction history in the QT client and pasted in the TxID below.</p>

<p><strong>Q1</strong></p>

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

<pre><code>gettransaction 54b9be14443b152b02ed0b18d27504631cccfa84ce9ada03f9558fbb85b6129c-000
</code></pre>

<p><strong>Q2</strong></p>

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

<pre><code>getrawtransaction 54b9be14443b152b02ed0b18d27504631cccfa84ce9ada03f9558fbb85b6129c-000
ERROR: parameter 1 must be hexadecimal string
</code></pre>

<p><strong>Q3</strong></p>

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

CC BY-SA 3.0
2014-02-18T00:53:43.193Z
self-research comment#1 - [Here is some commentary](https://github.com/bitcoin/bitcoin/pull/2802) on the getrawtransaction feature
makerofthings7
<transactions><bitcoind><bitcoin-core><json-rpc><raw-transaction>
Can anyone explain the differences in behavior of getrawtransaction and gettransaction in RPC?
makerofthings7
# Can anyone explain the differences in behavior of getrawtransaction and gettransaction in RPC?

(Asked by: username_0 on 2014-02-18)

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

**Q1**

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

```
gettransaction 54b9be14443b152b02ed0b18d27504631cccfa84ce9ada03f9558fbb85b6129c-000

```

**Q2**

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

```

**Q3**

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

**Tags:** transactions, bitcoind, bitcoin-core, json-rpc, raw-transaction

> **Comments:**
> **username_0**: self-research comment#1 - [Here is some commentary](https://github.com/bitcoin/bitcoin/pull/2802) on the getrawtransaction feature  

---

## 1 answers

### Answer by username_1 on 2014-02-18. Score: 1 | Accepted answer

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).

> **Comments:**
> **username_0**: 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.  
> **username_0**: 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`  
> **username_1**: 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.  
> **username_1**: A move is not a transaction, and you cannot query it using gettransaction.  

---

