1

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 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!

1 Answer 1

2

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")
 )
)

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.