I am scanning the bitcoin blocks and looking for transactions that involve my list of addresses. This is more like a wallet hosting service. I need the "From" and "To" addresses used in the transaction.
I am using the "bitcoin-cli gettransaction" method to get transaction details.
I know that VIN block should contain the sender addresses and VOUT block should be the receiving addresses. I can see the VOUT block with receiving addresses, but I can't see the "From" addresses in VIN block.
How can I get the "from" and "To" address in bitcoin transaction?
Here is a data sample,
"vin": [
{
"txid": "c5355fe45f785f14f15b3e41894e21083978e9e78ed23b7a3a00f0061ec735a5",
"vout": 1,
"scriptSig": {
"asm": "",
"hex": ""
},
"txinwitness": [
"3045022100f5ee5cb40a06419c55eb2de549ee97daf77a8e2588d3e0dd800cade7605d4c760220453533f8ba09165076f4a252dc9336f2d4040a3b071754441805c94df555a5ce01",
"02f6e670a3fcb90b40bb66fa550b5202ae8c9b50d69fcc1ffb5377b022f7f629fd"
],
"sequence": 4294967293
}
],
"vout": [
{
"value": 0.00309202,
"n": 0,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 2f8f5127a4f8234552e6ab2107303d1761e6ddbe OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a9142f8f5127a4f8234552e6ab2107303d1761e6ddbe88ac",
"address": "15LUSrgQ1qFtgx5237AskkjeMcX4bpHfBH",
"type": "pubkeyhash"
}
},
{
"value": 0.06857278,
"n": 1,
"scriptPubKey": {
"asm": "0 83e6911dcb2f412677376c6a70a01655dd534457",
"hex": "001483e6911dcb2f412677376c6a70a01655dd534457",
"address": "bc1qs0nfz8wt9aqjvaehd348pgqk2hw4x3zhupv0xw",
"type": "witness_v0_keyhash"
}
}
]