user132220: 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"
      }
    }
  ]



user63872: Transaction inputs are listed via the txid and the outputs index. In the case of your example, you'd need to make a second call:
bitcoin-cli gettransaction c5355fe45f785f14f15b3e41894e21083978e9e78ed23b7a3a00f0061ec735a5
And then look at the output at the index n: 1 to find the address in question.

132220: <p>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 &quot;From&quot; and &quot;To&quot; addresses used in the transaction.</p>
<p>I am using the &quot;bitcoin-cli gettransaction&quot; method to get transaction details.</p>
<p>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 &quot;From&quot; addresses in VIN block.</p>
<p>How can I get the &quot;from&quot; and &quot;To&quot; address in bitcoin transaction?</p>
<p>Here is a data sample,</p>
<pre><code>     &quot;vin&quot;: [
    {
      &quot;txid&quot;: &quot;c5355fe45f785f14f15b3e41894e21083978e9e78ed23b7a3a00f0061ec735a5&quot;,
      &quot;vout&quot;: 1,
      &quot;scriptSig&quot;: {
        &quot;asm&quot;: &quot;&quot;,
        &quot;hex&quot;: &quot;&quot;
      },
      &quot;txinwitness&quot;: [
        &quot;3045022100f5ee5cb40a06419c55eb2de549ee97daf77a8e2588d3e0dd800cade7605d4c760220453533f8ba09165076f4a252dc9336f2d4040a3b071754441805c94df555a5ce01&quot;,
        &quot;02f6e670a3fcb90b40bb66fa550b5202ae8c9b50d69fcc1ffb5377b022f7f629fd&quot;
      ],
      &quot;sequence&quot;: 4294967293
    }
  ],
  &quot;vout&quot;: [
    {
      &quot;value&quot;: 0.00309202,
      &quot;n&quot;: 0,
      &quot;scriptPubKey&quot;: {
        &quot;asm&quot;: &quot;OP_DUP OP_HASH160 2f8f5127a4f8234552e6ab2107303d1761e6ddbe OP_EQUALVERIFY OP_CHECKSIG&quot;,
        &quot;hex&quot;: &quot;76a9142f8f5127a4f8234552e6ab2107303d1761e6ddbe88ac&quot;,
        &quot;address&quot;: &quot;15LUSrgQ1qFtgx5237AskkjeMcX4bpHfBH&quot;,
        &quot;type&quot;: &quot;pubkeyhash&quot;
      }
    },
    {
      &quot;value&quot;: 0.06857278,
      &quot;n&quot;: 1,
      &quot;scriptPubKey&quot;: {
        &quot;asm&quot;: &quot;0 83e6911dcb2f412677376c6a70a01655dd534457&quot;,
        &quot;hex&quot;: &quot;001483e6911dcb2f412677376c6a70a01655dd534457&quot;,
        &quot;address&quot;: &quot;bc1qs0nfz8wt9aqjvaehd348pgqk2hw4x3zhupv0xw&quot;,
        &quot;type&quot;: &quot;witness_v0_keyhash&quot;
      }
    }
  ]

</code></pre>
 63872: <p>Transaction inputs are listed via the txid and the outputs index. In the case of your example, you'd need to make a second call:</p>
<p><code>bitcoin-cli gettransaction c5355fe45f785f14f15b3e41894e21083978e9e78ed23b7a3a00f0061ec735a5</code></p>
<p>And then look at the output at the index <code>n: 1</code> to find the address in question.</p>
