<p>You can try with this line:</p>
<pre><code>wasm.StakeCredential.from_bytes(
 Buffer.from(&quot;98ab0c9333611bee9b2e58f6daa99f237d173e0c7af6a7a203d6be27&quot;, &quot;hex&quot;)
)
</code></pre>
<p>Alternatively, you can try using <code>from_keyhash</code> method. This method expects to receive a <code>Ed25519KeyHash</code>, which you can build from the given Stake Key Hash, all in the same instruction, like this:</p>
<pre><code>wasm.StakeCredential.from_keyhash(
 wasm.Ed25519KeyHash.from_bytes(
  Buffer.from(&quot;e198ab0c9333611bee9b2e58f6daa99f237d173e0c7af6a7a203d6be27&quot;, &quot;hex&quot;)
 )
)
</code></pre>

CC BY-SA 4.0
2022-06-21T07:14:48.120Z
2022-06-21T07:14:48.120Z
Falcon Stakepool
<p>I am tiring to use Cardano Sterilization Lib to get the Stake/Usable address from Stake Hash or Address Hash.</p>
<p><a href="https://adaex.org/address/addr1q8d27ughqsqras7k9wnr4dlustzjlhadhe9rf6t3tr90u5yc4vxfxvmpr0hfktjc7md2n8er05tnurr676n6yq7khcnss8msq0/all-addresses#data" rel="nofollow noreferrer">https://adaex.org/address/addr1q8d27ughqsqras7k9wnr4dlustzjlhadhe9rf6t3tr90u5yc4vxfxvmpr0hfktjc7md2n8er05tnurr676n6yq7khcnss8msq0/all-addresses#data</a></p>
<p>Address Hash: 01daaf711704003ec3d62ba63ab7fc82c52fdfadbe4a34e97158cafe5098ab0c9333611bee9b2e58f6daa99f237d173e0c7af6a7a203d6be27</p>
<p>Stake Key Hash: e198ab0c9333611bee9b2e58f6daa99f237d173e0c7af6a7a203d6be27</p>
<p>I saw <a href="https://cardano.stackexchange.com/questions/7689/convert-xpub-public-key-from-ccvault-to-bech32-or-acct-public-key">Convert xpub public key from ccvault to bech32 or acct_ public key</a> which showed a way but I couldn't get it to work.</p>
<p><code>wasm.StakeCredential.from_bytes(new TextEncoder().encode(&quot;98ab0c9333611bee9b2e58f6daa99f237d173e0c7af6a7a203d6be27&quot;))</code></p>
<p>returns  Deserialization failed in StakeCredential because: Invalid cbor: not the right type, expected <code>Array' byte received </code>Text'.</p>
<p>Thanks!</p>

<cardano-serialization-lib><cardano-address>
Convert Stake Key to Address
# Convert Stake Key to Address

(Asked by: username_0 on 2022-06-21)

I am tiring to use Cardano Sterilization Lib to get the Stake/Usable address from Stake Hash or Address Hash.

<https://adaex.org/address/addr1q8d27ughqsqras7k9wnr4dlustzjlhadhe9rf6t3tr90u5yc4vxfxvmpr0hfktjc7md2n8er05tnurr676n6yq7khcnss8msq0/all-addresses#data>

Address Hash: 01daaf711704003ec3d62ba63ab7fc82c52fdfadbe4a34e97158cafe5098ab0c9333611bee9b2e58f6daa99f237d173e0c7af6a7a203d6be27

Stake Key Hash: e198ab0c9333611bee9b2e58f6daa99f237d173e0c7af6a7a203d6be27

I saw [Convert xpub public key from ccvault to bech32 or acct\_ public key](https://cardano.stackexchange.com/questions/7689/convert-xpub-public-key-from-ccvault-to-bech32-or-acct-public-key) which showed a way but I couldn't get it to work.

`wasm.StakeCredential.from_bytes(new TextEncoder().encode("98ab0c9333611bee9b2e58f6daa99f237d173e0c7af6a7a203d6be27"))`

returns Deserialization failed in StakeCredential because: Invalid cbor: not the right type, expected `Array' byte received` Text'.

Thanks!

**Tags:** cardano-serialization-lib, cardano-address

---

## 1 answers

### Answer by username_1 on 2022-06-21. Score: 2 | Accepted answer

You can try with this line:
wasm.StakeCredential.from_bytes(
 Buffer.from("98ab0c9333611bee9b2e58f6daa99f237d173e0c7af6a7a203d6be27", "hex")
)

Alternatively, you can try using from_keyhash method. This method expects to receive a Ed25519KeyHash, which you can build from the given Stake Key Hash, all in the same instruction, like this:
wasm.StakeCredential.from_keyhash(
 wasm.Ed25519KeyHash.from_bytes(
  Buffer.from("e198ab0c9333611bee9b2e58f6daa99f237d173e0c7af6a7a203d6be27", "hex")
 )
)


---

