<p>You can see the CDDL spec for full details: <a href="https://github.com/input-output-hk/cardano-ledger/blob/master/eras/shelley/test-suite/cddl-files/shelley.cddl" rel="nofollow noreferrer">https://github.com/input-output-hk/cardano-ledger/blob/master/eras/shelley/test-suite/cddl-files/shelley.cddl</a></p>
<p>In the case of a payment base address (the most common address on the chain at the moment), the address when converted from bech32 -&gt; hex will have a prefix of 00 (on testnet, 01 on mainnet), followed by the payment credential, followed by the stake credential. The payment and stake credentials are hashes of those pubkeys.</p>
<p>Here's an example output (and cardano-address inspect output so you can see an example matching the pieces):</p>
<pre><code>cardano-address address inspect &lt;&lt;&lt; addr_test1qrkgclg3rsz8v8hnv2sqxmfk3yl87p9dme906h4ru859j9z076sepqv0ms7pud50lrgfh3e72jrysy5wawg4hqgmzfrsvgallu
{
    &quot;stake_reference&quot;: &quot;by value&quot;,
    &quot;stake_key_hash_bech32&quot;: &quot;stake_vkh1flm2ryyp3lwrc83k3ludpx788e2gvjqj3m4ezkuprvfywejlp0j&quot;,
    &quot;stake_key_hash&quot;: &quot;4ff6a190818fdc3c1e368ff8d09bc73e548648128eeb915b811b1247&quot;,
    &quot;spending_key_hash_bech32&quot;: &quot;addr_test1ajx86yguq3mpaumz5qpk6d5f8elsftw7ft74aglpapv3g07qz53&quot;,
    &quot;address_style&quot;: &quot;Shelley&quot;,
    &quot;spending_key_hash&quot;: &quot;ec8c7d111c04761ef362a0036d36893e7f04adde4afd5ea3e1e85914&quot;,
    &quot;network_tag&quot;: 0

bech32 &lt;&lt;&lt; addr_test1qrkgclg3rsz8v8hnv2sqxmfk3yl87p9dme906h4ru859j9z076sepqv0ms7pud50lrgfh3e72jrysy5wawg4hqgmzfrsvgallu
00ec8c7d111c04761ef362a0036d36893e7f04adde4afd5ea3e1e859144ff6a190818fdc3c1e368ff8d09bc73e548648128eeb915b811b1247
</code></pre>

CC BY-SA 4.0
2021-12-16T16:12:40.097Z
2021-12-16T16:12:40.097Z
Samuel Leathers
<p>Check out <a href="https://github.com/input-output-hk/cardano-addresses" rel="nofollow noreferrer">cardano-addresses</a>, and scroll to the &quot;how to inspect address&quot; section</p>

CC BY-SA 4.0
2021-12-16T13:51:01.980Z
2021-12-16T13:51:01.980Z
zhekson
<p>How to get <code>Address -&gt; PubKeyHash</code> without <strong>vkey</strong> just with <strong>addr</strong> like <code>addr_test1wrf230u95zr26lut09mchmt82d235v6335jvszme2jevklslg5lfz</code>?</p>
<p>It must be possible, because when you build unlocking transaction from smartcontract locked funds  with <code>cardano-cli transaction build ...</code> you pass <code>--change-address</code> parameter which doesn't require <strong>vkey</strong> like <code>cardano-cli address key-hash</code> command does. Smartcontract manages to get <strong>PubKeyHash</strong> from provided <strong>addr_...</strong> which it can get from <code>txOutputs :: [txOut]</code></p>

<plutus><cardano-cli><address><public-key><hash>
How to get PubKeyHash of an address without vkey?
# How to get PubKeyHash of an address without vkey?

(Asked by: username_0 on 2021-12-16)

How to get `Address -> PubKeyHash` without **vkey** just with **addr** like `addr_test1wrf230u95zr26lut09mchmt82d235v6335jvszme2jevklslg5lfz`?

It must be possible, because when you build unlocking transaction from smartcontract locked funds with `cardano-cli transaction build ...` you pass `--change-address` parameter which doesn't require **vkey** like `cardano-cli address key-hash` command does. Smartcontract manages to get **PubKeyHash** from provided **addr\_...** which it can get from `txOutputs :: [txOut]`

**Tags:** plutus, cardano-cli, address, public-key, hash

---

## 2 answers

### Answer by username_1 on 2021-12-16. Score: 3 | Accepted answer

You can see the CDDL spec for full details: https://github.com/input-output-hk/cardano-ledger/blob/master/eras/shelley/test-suite/cddl-files/shelley.cddl
In the case of a payment base address (the most common address on the chain at the moment), the address when converted from bech32 -> hex will have a prefix of 00 (on testnet, 01 on mainnet), followed by the payment credential, followed by the stake credential. The payment and stake credentials are hashes of those pubkeys.
Here's an example output (and cardano-address inspect output so you can see an example matching the pieces):
cardano-address address inspect <<< addr_test1qrkgclg3rsz8v8hnv2sqxmfk3yl87p9dme906h4ru859j9z076sepqv0ms7pud50lrgfh3e72jrysy5wawg4hqgmzfrsvgallu
{
    "stake_reference": "by value",
    "stake_key_hash_bech32": "stake_vkh1flm2ryyp3lwrc83k3ludpx788e2gvjqj3m4ezkuprvfywejlp0j",
    "stake_key_hash": "4ff6a190818fdc3c1e368ff8d09bc73e548648128eeb915b811b1247",
    "spending_key_hash_bech32": "addr_test1ajx86yguq3mpaumz5qpk6d5f8elsftw7ft74aglpapv3g07qz53",
    "address_style": "Shelley",
    "spending_key_hash": "ec8c7d111c04761ef362a0036d36893e7f04adde4afd5ea3e1e85914",
    "network_tag": 0

bech32 <<< addr_test1qrkgclg3rsz8v8hnv2sqxmfk3yl87p9dme906h4ru859j9z076sepqv0ms7pud50lrgfh3e72jrysy5wawg4hqgmzfrsvgallu
00ec8c7d111c04761ef362a0036d36893e7f04adde4afd5ea3e1e859144ff6a190818fdc3c1e368ff8d09bc73e548648128eeb915b811b1247


---

### Answer by username_2 on 2021-12-16. Score: 1

Check out [cardano-addresses](https://github.com/input-output-hk/cardano-addresses), and scroll to the "how to inspect address" section


---

