I have this Stake Key:


I want to convert from 7622b4611b15441e7e15cba128ff999ad72388aeb267adc6e70cc9bc to stake_test1upmz9drprv25g8n7zh96z28lnxddwgug46ex0twxuuxvn0qp3cptz format.

How do I do it using this library https://github.com/Emurgo/cardano-serialization-lib?


1 Answer 1


The beech32 representation is a bit tricky, but you can do it like this:

const stakeKey = StakeCredential.from_bytes(from_hex('7622b4611b15441e7e15cba128ff999ad72388aeb267adc6e70cc9bc'));
const networkId = 1; // testnet = 1, mainnet = 0
const beech32StakeKey = RewardAddress.new(networkId, stakeKey).to_address().to_bech32();

Hope this helps. The "from_hex" function is just a simple js function to convert the Hex string into an UInt8Array that is needed for the from_bytes function of StakeCredentials.

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.