How to get sender address from transaction with JSON RPC? 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.
{
&quot;result&quot;: [
{
&quot;address&quot;: &quot;bc1qd9mgd4ynryaw2kp0pzfjdxguhz9dzvs5vh0nfn&quot;,
&quot;category&quot;: &quot;receive&quot;,
&quot;amount&quot;: 0.001,
&quot;label&quot;: &quot;&quot;,
&quot;vout&quot;: 27,
&quot;confirmations&quot;: 1322,
&quot;blockhash&quot;: &quot;000000000000000000074551080f954e790edfe6ad810ecebf4691e881175eaf&quot;,
&quot;blockheight&quot;: 660029,
&quot;blockindex&quot;: 106,
&quot;blocktime&quot;: 1607147554,
&quot;txid&quot;: &quot;07ab59c8d3a204172887085258460d0058c20a9acdb451daa5ad4290cbd461b0&quot;,
&quot;walletconflicts&quot;: [],
&quot;time&quot;: 1607147511,
&quot;timereceived&quot;: 1607147511,
&quot;bip125-replaceable&quot;: &quot;no&quot;
},
{
&quot;address&quot;: &quot;bc1q6dh3h5e3qgku8u9s8y664844fj4fkm08n7cnwt&quot;,
&quot;category&quot;: &quot;receive&quot;,
&quot;amount&quot;: 0.0011,
&quot;label&quot;: &quot;&quot;,
&quot;vout&quot;: 9,
&quot;confirmations&quot;: 1313,
&quot;blockhash&quot;: &quot;00000000000000000000960f4476a8552cac203eec6e0f826886b41fae402bec&quot;,
&quot;blockheight&quot;: 660038,
&quot;blockindex&quot;: 393,
&quot;blocktime&quot;: 1607153799,
&quot;txid&quot;: &quot;af0885e4c1d10e935de525680c6c33d221ab506742b08e34a0322bba90b56fb0&quot;,
&quot;walletconflicts&quot;: [],
&quot;time&quot;: 1607152236,
&quot;timereceived&quot;: 1607152236,
&quot;bip125-replaceable&quot;: &quot;no&quot;
},
{
&quot;address&quot;: &quot;1L8ZNCibVVpPjJ8VJ1ALLuTjtctA4mzGPw&quot;,
&quot;category&quot;: &quot;send&quot;,
&quot;amount&quot;: -0.001,
&quot;vout&quot;: 0,
&quot;fee&quot;: -0.00008536,
&quot;confirmations&quot;: 706,
&quot;blockhash&quot;: &quot;0000000000000000000c3230522e267980bb990883cc0b36460ad3efc1f8fed4&quot;,
&quot;blockheight&quot;: 660645,
&quot;blockindex&quot;: 1049,
&quot;blocktime&quot;: 1607529332,
&quot;txid&quot;: &quot;a2056e7a49bc608435713519bc038ed7da2e65f588495f36c6628f5ca6fe2d7d&quot;,
&quot;walletconflicts&quot;: [],
&quot;time&quot;: 1607528963,
&quot;timereceived&quot;: 1607528963,
&quot;bip125-replaceable&quot;: &quot;no&quot;,
&quot;comment&quot;: &quot; &quot;,
&quot;to&quot;: &quot;seans outpost&quot;,
&quot;abandoned&quot;: false
},
{
&quot;address&quot;: &quot;1L8ZNCibVVpPjJ8VJ1ALLuTjtctA4mzGPw&quot;,
&quot;category&quot;: &quot;send&quot;,
&quot;amount&quot;: -0.0005,
&quot;vout&quot;: 1,
&quot;fee&quot;: -0.00008536,
&quot;confirmations&quot;: 705,
&quot;blockhash&quot;: &quot;0000000000000000000994e21412109847caffa2bd990884f49461d53c047055&quot;,
&quot;blockheight&quot;: 660646,
&quot;blockindex&quot;: 844,
&quot;blocktime&quot;: 1607529675,
&quot;txid&quot;: &quot;ddbe1dce4537926b6cf5bc1e222e5cd32de224cf346ca89251c127ce32226f30&quot;,
&quot;walletconflicts&quot;: [],
&quot;time&quot;: 1607529401,
&quot;timereceived&quot;: 1607529401,
&quot;bip125-replaceable&quot;: &quot;no&quot;,
&quot;comment&quot;: &quot; &quot;,
&quot;to&quot;: &quot;seans outpost&quot;,
&quot;abandoned&quot;: false
}
],
&quot;error&quot;: null,
&quot;id&quot;: &quot;curltest&quot;
}
How can I get sender's address ?
Despite how it looks on most block explorers, Bitcoin doesn't really have a concept of a &quot;sender address&quot;, 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 &quot;sender address&quot;):
How to findout the sender of a transaction
Sender address from DecodeRawTransaction (C#)