<p>I have two addresses in my wallet and sent some coins to one and set change to the other, both addresses are wallet generated addresses(not watchonly ones), but the transaction returned from RPC shows that amount is zero and the there are four outputs instead of two, and each coin is both sent and received by the same address? What am i getting wrong?</p>

<pre><code>gettransaction c4735f12a8ae068055593ef6e3c3d578c369c828c81cbfe2cd970bdb2c588a85 true
{
  "amount": 0.00000000,
  "fee": -0.00001130,
  "confirmations": 6,
  "blockhash": "000000000000007c45c59e9fa71d75d334859cab9da3386798ae550f1be8940e",
  "blockindex": 65,
  "blocktime": 1515245645,
  "txid": "c4735f12a8ae068055593ef6e3c3d578c369c828c81cbfe2cd970bdb2c588a85",
  "walletconflicts": [
  ],
  "time": 1515245166,
  "timereceived": 1515245166,
  "bip125-replaceable": "no",
  "details": [
    {
      "involvesWatchonly": true,
      "account": "",
      "address": "n2VgmTfSAjukziKHRjQufSg7PUkePqrFbq",
      "category": "send",
      "amount": -0.09998870,
      "label": "",
      "vout": 0,
      "fee": -0.00001130,
      "abandoned": false
    },
    {
      "involvesWatchonly": true,
      "account": "",
      "address": "moh3VAtZZQBvdC7ivvuZxoU7q9bAP7R2Lu",
      "category": "send",
      "amount": -1.00000000,
      "label": "",
      "vout": 1,
      "fee": -0.00001130,
      "abandoned": false
    },
    {
      "involvesWatchonly": true,
      "account": "",
      "address": "n2VgmTfSAjukziKHRjQufSg7PUkePqrFbq",
      "category": "receive",
      "amount": 0.09998870,
      "label": "",
      "vout": 0
    },
    {
      "involvesWatchonly": true,
      "account": "",
      "address": "moh3VAtZZQBvdC7ivvuZxoU7q9bAP7R2Lu",
      "category": "receive",
      "amount": 1.00000000,
      "label": "",
      "vout": 1
    }
  ],
  "hex": "010000000140a74a0ee2e91070e18c8c80242463f610e11ed9033ff9f030ed0933fc60f19d000000006a473044022063c5c3d94a7c29d7b839e92148f4bed3b5de524791b4f23fa3ade5b9d842575d022044821cc103e3ee014f8d2578e7d143802b764ccd90a887677b31b6475ed0e3cc012102395c1b675e55c9a9a4d689ad893fc9ec261f9b5a64799d233379a1c15aee7e3cffffffff0216929800000000001976a914e61d43895e54b2fb14fef2fef8561f310dfb364a88ac00e1f505000000001976a91459a97feb2d0444d756d2c7bc5fbd472ae9836c5688ac00000000"
}
</code></pre>

<p>Code to build the transaction:</p>

<pre><code>TransactionBuilder tb = new TransactionBuilder();
        var tx = tb.AddCoins(t).AddKeys(key)
            .Send(new BitcoinPubKeyAddress("moh3VAtZZQBvdC7ivvuZxoU7q9bAP7R2Lu"), new Money(1, MoneyUnit.BTC))
            .SetChange(new BitcoinPubKeyAddress("n2VgmTfSAjukziKHRjQufSg7PUkePqrFbq"))
            .SendFees(1130)
            .BuildTransaction(true);
var rsp = service.SendRawTransaction(tx.ToHex());
</code></pre>

CC BY-SA 3.0
2018-01-06T14:41:14.023Z
How did you create and send the transaction?
Matthew Stannard
CC BY-SA 3.0
2018-01-06T14:42:40.280Z
I was learning about programming bitcoin, I used Nbitcoin to build and send the transaction.
fluter
CC BY-SA 3.0
2018-01-06T14:53:33.663Z
Were you following any documentation or tutorials to help you build and send the transaction?
Matthew Stannard
CC BY-SA 3.0
2018-01-06T15:57:50.980Z
I followed the basic samples to build the transaction, https://www.codeproject.com/Articles/835098/NBitcoin-Build-Them-All
fluter
<transactions><json-rpc>
Confusing about received transaction?
fluter
# Confusing about received transaction?

