Is this possible without txindex=1?I use a pruned node.
Quite possible, if the block where the transaction is still not pruned or if it's still in your mempool,
You can use
getrawtransaction in your Bitcoin Core node even without txindex by providing the hash of the block where the transaction is included.
Then use verbosity "
2" to include "
prevout" to each of the inputs in the result.
For example, test the first non-coinbase transaction in current latest block height 850758 with the block hash
00000000000000000000a8e2c7fcd3b21caa2da453d956f86ec1e77ff39fd0b8.
That block should still be available in your Bitcoin Core's blocksdir I suppose, command:
getrawtransaction "cfb247517f143c0bf5b1ffeca8789f29000c64881e3ed992976a954b58b024d0" (2, "00000000000000000000a8e2c7fcd3b21caa2da453d956f86ec1e77ff39fd0b8")
Result:
{
"in_active_chain": true,
"txid": "cfb247517f143c0bf5b1ffeca8789f29000c64881e3ed992976a954b58b024d0",
"hash": "9fbe051c4ecc33a306156b489f71eb160fc4179eb0a991c6930b7a294cea74e9",
"version": 2,
"size": 394,
"vsize": 232,
"weight": 928,
"locktime": 0,
"vin": [
{
"txid": "1e00b133c90fe8d43039d2cc62df138ed1ac60a39f4dac356a0f9b57f7274db3",
"vout": 1,
"scriptSig": {
"asm": "",
"hex": ""
},
"txinwitness": [
"304402203339a2d122b03d7afd1f19f2afcda93e3d2d4e996e032b6d7cf2c1dcca97052e02205012f1f8ad6b6cb89b7a2f13a1e8c4fa6c78760da9f0931b08b994ab0533446e01",
"0363dca8904864aa8aef426b6253b3665909ca4fc3b24cd43e5f05150511825b0c"
],
"prevout": {
"generated": false,
"height": 850753,
"value": 0.00000546,
"scriptPubKey": {
"asm": "0 527500fb3b5b7cdd522524287c9a0cd09ed0508d",
"desc": "addr(bc1q2f6sp7emtd7d6539ys58exsv6z0dq5ydu2xnhq)#4w8k5ahs",
"hex": "0014527500fb3b5b7cdd522524287c9a0cd09ed0508d",
"address": "bc1q2f6sp7emtd7d6539ys58exsv6z0dq5ydu2xnhq",
"type": "witness_v0_keyhash"
}
},
"sequence": 4294967295
},
{
"txid": "e3cf7ba33137218105be5eb8740ca41887c3ce830cf9a2017c7fa1e4738546d1",
"vout": 2,
"scriptSig": {
"asm": "",
"hex": ""
},
"txinwitness": [
"304402205131daeef0baa06660c5be9984ba0255b9fa46d960fadbe06908e3e20a6e927d0220660b06b940af97346220a11266d7a1631619c1717315b1d9eadfabc1275bf85f01",
"03497a874c3412319689cc435756a820c3cf4cbb22d88ccafa29a8dc5e74eaa538"
],
"prevout": {
"generated": false,
"height": 850738,
"value": 0.00705938,
"scriptPubKey": {
"asm": "0 d58d2895ae676864b28af1d980c797d83f4d781f",
"desc": "addr(bc1q6kxj39dwva5xfv5278vcp3uhmql567qlpldtcr)#afxt7ysj",
"hex": "0014d58d2895ae676864b28af1d980c797d83f4d781f",
"address": "bc1q6kxj39dwva5xfv5278vcp3uhmql567qlpldtcr",
"type": "witness_v0_keyhash"
}
},
"sequence": 4294967295
}
],
"vout": [
{
"value": 0.00000000,
"n": 0,
"scriptPubKey": {
"asm": "OP_RETURN 13 00c0a233038097b7e0ae0101",
"desc": "raw(6a5d0c00c0a233038097b7e0ae0101)#m6f8ms85",
"hex": "6a5d0c00c0a233038097b7e0ae0101",
"type": "nulldata"
}
},
{
"value": 0.00000546,
"n": 1,
"scriptPubKey": {
"asm": "0 979bdd94f2d5972c062a7839ef114c193eca970a",
"desc": "addr(bc1qj7dam98j6ktjcp320qu77y2vrylv49c2k2hkmu)#0ms2gq9q",
"hex": "0014979bdd94f2d5972c062a7839ef114c193eca970a",
"address": "bc1qj7dam98j6ktjcp320qu77y2vrylv49c2k2hkmu",
"type": "witness_v0_keyhash"
}
},
{
"value": 0.00697938,
"n": 2,
"scriptPubKey": {
"asm": "0 d58d2895ae676864b28af1d980c797d83f4d781f",
"desc": "addr(bc1q6kxj39dwva5xfv5278vcp3uhmql567qlpldtcr)#afxt7ysj",
"hex": "0014d58d2895ae676864b28af1d980c797d83f4d781f",
"address": "bc1q6kxj39dwva5xfv5278vcp3uhmql567qlpldtcr",
"type": "witness_v0_keyhash"
}
}
],
"fee": 0.00008000,
"hex": "02000000000102b34d27f7579b0f6a35ac4d9fa360acd18e13df62ccd23930d4e80fc933b1001e0100000000ffffffffd1468573e4a17f7c01a2f90c83cec38718a40c74b85ebe0581213731a37bcfe30200000000ffffffff0300000000000000000f6a5d0c00c0a233038097b7e0ae01012202000000000000160014979bdd94f2d5972c062a7839ef114c193eca970a52a60a0000000000160014d58d2895ae676864b28af1d980c797d83f4d781f0247304402203339a2d122b03d7afd1f19f2afcda93e3d2d4e996e032b6d7cf2c1dcca97052e02205012f1f8ad6b6cb89b7a2f13a1e8c4fa6c78760da9f0931b08b994ab0533446e01210363dca8904864aa8aef426b6253b3665909ca4fc3b24cd43e5f05150511825b0c0247304402205131daeef0baa06660c5be9984ba0255b9fa46d960fadbe06908e3e20a6e927d0220660b06b940af97346220a11266d7a1631619c1717315b1d9eadfabc1275bf85f012103497a874c3412319689cc435756a820c3cf4cbb22d88ccafa29a8dc5e74eaa53800000000",
"blockhash": "00000000000000000000a8e2c7fcd3b21caa2da453d956f86ec1e77ff39fd0b8",
"confirmations": 1,
"time": 1720151784,
"blocktime": 1720151784
}
But if the block is already pruned, it wont work. You'll have to use txindex and intact blockchain.