Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. It only takes a minute to sign up.
Sign up to join this communityAnybody can ask a question
Anybody can answer
The best answers are voted up and rise to the top
Dears,
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" } } ]
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.
You can get bonuses upto $100 FREE BONUS when you:
π° Install these recommended apps:
π² SocialGood - 100% Crypto Back on Everyday Shopping
π² xPortal - The DeFi For The Next Billion
π² CryptoTab Browser - Lightweight, fast, and ready to mine!
π° Register on these recommended exchanges:
π‘ Binanceπ‘ Bitfinexπ‘ Bitmartπ‘ Bittrexπ‘ Bitget
π‘ CoinExπ‘ Crypto.comπ‘ Gate.ioπ‘ Huobiπ‘ Kucoin.
Comments