0

So I'm running the btcd node and wallet in simnet. I've generated more than 100 blocks. I've a few accounts on the same wallet. The list of the accounts:

$ btcctl --rpcuser=foo --rpcpass=123456 --simnet --wallet listaccounts
{
  "account1": 13.7,
  "account2": 0,
  "default": 5601,
  "imported": 0
}

The default receives the reward for the generated block. Obviously I've moved some bitcoins already from the default to account1. Now I want to move 1 bitcoin from default to account2

$ btcctl --rpcuser=foo --rpcpass=123456 --wallet --simnet sendtoaddress "SSBjQ58PsRmBtGZQ8ckXFRxijZFCBdeMMT" 1
e1a0b9c3df3297b4f50b210da3e63fda701dea4eb8638248e877b1308fdd3a61

I mine the block:

$ btcctl --simnet --wallet --rpcuser=foo --rpcpass=123456 generate 1
[
  "6cd2423869ee9b865df759e6c60978b3899bfcf3d4f7174a4287971822bef5e5"
]

When I check the accounts I see this:

$ btcctl --rpcuser=foo --rpcpass=123456 --simnet --wallet listaccounts
{
  "account1": 13.7,
  "account2": 1,
  "default": 5601,
  "imported": 0
}

Inspecting the transaction:

$ btcctl --simnet --wallet --rpcuser=foo --rpcpass=123456 gettransaction e1a0b9c3df3297b4f50b210da3e63fda701dea4eb8638248e877b1308fdd3a61
{
  "amount": 1,
  "fee": 0.00000224,
  "confirmations": 402,
  "blockhash": "6cd2423869ee9b865df759e6c60978b3899bfcf3d4f7174a4287971822bef5e5",
  "blockindex": 0,
  "blocktime": 1591446501,
  "txid": "e1a0b9c3df3297b4f50b210da3e63fda701dea4eb8638248e877b1308fdd3a61",
  "walletconflicts": [],
  "time": 1591446501,
  "timereceived": 1591446501,
  "details": [
    {
      "account": "",
      "amount": -50,
      "category": "send",
      "fee": 0.00000224,
      "vout": 0
    },
    {
      "account": "account2",
      "address": "SSBjQ58PsRmBtGZQ8ckXFRxijZFCBdeMMT",
      "amount": 1,
      "category": "receive",
      "vout": 0
    }
  ],
  "hex": "0100000001129d6eb50f40f48e869413dbade07f055204b221322788ef90c1ca187e8cd09f000000006a473044022028a04f05d8a381210b7e89493d1946d25f8c211d3973a1164d3a0a5f4fee958202206709c6171fba242060fc9dbf1a4bb3ad14b18a45741282f1d55ed764bffed8480121035354d2edb51d3f05f8c0e31f7ab5ba7f97ff179b5e09005ec018c445c0d761d3ffffffff0200e1f505000000001976a91435a915238472497b40660cf625dee8c7ce3f3ae388ac2010102401000000160014708d04eb727ec0a8fdb7b362233ff8684056d21800000000"
}

After that I've generated many other blocks. My question is: why the transaction contains a "send" category of 50 bitcoins and another category "receive" for 1 bitcoin? Shouldn't be only 1 entry for 1 bitcoin? Why does the balance of the default account is still the same? It should be with 49 more since I've mined the block, got the reward and sent 1.

  • related: How does change work in a bitcoin transaction? – Murch Jun 6 '20 at 17:59
  • @Murch thanks. So according to the answers there I have to get the "change" of those 50 back. Either to the same address or to a new one, but that doesn't happen. Any idea? – Ivaylo Ivanov Jun 6 '20 at 18:29
  • @IvayloIvanov you don't need to 'get the change back', it will just have been sent to a different address you wallet controls. No extra steps needed on your end. – chytrik Jun 6 '20 at 20:14
  • 3
    Does this answer your question? UTXO model vs. account/balance model – chytrik Jun 6 '20 at 20:14
  • @chytrik I got that I "should" get the change in a new address. The problem is that I do not see that new address and the balance is not reflected, according to the output as you can see above. The balance of the "default" account is missing 49 bitcoins. What command should I write to see that new address and the balance for it? The way I see it, that new address has to be added to the "default" account and the balance for that account has to be reflected. – Ivaylo Ivanov Jun 7 '20 at 6:02

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.