<p>It is impossible to give the correct address for this output, because this output doesn’t follow one of the patterns that have an address standard. The correct way to refer to this output’s “destination” is either “no address” and/or directly surfacing the output script (scriptPubKey) labeled accordingly.</p>
<p>I would recommend <em><strong>not</strong></em> to calculate and use arbitrary related data, since using a made-up address will only be confusing and misleading.</p>

CC BY-SA 4.0
2023-06-05T13:16:07.193Z
2023-06-05T14:44:05.640Z
2023-06-05T14:44:05.640Z
Murch
<p>Those block explorers use an outdated notion of &quot;address&quot;. This output simply <strong>has no address</strong>. The RPC output, as well as more modern block explorers such as <a href="https://mempool.space" rel="nofollow noreferrer">https://mempool.space</a> and <a href="https://blockstream.info" rel="nofollow noreferrer">https://blockstream.info</a> correctly don't show one.</p>
<p>It is a pay-to-pubkey output, and no address format was ever defined for those. Historically, an address was simply a shorthand way of referring to a public key, and so it became established practice of showing pay-to-pubkey outputs as having the same address as their corresponding pay-to-pubkey-hash output with the same key.</p>
<p>This is now considered misleading, because one for example cannot send to this address and hope it'll be received by the same person; after all, it is actually a different output.</p>

CC BY-SA 4.0
2023-06-05T11:51:00.793Z
Hi Pieter, thanks 4 your answer it is true all you said.  However, I use this code to obtain the address where the bitcoins were sent:
import base58
import hashlib
def decode_descriptor(desc):
    public_key_hex = desc.replace('pk(', '').replace(')#qnv32gt7', '')
    public_key_bytes = bytes.fromhex(public_key_hex)
    sha256_hash = hashlib.sha256(public_key_bytes).digest()
    sha256_hash = hashlib.sha256(sha256_hash).digest()
    checksum = sha256_hash[:4]
    extended_key = public_key_bytes + checksum
    address = base58.b58encode(extended_key)
    return address.decode('utf-8')
Block_Mole
CC BY-SA 4.0
2023-06-05T11:54:39.790Z
# Example:

desc= 'pk(047211a824f55b505228e4c3d5194c1fcfaa15a456abdf37f9b9d97a4040afc073dee6c89064984f03385237d92167c13e236446b417ab79a0fcae412ae3316b77)#rgrfa75n'

decoded_address = decode_descriptor(descriptor)

print(decoded_address)
b'1HLoD9E4SDFFPDiYfNYnkBLQ85Y51J3Zb1'
Block_Mole
CC BY-SA 4.0
2023-06-05T12:14:32.460Z
@Block_Mole You can compute things that way if you want to match the historical behavior, but it's still meaningless.
Pieter Wuille
CC BY-SA 4.0
2023-06-05T12:24:01.187Z
Again: that output **has no address**; there simply is no answer to the question "Which address were those BTC sent to?". Not all outputs have addresses.
Pieter Wuille
CC BY-SA 4.0
2023-06-05T11:37:25.863Z
2023-06-05T11:44:11.763Z
2023-06-05T11:44:11.763Z
Pieter Wuille
<p>Context:
I have a bitcoin core node(v.24), and using bitcoinrpc library.</p>
<p>So, when I am running the getrawtransaction() function, sometimes the vout doesn't have the key &quot;address&quot;, and the key &quot;desc&quot; looks like pk(....)#.... .</p>
<p>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: &quot;9b0fc92260312ce44e74ef369f5c66bbb85848f2eddd5a7a1cde251e54ccfdd5&quot; it is : 11HLoD9E4SDFFPDiYfNYnkBLQ85Y51J3Zb1</p>
<p>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</p>
<p>What it is the way to obtain the right destiny address?</p>
<pre><code>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(&quot;vout_hex&quot;):


{'asm': '047211a824f55b505228e4c3d5194c1fcfaa15a456abdf37f9b9d97a4040afc073dee6c89064984f03385237d92167c13e236446b417ab79a0fcae412ae3316b77 OP_CHECKSIG',
 'desc': 'pk(047211a824f55b505228e4c3d5194c1fcfaa15a456abdf37f9b9d97a4040afc073dee6c89064984f03385237d92167c13e236446b417ab79a0fcae412ae3316b77)#rgrfa75n',
 'type': 'pubkey',
 'p2sh': '3ARTFmbLhbpY4BAhV6Ukvb9ULa6eHawAWW'}
</code></pre>
<p>All in all, what should I do to get the right output address: 1HLoD9E4SDFFPDiYfNYnkBLQ85Y51J3Zb1?</p>

<address><p2pk>
How to figure out the output address when there is no "address" key in vout["scriptPubKey"]
Block_Mole
# How to figure out the output address when there is no "address" key in vout["scriptPubKey"]

(Asked by: username_0 on 2023-06-05)

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?

**Tags:** address, p2pk


---

## 2 answers

### Answer by username_1 on 2023-06-05. Score: 3 | Accepted answer

It is impossible to give the correct address for this output, because this output doesn’t follow one of the patterns that have an address standard. The correct way to refer to this output’s “destination” is either “no address” and/or directly surfacing the output script (scriptPubKey) labeled accordingly.

I would recommend ***not*** to calculate and use arbitrary related data, since using a made-up address will only be confusing and misleading.


---

### Answer by username_2 on 2023-06-05. Score: 4

Those block explorers use an outdated notion of "address". This output simply **has no address**. The RPC output, as well as more modern block explorers such as <https://mempool.space> and <https://blockstream.info> correctly don't show one.

It is a pay-to-pubkey output, and no address format was ever defined for those. Historically, an address was simply a shorthand way of referring to a public key, and so it became established practice of showing pay-to-pubkey outputs as having the same address as their corresponding pay-to-pubkey-hash output with the same key.

This is now considered misleading, because one for example cannot send to this address and hope it'll be received by the same person; after all, it is actually a different output.

> **Comments:**
> **username_0**: Hi username_2, thanks 4 your answer it is true all you said.  However, I use this code to obtain the address where the bitcoins were sent: import base58 import hashlib def decode_descriptor(desc):     public_key_hex = desc.replace('pk(', '').replace(')#qnv32gt7', '')     public_key_bytes = bytes.fromhex(public_key_hex)     sha256_hash = hashlib.sha256(public_key_bytes).digest()     sha256_hash = hashlib.sha256(sha256_hash).digest()     checksum = sha256_hash[:4]     extended_key = public_key_bytes + checksum     address = base58.b58encode(extended_key)     return address.decode('utf-8')  
> **username_0**: # Example:  desc= 'pk(047211a824f55b505228e4c3d5194c1fcfaa15a456abdf37f9b9d97a4040afc073dee6c89064984f03385237d92167c13e236446b417ab79a0fcae412ae3316b77)#rgrfa75n'  decoded_address = decode_descriptor(descriptor)  print(decoded_address) b'1HLoD9E4SDFFPDiYfNYnkBLQ85Y51J3Zb1'  
> **username_2**: @username_0 You can compute things that way if you want to match the historical behavior, but it's still meaningless.  
> **username_2**: Again: that output **has no address**; there simply is no answer to the question "Which address were those BTC sent to?". Not all outputs have addresses.  

---

