<p>No, the public key (also verification key) cannot be derived from a bech32 address. Only the hash of the public key is encoded in the address.</p>
<p>The verification key is secret as long as it is not used to spend some value from one of the corresponding addresses. When such a transaction is onchain, then you can extract the public key from it <a href="https://playground.plutus.iohkdev.io/doc/haddock/plutus-ledger-api/html/Plutus-V1-Ledger-Crypto.html#t:PubKey" rel="nofollow noreferrer">(1)</a><a href="https://playground.plutus.iohkdev.io/doc/haddock/plutus-ledger-api/html/Plutus-V1-Ledger-Tx.html#t:Tx" rel="nofollow noreferrer">(2)</a>.</p>

CC BY-SA 4.0
2022-08-26T15:01:30.373Z
What is the purpose of PubKey? I thought it can be used to verify the signing key (skey). I thought PubKey itself is s type of hashing of skey
Fourzin
CC BY-SA 4.0
2022-08-26T16:30:44.893Z
The public key is derived from the signing key, and is used to verify the authenticity of a signature. To obscure the public key onchain a hash of it is used in the addresses. A reason to use this is to have a fixed length to represent things. Both a script hash and a public key hash have the same lenght.
Fermat
CC BY-SA 4.0
2022-08-26T16:47:48.497Z
Where can I learn about how the verification of signing a tx is done. Say there is one untxo as input, and one signing key given. What is the algorithmic procedure that is done on utxo hash plus skey that guarantees legit signature?
Fourzin
CC BY-SA 4.0
2022-08-26T16:54:56.667Z
Onchain you can use https://github.com/input-output-hk/plutus/blob/fd927b1b9cb3292ed3409b0d40f0dcf627e13323/plutus-tx/src/PlutusTx/Builtins.hs#L133. What is your goal?
Fermat
CC BY-SA 4.0
2022-08-26T17:06:43.620Z
My goal is to educate myself more about Cardano. I would like to have an understanding of high verification is done. This will widen my knowledge about the chain.
Fourzin
CC BY-SA 4.0
2022-08-26T14:55:38.493Z
2022-08-26T14:55:38.493Z
Fermat
<p>As Fermat said, the Bech32 address only contains the <em>PubKey</em> <strong>Hash</strong>, and therefore we can't reverse it to obtain the <em>PubKey</em>.</p>
<p>The purpose of <em>PubKey</em> is to act as Verify Key, that will verify the authenticity of a <strong>signed transaction</strong> with its signature</p>
<p>You can refer to this video by Andrew, <strong>it will explain how addresses work in Cardano</strong></p>
<p>Video: <a href="https://youtu.be/NjPf_b9UQNs" rel="nofollow noreferrer">Cardano Addresses</a></p>

