<p>What you show in your screenshot is some program's summary of a transaction which omits details of the spending script. You need to look at a more detailed view of the raw transaction data.</p>
<p>There are several types of Bitcoin transaction. The type known as Pay to Public Key Hash (P2PKH) requires that the recipient reveal their public key in a later transaction where they spend the received money.</p>
<p>There are several places that explain this. One is <a href="https://learnmeabitcoin.com/technical/p2pkh" rel="nofollow noreferrer">https://learnmeabitcoin.com/technical/p2pkh</a></p>
<blockquote>
<p>The P2PKH script pattern contains a hashed public key surrounded by these opcodes:</p>
<p>scriptPubKey:</p>
<pre><code>OP_DUP OP_HASH160   
12ab8dc588ca9d5787dde7eb29569da63c3a238c OP_EQUALVERIFY OP_CHECKSIG
</code></pre>
<p>To solve this script, the owner of the hashed public key above needs to provide the original public key, along with a valid signature for it:</p>
<p>scriptSig:</p>
<pre><code>304502203f004eeed0cef2715643e2f25a27a28f3c578e94c7f0f6a4df104e7d   
163f7f8f022100b8b248c1cfd8f77a0365107a9511d759b7544d979dd152a955  
c867afac0ef78601   

044d05240cfbd8a2786eda9dadd520c1609b8593ff8641018d57703d02ba687c  
f2f187f0cee2221c3afb1b5ff7888caced2423916b61444666ca1216f2618139  
8c
</code></pre>
<p>In short, when this script runs:</p>
<ul>
<li>The original public key is DUPlicated and then HASH160’ed.</li>
<li>This hashed value is compared with the hashed public key in the scriptPubKey to make sure it is EQUALVERIFY.</li>
<li>If it matches, the script continues and the CHECKSIG checks the signature against the public key (just like a P2PK script).</li>
</ul>
</blockquote>
<p>Note that the locking script is only present in the transaction in which a person received this money. The transaction in which they spend the received money has a reference to the earlier transaction and contains a spending script that is prepended to the earlier transaction's locking script and then evaluated.</p>
<p>The transaction you show is a P2WPKH which is a little more complex and has some advantages over P2PKH.</p>

CC BY-SA 4.0
2022-02-25T00:29:14.153Z
2022-02-25T09:02:19.693Z
2022-02-25T09:02:19.693Z
RedGrittyBrick
<p>I am pursuing a deeper understanding of Bitcoin. Reading Grokking Bitcoin now. I am trying to asess the understanding of different concepts by exploring a BTC RPC explorer. I got some understanding about the key types and keys structure and key derivation in hierarchical deterministic wallets.
The book says: the PKH (double hashed from public key) is used in order to not reveal directly the public key (for better privacy), but then the public key gets revelead in the spending transaction.</p>
<p>In this screenshot of a random transaction I see only BTC addresses (bc1q) derived from PKH. Where is the &quot;revelead&quot; public key?
I am quite sure I misunderstood something. <a href="https://i.sstatic.net/c8VyV.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/c8VyV.png" alt="Random transaction" /></a><a href="https://i.sstatic.net/zzDWc.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/zzDWc.png" alt="Entities relationship" /></a></p>

<transactions><public-key>
Where is the revelead public key in a spending transaction?
Tao
# Where is the revelead public key in a spending transaction?

(Asked by: username_0 on 2022-02-24)

I am pursuing a deeper understanding of Bitcoin. Reading Grokking Bitcoin now. I am trying to asess the understanding of different concepts by exploring a BTC RPC explorer. I got some understanding about the key types and keys structure and key derivation in hierarchical deterministic wallets.
The book says: the PKH (double hashed from public key) is used in order to not reveal directly the public key (for better privacy), but then the public key gets revelead in the spending transaction.

In this screenshot of a random transaction I see only BTC addresses (bc1q) derived from PKH. Where is the "revelead" public key?
I am quite sure I misunderstood something. [![Random transaction](https://i.sstatic.net/c8VyV.png)](https://i.sstatic.net/c8VyV.png)[![Entities relationship](https://i.sstatic.net/zzDWc.png)](https://i.sstatic.net/zzDWc.png)

**Tags:** transactions, public-key


---

## 1 answers

### Answer by username_1 on 2022-02-25. Score: 1 | Accepted answer

What you show in your screenshot is some program's summary of a transaction which omits details of the spending script. You need to look at a more detailed view of the raw transaction data.

There are several types of Bitcoin transaction. The type known as Pay to Public Key Hash (P2PKH) requires that the recipient reveal their public key in a later transaction where they spend the received money.

There are several places that explain this. One is <https://learnmeabitcoin.com/technical/p2pkh>

> The P2PKH script pattern contains a hashed public key surrounded by these opcodes:
>
> scriptPubKey:
>
> ```
> OP_DUP OP_HASH160   
> 12ab8dc588ca9d5787dde7eb29569da63c3a238c OP_EQUALVERIFY OP_CHECKSIG
>
> ```
>
> To solve this script, the owner of the hashed public key above needs to provide the original public key, along with a valid signature for it:
>
> scriptSig:
>
> ```
> 304502203f004eeed0cef2715643e2f25a27a28f3c578e94c7f0f6a4df104e7d   
> 163f7f8f022100b8b248c1cfd8f77a0365107a9511d759b7544d979dd152a955  
> c867afac0ef78601   
>
> 044d05240cfbd8a2786eda9dadd520c1609b8593ff8641018d57703d02ba687c  
> f2f187f0cee2221c3afb1b5ff7888caced2423916b61444666ca1216f2618139  
> 8c
>
> ```
>
> In short, when this script runs:
>
> * The original public key is DUPlicated and then HASH160’ed.
> * This hashed value is compared with the hashed public key in the scriptPubKey to make sure it is EQUALVERIFY.
> * If it matches, the script continues and the CHECKSIG checks the signature against the public key (just like a P2PK script).

Note that the locking script is only present in the transaction in which a person received this money. The transaction in which they spend the received money has a reference to the earlier transaction and contains a spending script that is prepended to the earlier transaction's locking script and then evaluated.

The transaction you show is a P2WPKH which is a little more complex and has some advantages over P2PKH.


---

