Address derivation in wallet

Key derivation follows the pattern:

Mnemonic -> wallet -> coin -> account -> change -> address

cardano-wallet and subsequently Daedalus and Yoroi generate addresses from this format, usually generating 50 or so unused addresses in sequential address ix order.

My question is, how does the wallet know that a new address belongs to a wallet and how does it get the derivation path for that address? Can the derivation path (ix value) be derived from the address and matched with a public key? I thought this was a one-way street, address can only be derived from derivation path and key, not the other way around. If that is the case, do wallets just generate all of the next addresses sequentially and compare them with new transaction outputs?

And, the wallet also needs to be able to derive the signing key for a specific address in order to spend the funds in each one. Does it match the address with one of the generated addresses and use the derivation path to then get the signing key?


1 Like

Let the docs be your guide.

Oh man, I had read that article so many times but I guess I missed this part:

Because BIP-44 public keys (HD Sequential) are generated in sequence, there’s no need to maintain a derivation path in the address attributes (incidentally, this also makes addresses more private). Instead, we can generate pools of addresses up to a certain limit (called address gap) for known accounts and look for those addresses during block application.

So, in theory, would any address used that is above this “address gap” be unaccounted for in the wallet while still being accessible by the private key? e.g. I generate the address with address ix 10000 and send ADA to it. The wallet wouldn’t see this new ADA until the gap gets up to 10000 while I can still derive the address private key and access the funds.

That is correct. But usually wallets are built with a configuration variable for how far out they will calculate. You could perhaps tweak some config file in Daedalus.

You wouldn’t want to do that though because calculating out that far could take awhile. Could slow down the wallet.

1 Like

Right, I’m just getting a feel for how the wallets work. Thanks for the help!

1 Like