(Asked by: username_0 on 2018-01-06)

I have two addresses in my wallet and sent some coins to one and set change to the other, both addresses are wallet generated addresses(not watchonly ones), but the transaction returned from RPC shows that amount is zero and the there are four outputs instead of two, and each coin is both sent and received by the same address? What am i getting wrong?

```
gettransaction c4735f12a8ae068055593ef6e3c3d578c369c828c81cbfe2cd970bdb2c588a85 true
{
  "amount": 0.00000000,
  "fee": -0.00001130,
  "confirmations": 6,
  "blockhash": "000000000000007c45c59e9fa71d75d334859cab9da3386798ae550f1be8940e",
  "blockindex": 65,
  "blocktime": 1515245645,
  "txid": "c4735f12a8ae068055593ef6e3c3d578c369c828c81cbfe2cd970bdb2c588a85",
  "walletconflicts": [
  ],
  "time": 1515245166,
  "timereceived": 1515245166,
  "bip125-replaceable": "no",
  "details": [
    {
      "involvesWatchonly": true,
      "account": "",
      "address": "n2VgmTfSAjukziKHRjQufSg7PUkePqrFbq",
      "category": "send",
      "amount": -0.09998870,
      "label": "",
      "vout": 0,
      "fee": -0.00001130,
      "abandoned": false
    },
    {
      "involvesWatchonly": true,
      "account": "",
      "address": "moh3VAtZZQBvdC7ivvuZxoU7q9bAP7R2Lu",
      "category": "send",
      "amount": -1.00000000,
      "label": "",
      "vout": 1,
      "fee": -0.00001130,
      "abandoned": false
    },
    {
      "involvesWatchonly": true,
      "account": "",
      "address": "n2VgmTfSAjukziKHRjQufSg7PUkePqrFbq",
      "category": "receive",
      "amount": 0.09998870,
      "label": "",
      "vout": 0
    },
    {
      "involvesWatchonly": true,
      "account": "",
      "address": "moh3VAtZZQBvdC7ivvuZxoU7q9bAP7R2Lu",
      "category": "receive",
      "amount": 1.00000000,
      "label": "",
      "vout": 1
    }
  ],
  "hex": "010000000140a74a0ee2e91070e18c8c80242463f610e11ed9033ff9f030ed0933fc60f19d000000006a473044022063c5c3d94a7c29d7b839e92148f4bed3b5de524791b4f23fa3ade5b9d842575d022044821cc103e3ee014f8d2578e7d143802b764ccd90a887677b31b6475ed0e3cc012102395c1b675e55c9a9a4d689ad893fc9ec261f9b5a64799d233379a1c15aee7e3cffffffff0216929800000000001976a914e61d43895e54b2fb14fef2fef8561f310dfb364a88ac00e1f505000000001976a91459a97feb2d0444d756d2c7bc5fbd472ae9836c5688ac00000000"
}

```

Code to build the transaction:

```
TransactionBuilder tb = new TransactionBuilder();
        var tx = tb.AddCoins(t).AddKeys(key)
            .Send(new BitcoinPubKeyAddress("moh3VAtZZQBvdC7ivvuZxoU7q9bAP7R2Lu"), new Money(1, MoneyUnit.BTC))
            .SetChange(new BitcoinPubKeyAddress("n2VgmTfSAjukziKHRjQufSg7PUkePqrFbq"))
            .SendFees(1130)
            .BuildTransaction(true);
var rsp = service.SendRawTransaction(tx.ToHex());

```

**Tags:** transactions, json-rpc

> **Comments:**
> **username_1**: How did you create and send the transaction?  
> **username_0**: I was learning about programming bitcoin, I used Nbitcoin to build and send the transaction.  
> **username_1**: Were you following any documentation or tutorials to help you build and send the transaction?  
> **username_0**: I followed the basic samples to build the transaction, https://www.codeproject.com/Articles/835098/NBitcoin-Build-Them-All  

---

## 0 answers

