0

I'm using JSON-RPC call to connect to local bitcoin node on my clouding server. I could get all transactions with wallet name by using gettransactions. Now I need to get sender's address for each transaction but result contains only receivers' address. Following is response of gettransactions request. { "result": [ { "address": "bc1qd9mgd4ynryaw2kp0pzfjdxguhz9dzvs5vh0nfn", "category": "receive", "amount": 0.001, "label": "", "vout": 27, "confirmations": 1322, "blockhash": "000000000000000000074551080f954e790edfe6ad810ecebf4691e881175eaf", "blockheight": 660029, "blockindex": 106, "blocktime": 1607147554, "txid": "07ab59c8d3a204172887085258460d0058c20a9acdb451daa5ad4290cbd461b0", "walletconflicts": [], "time": 1607147511, "timereceived": 1607147511, "bip125-replaceable": "no" }, { "address": "bc1q6dh3h5e3qgku8u9s8y664844fj4fkm08n7cnwt", "category": "receive", "amount": 0.0011, "label": "", "vout": 9, "confirmations": 1313, "blockhash": "00000000000000000000960f4476a8552cac203eec6e0f826886b41fae402bec", "blockheight": 660038, "blockindex": 393, "blocktime": 1607153799, "txid": "af0885e4c1d10e935de525680c6c33d221ab506742b08e34a0322bba90b56fb0", "walletconflicts": [], "time": 1607152236, "timereceived": 1607152236, "bip125-replaceable": "no" }, { "address": "1L8ZNCibVVpPjJ8VJ1ALLuTjtctA4mzGPw", "category": "send", "amount": -0.001, "vout": 0, "fee": -0.00008536, "confirmations": 706, "blockhash": "0000000000000000000c3230522e267980bb990883cc0b36460ad3efc1f8fed4", "blockheight": 660645, "blockindex": 1049, "blocktime": 1607529332, "txid": "a2056e7a49bc608435713519bc038ed7da2e65f588495f36c6628f5ca6fe2d7d", "walletconflicts": [], "time": 1607528963, "timereceived": 1607528963, "bip125-replaceable": "no", "comment": " ", "to": "seans outpost", "abandoned": false }, { "address": "1L8ZNCibVVpPjJ8VJ1ALLuTjtctA4mzGPw", "category": "send", "amount": -0.0005, "vout": 1, "fee": -0.00008536, "confirmations": 705, "blockhash": "0000000000000000000994e21412109847caffa2bd990884f49461d53c047055", "blockheight": 660646, "blockindex": 844, "blocktime": 1607529675, "txid": "ddbe1dce4537926b6cf5bc1e222e5cd32de224cf346ca89251c127ce32226f30", "walletconflicts": [], "time": 1607529401, "timereceived": 1607529401, "bip125-replaceable": "no", "comment": " ", "to": "seans outpost", "abandoned": false } ], "error": null, "id": "curltest" }

How can I get sender's address ?

1
  • 1
    What do you need the sender address for? Bitcoin doesn't really have such a concept. There are approximations but they're often wrong. If the goal is distinguishing multiple payments to determine who paid, the best practice is giving a different receiving address to for every payment. – Pieter Wuille Dec 14 '20 at 19:04
1

Despite how it looks on most block explorers, Bitcoin doesn't really have a concept of a "sender address", at least not on the raw transaction level. What a transaction has is inputs and what block explorers do is go look up those inputs and guess the address that was used to create those UTXOs.

You might find these related questions useful (just search this site for "sender address"):

How to findout the sender of a transaction

Sender address from DecodeRawTransaction (C#)

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.