2

For my application I need to generate new addresses constanly. I want to do it via mnemonic phrases because it'll allow me to restore a private key of an address if I lose it. I need to generate addresses for SOL, as well as for tokens.

There're multiple patterns I've encountered so far:

1) "m/44'/501'/" + index +"'/0'"

2) "m/44'/60'/0'/0/" + i

3) "m/44'/61'/0'/0/" + i

4) "m/44'/0'/0'/0/" + i

Can a derivation path be anything? Is there any difference between them?

If I create a completely random derivation path, store it somewhere, of course, and then use it in my application, will it work fine regardless of the fact how much random it may be?

 "m/123'/45'/999'/73/" + i

1 Answer 1

4

Technically, it could be anything, but it probably won't be supported by any wallets or tools.

The derivation path like m/44'/501'/0'/0" defines a tree to follow from a seed to the actual key, so typically you use one master key and then derive a child key by following the path. In the case of Solana, 44' means BIP-44, and 501' looks like SOL, so it's meant to look like the Solana "domain".

Each derivation path will generate a different key in the end. You probably want to stay with 44' to start, and then feel free to experiment!

There's some nice reading about hierarchical derivation at https://learnmeabitcoin.com/technical/hd-wallets

4
  • How is 501' looks like SOL?
    – Camila326
    Commented Jan 11, 2023 at 18:20
  • Can it also have an arbitrary length: "m/44'/60'/0'/0/0'/0'/0'/0'/0'/0'/35/99/123"? And "m/44'/60'/999?
    – Camila326
    Commented Jan 11, 2023 at 18:31
  • Yep, looks like it works! I tried solana-keygen pubkey 'prompt://?full-path=m/44/2017/0/1/0/0/0/0/0' as a test
    – Jon C
    Commented Jan 12, 2023 at 13:26
  • 1
    and if you look at 501 as leetspeak, it spells "SOL". "S" = "5", "O" = "0", and "L" = "1"
    – Jon C
    Commented Jan 12, 2023 at 13:34

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.