0

Given a BTC transaction such as this, how do I find the net amount person A sent to person B. I have searched all over and people start bringing up change wallets and all this other stuff. All I want to know, is given this transaction how can I convert it into something like: A --1.32BTC--> B. I don't care about what wallets the change was sent to, or what wallets were the inputs. All I need to know is how much did person A lose in the transaction and how much did person B gain. Thanks

{
"txid":"7afbbb1e606cc232602944b79ae90e9530b74776a923e9ec044a30738c679931",
"version":1,"locktime":0,
"vin":[{"txid":"8607869dc4f89440dee4ed5f9a32a4610cd0b6065ca66f7891ddf7d65ed09d07",
"vout":0,
"scriptSig":{"asm":"304402202882405db1bae04e1a13f1609beac47ea3afebe3668a44fe8ab393ac768e194d022015d3a915ba662097000bf90191a938949141fe9f16918e845d20fe1af2003e01[ALL] 03166a538434ad1ec63fc5265dbbcbfbd521ca513593f7edc4d5929b285f6d4422","hex":"47304402202882405db1bae04e1a13f1609beac47ea3afebe3668a44fe8ab393ac768e194d022015d3a915ba662097000bf90191a938949141fe9f16918e845d20fe1af2003e01012103166a538434ad1ec63fc5265dbbcbfbd521ca513593f7edc4d5929b285f6d4422"},
"sequence":4294967295,
"n":0,
"addr":"16jyig11zSX77NV3o4AcWiw57m1tqLogg",
"valueSat":229438,
"value":0.00229438,
"doubleSpentTxID":null}],
"vout":[
{"value":"0.00008203",
"n":0,"scriptPubKey":{"hex":"76a9140115f4b99e9c537bb584149191723841c6171a6f88ac",
"asm":"OP_DUP OP_HASH160 0115f4b99e9c537bb584149191723841c6171a6f OP_EQUALVERIFY OP_CHECKSIG",
"addresses":["16jyig11zSX77NV3o4AcWiw57m1tqLogg"],
"type":"pubkeyhash"},
"spentTxId":null,
"spentIndex":null,
"spentHeight":null},
{"value":"0.00185075",
"n":1,
"scriptPubKey":{"hex":"a914b0458d1ab4d0fcffc7fd1014d6e62ad8120d294787",
"asm":"OP_HASH160 b0458d1ab4d0fcffc7fd1014d6e62ad8120d2947 OP_EQUAL","addresses":["3Hm4AomkLBGgHHMVMYqoxpTyn1tvf6u4dh"],
"type":"scripthash"},
"spentTxId":null,
"spentIndex":null,
"spentHeight":null}],
"blockheight":-1,
"confirmations":0,
"time":1515372033,
"valueOut":0.00193278,
"size":223,
"valueIn":0.00229438,
"fees":0.0003616}
1

If you have a look at the "vout" array, you can see there are two outputs from this transaction. The first pays 0.00008203 BTC to 16jyig11zSX77NV3o4AcWiw57m1tqLogg, and the second pays 0.00185075 BTC to 3Hm4AomkLBGgHHMVMYqoxpTyn1tvf6u4dh. There is a single input into the transaction, from the address 16jyig11zSX77NV3o4AcWiw57m1tqLogg (which must have been calculated by a block explorer because inputs do not have "from" addresses). The value of the input was 0.00229438, and it looks like the first output was to the same address as the input address so it is likely change, thus person A lost (0.00229438 - 0.00008203 = 0.00221235 BTC), and person B (could technically also be person A paying themselves) gained 0.00185075 BTC. The rest, 0.0003616 BTC, was paid as a fee to the miners.

| improve this answer | |
  • 1
    That works in this example. But in practice, most people use fresh addresses for change. In that case, neither of the output addresses will equal the input, and you won't have any way to know which of the two belongs to the real recipient B and which is the change address belonging to A. As such, what the asker wants is in general impossible. – Nate Eldredge Jan 8 '18 at 3:29
  • Yeah I'm trying to generalize it. It just seems so convoluted how the person has to receive change in a new wallet. I thought there would be an easy way to simplify the transaction. – Colman Koivisto Jan 8 '18 at 5:57

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.