CC BY-SA 4.0
2022-08-27T13:21:30.487Z
Hello, Andrew's videos are insightful. I am aware that only the hash of the PubKey could be derived from bech32. Ok, maybe an alternative answer would be how can the witness set be retrieved for a given transaction? After all, BP nodes need to verify Tx's and PubKey purpose is to be shared to validate the owners signature
Fourzin
CC BY-SA 4.0
2022-08-28T23:50:20.180Z
I haven't found the answer to that either. My assumption is that **every time we submit a Tx, we send our SignedTx and our PubKey**. I assume you already know how UTxO works, so now the BP node could check the *input UTxO* address, and **compare it with our provided PubKey**. If the hash of that PubKey matched, now the PubKey is used to verify the SignedTx. The design decision for this architecture would be **to reduce data stored in the blockchain, because we don't have the full PubKey stored in it, just the hash of it**
Dani Ihza Farrosi
CC BY-SA 4.0
2022-08-31T08:31:21.207Z
Transactions on chain only have the input utxos and the recipient outputs. I can not find where on chain does the pubkey get stored and attached to a transaction neither its hash
Fourzin
CC BY-SA 4.0
2022-09-01T13:42:47.530Z
The address **IS the PubKey hash**, refer to [CIP-19](https://cips.cardano.org/cips/cip19/#shelleyaddresses). For example, [in this transaction](https://cardanoscan.io/transaction/f4b79bdef013793adcc8549a3f83d80e422acf48676fe4cfbc0c9608525939dd) we can get the PubKeyHash through bech32 decoding which is addr1q85cjaunup5pjnfuup244v78ccan2mykhhm346fqcf9heqqh8l0k78a59nm52ahfkxpx5r2sucupdaqvdxfk03fqp9kqqagfvq --> 01**e9897793e068194d3ce0555ab3c7c63b356c96bdf71ae920c24b7c80**173fdf6f1fb42cf74576e9b1826a0d50e63816f40c699367c520096c. Take the first 56 character after `01`, and you get the PubKeyHash
Dani Ihza Farrosi
CC BY-SA 4.0
2022-08-27T00:03:16.730Z
2022-08-27T00:03:16.730Z
Dani Ihza Farrosi
<p>The verification key is referred to as public. Could it be derived from the bech32 address?
e.g addr1... -&gt; Pubkey [cborHex]</p>

CC BY-SA 4.0
2022-08-26T14:07:20.847Z
This has been answered before [here](https://cardano.stackexchange.com/a/5919/5085)
Will
CC BY-SA 4.0
2022-08-26T14:40:47.997Z
Incorrect. I do not need the pubKeyHash, rather the PubKey itself
Fourzin
CC BY-SA 4.0
2022-09-01T22:10:07.243Z
not directly, but there are some PubKeys in metadata or Plutus datums, you can scrape the blockchain and build an incomplete dictionary
DaveStrider
<cardano-address><public-key><bech32>
Getting PubKey from bech32 address
# Getting PubKey from bech32 address

(Asked by: username_0 on 2022-08-26)

The verification key is referred to as public. Could it be derived from the bech32 address?
e.g addr1... -> Pubkey [cborHex]

**Tags:** cardano-address, public-key, bech32
> **Comments:**
> **username_1**: This has been answered before [here](https://cardano.stackexchange.com/a/5919/5085)  
> **username_0**: Incorrect. I do not need the pubKeyHash, rather the PubKey itself  
> **username_2**: not directly, but there are some PubKeys in metadata or Plutus datums, you can scrape the blockchain and build an incomplete dictionary  

---

## 2 answers

### Answer by username_3 on 2022-08-26. Score: 1

No, the public key (also verification key) cannot be derived from a bech32 address. Only the hash of the public key is encoded in the address.

The verification key is secret as long as it is not used to spend some value from one of the corresponding addresses. When such a transaction is onchain, then you can extract the public key from it [(1)](https://playground.plutus.iohkdev.io/doc/haddock/plutus-ledger-api/html/Plutus-V1-Ledger-Crypto.html#t:PubKey)[(2)](https://playground.plutus.iohkdev.io/doc/haddock/plutus-ledger-api/html/Plutus-V1-Ledger-Tx.html#t:Tx).

> **Comments:**
> **username_0**: What is the purpose of PubKey? I thought it can be used to verify the signing key (skey). I thought PubKey itself is s type of hashing of skey  
> **username_3**: The public key is derived from the signing key, and is used to verify the authenticity of a signature. To obscure the public key onchain a hash of it is used in the addresses. A reason to use this is to have a fixed length to represent things. Both a script hash and a public key hash have the same lenght.  
> **username_0**: Where can I learn about how the verification of signing a tx is done. Say there is one untxo as input, and one signing key given. What is the algorithmic procedure that is done on utxo hash plus skey that guarantees legit signature?  
> **username_3**: Onchain you can use https://github.com/input-output-hk/plutus/blob/fd927b1b9cb3292ed3409b0d40f0dcf627e13323/plutus-tx/src/PlutusTx/Builtins.hs#L133. What is your goal?  
> **username_0**: My goal is to educate myself more about Cardano. I would like to have an understanding of high verification is done. This will widen my knowledge about the chain.  

---

### Answer by username_4 on 2022-08-27. Score: 0

As Fermat said, the Bech32 address only contains the *PubKey* **Hash**, and therefore we can't reverse it to obtain the *PubKey*.

The purpose of *PubKey* is to act as Verify Key, that will verify the authenticity of a **signed transaction** with its signature

You can refer to this video by Andrew, **it will explain how addresses work in Cardano**

Video: [Cardano Addresses](https://youtu.be/NjPf_b9UQNs)

> **Comments:**
> **username_0**: Hello, Andrew's videos are insightful. I am aware that only the hash of the PubKey could be derived from bech32. Ok, maybe an alternative answer would be how can the witness set be retrieved for a given transaction? After all, BP nodes need to verify Tx's and PubKey purpose is to be shared to validate the owners signature  
> **username_4**: I haven't found the answer to that either. My assumption is that **every time we submit a Tx, we send our SignedTx and our PubKey**. I assume you already know how UTxO works, so now the BP node could check the *input UTxO* address, and **compare it with our provided PubKey**. If the hash of that PubKey matched, now the PubKey is used to verify the SignedTx. The design decision for this architecture would be **to reduce data stored in the blockchain, because we don't have the full PubKey stored in it, just the hash of it**  
> **username_0**: Transactions on chain only have the input utxos and the recipient outputs. I can not find where on chain does the pubkey get stored and attached to a transaction neither its hash  
> **username_4**: The address **IS the PubKey hash**, refer to [CIP-19](https://cips.cardano.org/cips/cip19/#shelleyaddresses). For example, [in this transaction](https://cardanoscan.io/transaction/f4b79bdef013793adcc8549a3f83d80e422acf48676fe4cfbc0c9608525939dd) we can get the PubKeyHash through bech32 decoding which is addr1q85cjaunup5pjnfuup244v78ccan2mykhhm346fqcf9heqqh8l0k78a59nm52ahfkxpx5r2sucupdaqvdxfk03fqp9kqqagfvq --> 01**e9897793e068194d3ce0555ab3c7c63b356c96bdf71ae920c24b7c80**173fdf6f1fb42cf74576e9b1826a0d50e63816f40c699367c520096c. Take the first 56 character after `01`, and you get the PubKeyHash  

---

