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 transactionEntities relationship

1 Answer 1


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:


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:




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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.