0

I was able to generate a single address following the guide. My question is regarding stake key. Is it necessary to derive a new stake key for each new address or can you just increment .derive(n + 1) and use the same stake key?

const utxoPubKey = accountKey
  .derive(0) // external
  .derive(0)
  .to_public();

const stakeKey = accountKey
  .derive(2) // chimeric
  .derive(0)
  .to_public();

const baseAddr = CardanoWasm.BaseAddress.new(
  CardanoWasm.NetworkInfo.mainnet().network_id(),
  CardanoWasm.StakeCredential.from_keyhash(utxoPubKey.to_raw_key().hash()),
  CardanoWasm.StakeCredential.from_keyhash(stakeKey.to_raw_key().hash()),
);

Many thanks!

1 Answer 1

0

Every account should only use 1 stake key, and it resides within m/1852H/1815H/0H/2/0. Every new address that you generate should use the same stake key. This is so that when you're staking your wallet, it can track your balance across different payment addresses that use the same stake key.

Reference to Address Derivation documentation, under the Path Level

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.