11

We wish to generate large numbers of receive addresses for a single wallet. These addresses will let us identify who is sending us Cardano, or other native assets. Can someone explain how one goes about generating such addresses?

1
9

Multi address wallets are usually called Hierarchically Deterministic (HD) wallets and are defined by the BIP44 standard.

In Cardano, we do extend BIP44 in CIP1852 by adding staking key capabilities, but this is not your use case.

To derive wallet addresses for a single wallet, it is easiest to use an existing library that can do this for you, as for example the cardano-seralization-lib by Emurgo.

Have a look at their documentation, but this easy snippet you will show you how to derivate the 10th address of your wallet:

function harden(num: number): number {
  return 0x80000000 + num;
}


const rootKey = CardanoWasm.BIP32PrivateKey.from_bech32("xprv17qx9vxm6060qjn5fgazfue9nwyf448w7upk60c3epln82vumg9r9kxzsud9uv5rfscxp382j2aku254zj3qfx9fx39t6hjwtmwq85uunsd8x0st3j66lzf5yn30hwq5n75zeuplepx8vxc502txx09ygjgx06n0p");
const accountKey = rootKey
  .derive(harden(1852)) // purpose
  .derive(harden(1815)) // coin type
  .derive(harden(0)); // account #0

const utxoPubKey = accountKey
  .derive(0) // external
  .derive(9) // <- here is the index of your address, cycle thought this number to generate more of it
  .to_public();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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