HD Wallet Address Generator

Hey guys,

I put together a JS script for deriving HD wallet addresses.

Most of the code was copied from here, here, and here.

I wanted to have something that was more linear and easier to follow, just as a learning exercise to demonstrate how addresses are constructed in Cardano.

Hopefully this will be useful for anyone else who’s curious about how Cardano addresses work.

I originally wanted to do it in Python, but got stuck on deriving the child public key. Vacuumlabs seem to have made a custom library for this that they’re using in their adalite walllet, and this can be installed easily using npm.

The script can be found here.

And here’s a screenshot of the output:

5 Likes

hello,
Thank you very much for your code.
I got a question, you placed there a hand code first hd address generation:
derivationPath = [0x80000000, 0x80000000]
How do i generate the second one, third one…
Also, does cardano have change address? In that case, how do i generate the change address?
Thank you very much

1 Like

I was never able to figure out how the derivation paths are generated, so I just left it hard coded as the first address.
I would say the best place to ask is probably the dev telegram group: https://t.me/CardanoDevelopersOfficial

Anyway great contribution. Hopefully we see more people doing similar things.

1 Like

I asked it in telegram, if i got an answer gonna tell you how it is, so you can maybe edit it for future references

1 Like