How to get a transaction input address, like block explorers do, directly from Core client? I need it to return a payment to one of the sending addresses.
litecoin-cli gettransaction:
{
"amount": 0.00005851,
"confirmations": 2,
"blockhash": "1ee0005f20625b4dda47cff35a0214940d5c0e8f33cc42054a9ffa3e1370583d",
"blockheight": 2714382,
"blockindex": 318,
"blocktime": 1720098028,
"txid": "5c4dcff65ed69060f84005fcfc9c9cccd1d2eed38d30d2df95f4524ce1075576",
"walletconflicts": [
],
"time": 1720097921,
"timereceived": 1720097921,
"bip125-replaceable": "no",
"details": [
{
"address": "ltc1qevgc8uymrxd3vq3vztmqhz0tq2y3jpx8twn2qt",
"category": "receive",
"amount": 0.00005851,
"label": "",
"vout": 1
}
],
"hex": "020000000001015ed7d1b7f75e3e3c0901b97fa96095d8e3a2d8fdaad07ff5b2e0d0bbd7e12ecf0100000000feffffff02327d030000000000160014ce295448dda30f95852504b78071b3dd23b68232db16000000000000160014cb1183f09b199b16022c12f60b89eb02891904c70247304402201b4a01969140b75d66b797718819d0fcc6538962d666298b9d020db3a9e47b8e022020dea3ec9ecbdb244c3c745555e7e0a553f81785292fa3233209b5bce8009b2801210276771913879beb7efe864f26486987637d06649c01d362dbc3a8d94a35556f7d0d6b2900"
}
I use Litecoin for testing because it works better than Testnethttps://live.blockcypher.com/ltc/decodetx/ shows "inputs" address when decoding "hex":
{
"addresses": [
"ltc1qevgc8uymrxd3vq3vztmqhz0tq2y3jpx8twn2qt",
"ltc1q70uam3y0hrg3uypsupteldu4dw2385kmks8yqs",
"ltc1qec54gjxa5v8etpf9qjmcqudnm53mdq3jze7y5s"
],
"block_height": -1,
"block_index": -1,
"confirmations": 0,
"double_spend": false,
"fees": 155,
"hash": "5c4dcff65ed69060f84005fcfc9c9cccd1d2eed38d30d2df95f4524ce1075576",
"inputs": [
{
"addresses": [
"ltc1q70uam3y0hrg3uypsupteldu4dw2385kmks8yqs"
],
"age": 2714381,
"output_index": 1,
"output_value": 234664,
"prev_hash": "cf2ee1d7bbd0e0b2f57fd0aafdd8a2e3d89560a97fb901093c3e5ef7b7d1d75e",
"script_type": "pay-to-witness-pubkey-hash",
"sequence": 4294967294,
"witness": [
"304402201b4a01969140b75d66b797718819d0fcc6538962d666298b9d020db3a9e47b8e022020dea3ec9ecbdb244c3c745555e7e0a553f81785292fa3233209b5bce8009b2801",
"0276771913879beb7efe864f26486987637d06649c01d362dbc3a8d94a35556f7d"
]
}
],
"lock_time": 2714381,
"outputs": [
{
"addresses": [
"ltc1qec54gjxa5v8etpf9qjmcqudnm53mdq3jze7y5s"
],
"script": "0014ce295448dda30f95852504b78071b3dd23b68232",
"script_type": "pay-to-witness-pubkey-hash",
"value": 228658
},
{
"addresses": [
"ltc1qevgc8uymrxd3vq3vztmqhz0tq2y3jpx8twn2qt"
],
"script": "0014cb1183f09b199b16022c12f60b89eb02891904c7",
"script_type": "pay-to-witness-pubkey-hash",
"value": 5851
}
],
"preference": "low",
"received": "2024-07-04T13:13:34.80374529Z",
"relayed_by": "50.17.116.247",
"size": 222,
"total": 234509,
"ver": 2,
"vin_sz": 1,
"vout_sz": 2,
"vsize": 141
}
My own Core installation does not show the sending address:
{
"txid": "5c4dcff65ed69060f84005fcfc9c9cccd1d2eed38d30d2df95f4524ce1075576",
"hash": "94af7b95225412fe812b24dc64c9a027b204b7ccef14cde38212c860fa129e9f",
"version": 2,
"size": 222,
"vsize": 141,
"weight": 561,
"locktime": 2714381,
"vin": [
{
"ismweb": false,
"txid": "cf2ee1d7bbd0e0b2f57fd0aafdd8a2e3d89560a97fb901093c3e5ef7b7d1d75e",
"vout": 1,
"scriptSig": {
"asm": "",
"hex": ""
},
"txinwitness": [
"304402201b4a01969140b75d66b797718819d0fcc6538962d666298b9d020db3a9e47b8e022020dea3ec9ecbdb244c3c745555e7e0a553f81785292fa3233209b5bce8009b2801",
"0276771913879beb7efe864f26486987637d06649c01d362dbc3a8d94a35556f7d"
],
"sequence": 4294967294
}
],
"vout": [
{
"ismweb": false,
"value": 0.00228658,
"n": 0,
"scriptPubKey": {
"asm": "0 ce295448dda30f95852504b78071b3dd23b68232",
"hex": "0014ce295448dda30f95852504b78071b3dd23b68232",
"reqSigs": 1,
"type": "witness_v0_keyhash",
"addresses": [
"ltc1qec54gjxa5v8etpf9qjmcqudnm53mdq3jze7y5s"
]
}
},
{
"ismweb": false,
"value": 0.00005851,
"n": 1,
"scriptPubKey": {
"asm": "0 cb1183f09b199b16022c12f60b89eb02891904c7",
"hex": "0014cb1183f09b199b16022c12f60b89eb02891904c7",
"reqSigs": 1,
"type": "witness_v0_keyhash",
"addresses": [
"ltc1qevgc8uymrxd3vq3vztmqhz0tq2y3jpx8twn2qt"
]
}
}
]
}
Is this possible without txindex=1?I use a pruned node.