<p>No, as that would sort of defeat the purpose of having a key hash in the first place (Hashing is, by definition, a one-way operation). Also, addresses can be built using different combinations of payment and staking keys, so a single key hash can be indicative of a key with ownership over multiple addresses.</p>

CC BY-SA 4.0
2022-04-14T18:39:07.317Z
In the question it is assumed that we have an pubkeyhash. If we look at the defenition of an address it consists of a credential and maybe a stakingcredential. The former is in the case of a normal shelley address given by a pubkeyHash. If it is a script, then its the validator hash. So it is definitly possible to construct an address from a pubkeyhash. What is not possible is deriving the pubkey from the pubkeyhash (as you state). See https://playground.plutus.iohkdev.io/doc/haddock/plutus-ledger/html/Ledger-Address.html#t:Address
Fermat
CC BY-SA 4.0
2021-11-15T15:18:00.470Z
2022-04-14T18:24:44.320Z
2022-04-14T18:24:44.320Z
zhekson
<p>You might want to investigate <a href="https://github.com/Emurgo/cardano-serialization-lib/blob/master/example/index.ts#L49" rel="nofollow noreferrer">cardano-serialization-lib</a> or <a href="https://github.com/input-output-hk/cardano-addresses" rel="nofollow noreferrer">cardano-addresses</a> for this.</p>
<pre><code>echo addr1gqtnpvdhqrtpd4g424fcaq7k0ufuzyadt7djygf8qdyzevuph3wczvf2dwyx5u | ./cardano-address address inspect

{
&quot;stake_reference&quot;: &quot;by pointer&quot;,
&quot;spending_key_hash_bech32&quot;: &quot;addr_vkh1zuctrdcq6ctd29242w8g84nlz0q38t2lnv3zzfcrfqktx0c9tzp&quot;,
&quot;pointer&quot;: {
    &quot;slot_num&quot;: 24157,
    &quot;output_index&quot;: 42,
    &quot;transaction_index&quot;: 177
},
&quot;address_style&quot;: &quot;Shelley&quot;,
&quot;spending_key_hash&quot;: &quot;1730b1b700d616d51555538e83d67f13c113ad5f9b22212703482cb3&quot;,
&quot;network_tag&quot;: 0 }
</code></pre>
<p>But that is a movement in an opposite direction, getting a pkh from address.</p>

CC BY-SA 4.0
2021-11-15T12:09:07.633Z
2021-11-15T15:27:52.343Z
2021-11-15T15:27:52.343Z
andycandy
<p>Let's say I have a public key hash, is it possible to get the address corresponding to that hash using the CLI?</p>

CC BY-SA 4.0
2022-04-15T06:38:18.910Z
An address is made of of 3 components: Network + Payment Credentials/ Validator Credentials + Optional Staking Credentials (can be StakeValidator Hash or StakingKeys).
Will
<cardano-cli>
Can you go from pkh -> address using the CLI?
# Can you go from pkh -> address using the CLI?

(Asked by: username_0 on 2021-11-15)

Let's say I have a public key hash, is it possible to get the address corresponding to that hash using the CLI?

**Tags:** cardano-cli
> **Comments:**
> **username_1**: An address is made of of 3 components: Network + Payment Credentials/ Validator Credentials + Optional Staking Credentials (can be StakeValidator Hash or StakingKeys).  

---

## 2 answers

### Answer by username_2 on 2021-11-15. Score: 2

No, as that would sort of defeat the purpose of having a key hash in the first place (Hashing is, by definition, a one-way operation). Also, addresses can be built using different combinations of payment and staking keys, so a single key hash can be indicative of a key with ownership over multiple addresses.

> **Comments:**
> **username_3**: In the question it is assumed that we have an pubkeyhash. If we look at the defenition of an address it consists of a credential and maybe a stakingcredential. The former is in the case of a normal shelley address given by a pubkeyHash. If it is a script, then its the validator hash. So it is definitly possible to construct an address from a pubkeyhash. What is not possible is deriving the pubkey from the pubkeyhash (as you state). See https://playground.plutus.iohkdev.io/doc/haddock/plutus-ledger/html/Ledger-Address.html#t:Address  

---

### Answer by username_4 on 2021-11-15. Score: 0

You might want to investigate cardano-serialization-lib or cardano-addresses for this.
echo addr1gqtnpvdhqrtpd4g424fcaq7k0ufuzyadt7djygf8qdyzevuph3wczvf2dwyx5u | ./cardano-address address inspect

{
"stake_reference": "by pointer",
"spending_key_hash_bech32": "addr_vkh1zuctrdcq6ctd29242w8g84nlz0q38t2lnv3zzfcrfqktx0c9tzp",
"pointer": {
    "slot_num": 24157,
    "output_index": 42,
    "transaction_index": 177
},
"address_style": "Shelley",
"spending_key_hash": "1730b1b700d616d51555538e83d67f13c113ad5f9b22212703482cb3",
"network_tag": 0 }

But that is a movement in an opposite direction, getting a pkh from address.


---

