1

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());

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.