ebellocchia / bip_utils

Generation of mnemonics, seeds, private/public keys and addresses for different types of cryptocurrencies
MIT License
324 stars 86 forks source link

Shelley 12 Word Wallet #81

Closed Abvit-eve closed 2 years ago

Abvit-eve commented 2 years ago

I was working with the cardano example code and noticed I could create a 12 word shelley era wallet and get outputs. From the cardano docs I've seen, I thought at least 15 words was required to create a shelley era wallet with "addr" addresses. Is 12 words in the shelley code valid?

This is however counter to trustwallet and exodus that provide 'addr' addresses but only have 12 word recovery phrases.

Are trust & exodus 'byron' era but are doing a 'addr' address derivation? Documentation from Cardano is poor and not kept up to date.

ebellocchia commented 2 years ago

Hi, Cardano doc doesn't specify a minimum length for the seed and it states that BIP39 mnemonics are used, so it principle any BIP39 words number is valid (i.e. from 12 to 24, multiple of 3). At least that's how I interpreted it.

So, if you want to get the same addresses of Yoroi, you have to use 15-word or 24-word. TrustWallet uses the same key derivation of Yoroi but with 12-word (so CardanoIcarusSeedGenerator with Cip1852 like the first case in the example).

Abvit-eve commented 2 years ago

Thank you for the response and example update. Very helpful.

Abvit-eve commented 1 year ago

Would it be possible to implement the DerivePath attribute for CIP1852 objects? It would be useful for debugging as Trustwallet Core and other test vectors have M/0' etc that is not available for this coinset.

ebellocchia commented 1 year ago

No, because that class can only derive pre-defined paths (i.e. the ones defined by CIP1852), not any arbitrary path. If you need to derive custom paths, you shall use a BIP32 class (CardanoIcarusBip32 for Cardano Icarus, Bip32KholawEd25519 for Cardano Ledger, as you can see here).