0

I have a TXid in my wallet that contains multiple transactions (multiple sends and receives). From what I read these are transactions the network creates facilitate splitting/combining multiple inputs/outputs etc. When I gettransaction in the wallet I have I see

gettransaction 3dda59bf9801f88...5498dd7fd1c3f9577963b94
{
  "amount": -17.00000000,
  "fee": 20.00000000,

  "details": [
    {
      "account": "",
      "category": "send",
      "amount": 0.00000000,
      "vout": 0,
      "fee": 20.00000000
    },
    {
      "account": "",
      "address": "GPP7ic67...9TgitCB21r",
      "category": "send",
      "amount": -20.00000000,
      "vout": 1,
      "fee": 20.00000000
    },
    {
      "account": "",
      "address": "GPP7ic67...9TgitCB21r",
      "category": "send",
      "amount": -17.00000000,
      "vout": 2,
      "fee": 20.00000000
    },
    {
      "account": "TestWallet",
      "address": "GPP7ic67...9TgitCB21r",
      "category": "receive",
      "amount": 20.00000000,
      "vout": 1
    }
  ],

So, I'm trying to figure out what the net result of this transaction is. I received -17 and I had 20 fee. Does that mean I net loss 37?

0

hmmm, yes, this accounting system within bitcoin :-) bitcoin.SE is full of questions according to the balance on accounts.

The "-17" would indicate, that funds left from a known address in your wallet to an "external" target address. And if fees is 20, then yes, you have "outgoing" 37 coins. Btw: what system are you playing on? Addresses starting with "GPP"...?

When I was playing with the regtest env, I discovered that only "gettxout" provides reliable info, which tx might have funds. See also the thread here.

Here a short linux shell script, to fetch the idea. It needs to get updated to cope with many inputs, so one would need to iterate through the VINs...

  b_cli="bitcoind -regtest"
  FUNDING_TXID=3dda59bf9801f88...5498dd7fd1c3f9577963b94

  TX_PREV_VOUT=$( $b_cli gettransaction $FUNDING_TXID | \
                  awk '/vout/ {  print $2; exit }'    | tr -d "," )

  $b_cli gettxout $FUNDING_TXID $TX_PREV_VOUT

  # as per Pieter's comment, spendable VINs return "something"...
  if [ ${#ret_val} -gt 0 ]; then
    echo " ## This tx has spendable funds"
  else
    echo " ## no spendable funds on $FUNDING_TXID"
  fi

Adding up all the parts, which have spendable funds, would then be "your" balance. And you could check "in" and "out" going funds in your wallet.

  • So this is not from bitcoin it is a wallet from an alternative POS coin but the CLI is almost identical to the bitcoin-cli. Either way, I looked into other transactions where I sent out money and the "fee" value was negative. Knowing that I ran the number and my net is actually "amount" + "fee" so this tx was a net gain of 3. After some reading I realized this was a staking reward. – LoganHenderson Mar 26 '18 at 8:55

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.