How to reconstruct a transaction detail from the blockchain?

0

Based on the following blockchain json data, I picked a random transaction and want to understand the amounts transacted:

source: https://blockchain.info/block-height/502070?format=json

{
   "lock_time":502039,
   "ver":1,
   "size":225,
   "inputs":[
      {
         "sequence":4294967294,
         "witness":"",
         "prev_out":{
            "spent":true,
            "tx_index":318981069,
            "type":0,
            "addr":"1MppuHQwHjmYunvpzd8LjHMKDhtk2974aD",
            "value":153295388,
            "n":0,
            "script":"76a914e46e0d4e9420768f3b0925069f92fdde2136d5db88ac"
         },
         "script":"47304402207f77cd1b8e82bba37b0d0636fa9f10b67f1aebd3cc20ff30223495825f1af8200220300ae8a8985e9a183ff5522dc86421eff5592dc74e96750330501b41d61de99f012102acb5fd6d1f86719ee9a0c0da3d7a0d63a068cba7c123c2e77988d130884b20c3"
      }
   ],
   "weight":900,
   "time":1514824905,
   "tx_index":318988523,
   "vin_sz":1,
   "hash":"a712e4036222c2cc821443bfbbeb33f94903d2fee08b8e8f1eccada75cf6a9d8",
   "vout_sz":2,
   "relayed_by":"0.0.0.0",
   "out":[
      {
         "spent":true,
         "tx_index":318988523,
         "type":0,
         "addr":"1AeqgtHedfA2yVXH6GiKLS2JGkfWfgyTC6",
         "value":500000,
         "n":0,
         "script":"76a91469e12a40d4a2218d33f208b9a0447894dc9bea3188ac"
      },
      {
         "spent":true,
         "tx_index":318988523,
         "type":0,
         "addr":"1GawcJQjTQtzYUX2wgxfbjDTQcVJiPLUqW",
         "value":151985709,
         "n":1,
         "script":"76a914aaf532cf834863dcdeb4164ec3a4ab413619d98388ac"
      }
   ]
}

Based on this I would guess that the input address sent 153295388 satoshis. And the two out addresses both received some satoshis, but the sum do not add up:

153295388 - 500000 - 151985709 = 809679

I see a difference of 809679 satoshis between the input and the sum of output. Is that the transaction fee, and if yes, how is this decided?

tucson

Posted 2018-01-05T09:14:57.317

Reputation: 111

Answers

1

I can see the answer now here concerning the fee:

https://blockchain.info/tx/a712e4036222c2cc821443bfbbeb33f94903d2fee08b8e8f1eccada75cf6a9d8

so yes, 809679 is the transaction fee.

tucson

Posted 2018-01-05T09:14:57.317

Reputation: 111

1+1 for answering your own question. To help a bit more: the input addr 1MppuHQwHjmYunvpzd8LjHMKDhtk2974aD holds a value of 153295388, thereof 500000 shall go to addr 1AeqgtHedfA2yVXH6GiKLS2JGkfWfgyTC6. The "return" address 1GawcJQjTQtzYUX2wgxfbjDTQcVJiPLUqW shall receive a value of 151985709. Whatever remains unspent, goes into tx fees for a miner. So it is up to the wallet software to make sure, tx are composed in a way, that one doesn't loose to many satoshis as txfee.pebwindkraft 2018-01-05T21:34:48.730