<p>Bitcoin Core has three types of transaction categories: <code>send</code>, <code>receive</code>, and <code>move</code>.</p>

<p>It differentiates between these as follows:</p>

<ol>
<li><p><code>move</code> - This tx is not an onchain one, and has no transaction id. It is simply moving BTC from one wallet account to another (accounts are not addresses, but groupings of addresses). This is done using the <code>move</code> RPC call</p></li>
<li><p><code>send</code> - A send tx is one where an utxo from your wallet is used as the input to a transaction. This usually have a fee, since the fee is debited from the total sum of the utxos.</p></li>
<li><p><code>receive</code> - A receive tx is one where a new utxo spendable (or watched) by your wallet is created. These don't have a fee as you don't pay anything to receive Bitcoin.</p></li>
</ol>

<p>You can see the <a href="https://github.com/bitcoin/bitcoin/blob/3de01268b7048a9c85f31dc6d21d44b727e860a5/src/wallet/rpcwallet.cpp#L1651" rel="nofollow noreferrer">ListTransaction</a> code here.</p>

CC BY-SA 3.0
2018-04-04T14:37:00.403Z
What about HD wallet, when for example importing your mnemonic phrase on blockchain.info they differentiate `sent` and `receive` transaction! how is that?
Tailer
CC BY-SA 3.0
2018-04-04T14:39:54.787Z
Bitcoin core also utilizes HD wallets, the type of wallet doesn't change anything. A send/receive tx is differentiated the same way in every wallet, which is by utxos being spent/created.
Raghav Sood
CC BY-SA 3.0
2018-04-04T01:40:40.180Z
2018-04-04T01:40:40.180Z
Raghav Sood
<p>How does Bitcoin core differentiate transactions category?</p>

<p>for instance, when we are calling <code>listtrnasctions</code> in the response body we have <code>category</code>, how bitcoin core assigns category type for a transaction?
Programmatically, How it decides that some transaction should have <code>send</code> or <code>receive</code> string.  </p>

<p>The answer is in here: </p>

<pre><code>// Sent
if ((!listSent.empty() || nFee != 0) &amp;&amp; (fAllAccounts || strAccount == strSentAccount))
{

}

// Received
if (listReceived.size() &gt; 0 &amp;&amp; wtx.GetDepthInMainChain() &gt;= nMinDepth)
{


}
</code></pre>

<p>Can someone read and explain the code? I see that <code>receive</code> transactions have zero fees, and Bitcoin core considers transactions with fees as sent.</p>

<transactions><bitcoin-core>
Programmatically, How does Bitcoin core differentiate transactions category?
Tailer
# Programmatically, How does Bitcoin core differentiate transactions category?

(Asked by: username_0 on 2018-04-03)

How does Bitcoin core differentiate transactions category?

for instance, when we are calling `listtrnasctions` in the response body we have `category`, how bitcoin core assigns category type for a transaction?
Programmatically, How it decides that some transaction should have `send` or `receive` string.

The answer is in here:

```
// Sent
if ((!listSent.empty() || nFee != 0) && (fAllAccounts || strAccount == strSentAccount))
{

}

// Received
if (listReceived.size() > 0 && wtx.GetDepthInMainChain() >= nMinDepth)
{

}

```

Can someone read and explain the code? I see that `receive` transactions have zero fees, and Bitcoin core considers transactions with fees as sent.

**Tags:** transactions, bitcoin-core


---

## 1 answers

### Answer by username_1 on 2018-04-04. Score: 0 | Accepted answer

Bitcoin Core has three types of transaction categories: `send`, `receive`, and `move`.

It differentiates between these as follows:

1. `move` - This tx is not an onchain one, and has no transaction id. It is simply moving BTC from one wallet account to another (accounts are not addresses, but groupings of addresses). This is done using the `move` RPC call
2. `send` - A send tx is one where an utxo from your wallet is used as the input to a transaction. This usually have a fee, since the fee is debited from the total sum of the utxos.
3. `receive` - A receive tx is one where a new utxo spendable (or watched) by your wallet is created. These don't have a fee as you don't pay anything to receive Bitcoin.

You can see the [ListTransaction](https://github.com/bitcoin/bitcoin/blob/3de01268b7048a9c85f31dc6d21d44b727e860a5/src/wallet/rpcwallet.cpp#L1651) code here.

> **Comments:**
> **username_0**: What about HD wallet, when for example importing your mnemonic phrase on blockchain.info they differentiate `sent` and `receive` transaction! how is that?  
> **username_1**: Bitcoin core also utilizes HD wallets, the type of wallet doesn't change anything. A send/receive tx is differentiated the same way in every wallet, which is by utxos being spent/created.  

---

