Context: I have a bitcoin core node(v.24), and using bitcoinrpc library.
So, when I am running the getrawtransaction() function, sometimes the vout doesn't have the key "address", and the key "desc" looks like pk(....)#.... .
How can I figure out the id of the destiny address ? I already checked in two bitcoin explorers, that the output address of this transaction: "9b0fc92260312ce44e74ef369f5c66bbb85848f2eddd5a7a1cde251e54ccfdd5" it is : 11HLoD9E4SDFFPDiYfNYnkBLQ85Y51J3Zb1
In addition, I also tried to decode the hex valur of the vout, but there is no address key. Therefore, there is a p2sh key with and value that looks like an address id: 3ARTFmbLhbpY4BAhV6Ukvb9ULa6eHawAWW
What it is the way to obtain the right destiny address?
Example:
blockid: 2
txid: 9b0fc92260312ce44e74ef369f5c66bbb85848f2eddd5a7a1cde251e54ccfdd5
Output of getrawtransaction(txid,1):
{'txid': '9b0fc92260312ce44e74ef369f5c66bbb85848f2eddd5a7a1cde251e54ccfdd5',
'hash': '9b0fc92260312ce44e74ef369f5c66bbb85848f2eddd5a7a1cde251e54ccfdd5',
'version': 1,
'size': 134,
'vsize': 134,
'weight': 536,
'locktime': 0,
'vin': [{'coinbase': '04ffff001d010b', 'sequence': 4294967295}],
'vout': [{'value': Decimal('50.00000000'),
'n': 0,
'scriptPubKey': {'asm': '047211a824f55b505228e4c3d5194c1fcfaa15a456abdf37f9b9d97a4040afc073dee6c89064984f03385237d92167c13e236446b417ab79a0fcae412ae3316b77 OP_CHECKSIG',
'desc': 'pk(047211a824f55b505228e4c3d5194c1fcfaa15a456abdf37f9b9d97a4040afc073dee6c89064984f03385237d92167c13e236446b417ab79a0fcae412ae3316b77)#rgrfa75n',
'hex': '41047211a824f55b505228e4c3d5194c1fcfaa15a456abdf37f9b9d97a4040afc073dee6c89064984f03385237d92167c13e236446b417ab79a0fcae412ae3316b77ac',
'type': 'pubkey'}}],
'hex': '01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0704ffff001d010bffffffff0100f2052a010000004341047211a824f55b505228e4c3d5194c1fcfaa15a456abdf37f9b9d97a4040afc073dee6c89064984f03385237d92167c13e236446b417ab79a0fcae412ae3316b77ac00000000',
'blockhash': '000000006a625f06636b8bb6ac7b960a8d03705d1ace08b1a19da3fdcc99ddbd',
'confirmations': 792949,
'time': 1231469744,
'blocktime': 1231469744}
vout_hex = '41047211a824f55b505228e4c3d5194c1fcfaa15a456abdf37f9b9d97a4040afc073dee6c89064984f03385237d92167c13e236446b417ab79a0fcae412ae3316b77ac'
Ouput of decodescript("vout_hex"):
{'asm': '047211a824f55b505228e4c3d5194c1fcfaa15a456abdf37f9b9d97a4040afc073dee6c89064984f03385237d92167c13e236446b417ab79a0fcae412ae3316b77 OP_CHECKSIG',
'desc': 'pk(047211a824f55b505228e4c3d5194c1fcfaa15a456abdf37f9b9d97a4040afc073dee6c89064984f03385237d92167c13e236446b417ab79a0fcae412ae3316b77)#rgrfa75n',
'type': 'pubkey',
'p2sh': '3ARTFmbLhbpY4BAhV6Ukvb9ULa6eHawAWW'}
All in all, what should I do to get the right output address: 1HLoD9E4SDFFPDiYfNYnkBLQ85Y51J3Zb1?