ebellocchia/py_crypto_hd_wallet

Polkadot Fearless(android) | SubWallet (browser extension) wallets address derivation

Closed this issue · 6 comments

I can’t figure out how these wallets generate addresses and how to get them using this wonderful library

Mnemonic: note choose skull orchard also harbor glove elevator motor need spoil deposit
Seed: e271ac40261421ceae5a74caac496268c28d65f7ad27417e0201813f8106e56fba384d91fe2faa3d884157e08cf1abdf013209a38f210abc536d8f87d994d882

Need find how to generate address 13Qae5X36FYNNBWHxYm8WCePu8AGoUixHEtvxjGbZxDiPgTz from this

https://github.com/kubetrail/dotkey
This library does what it needs to, but it's in Golang

Ok I'll check it, but if it's compatible with PolkadotJS it's strange that you get different results

Regards
Emanuele

Thank you, I'll be waiting, thank you very much

Hi,
I got the address by simply using the HdWalletSubstrateFactory class.

from py_crypto_hd_wallet import *

mnemonic = "note choose skull orchard also harbor glove elevator motor need spoil deposit"
hd_wallet_fact = HdWalletSubstrateFactory(HdWalletSubstrateCoins.POLKADOT)
hd_wallet = hd_wallet_fact.CreateFromMnemonic("dot_wallet", mnemonic)
hd_wallet.Generate()
HdWalletSaver(hd_wallet).SaveToFile("my_wallet.txt")

print("Address", hd_wallet.GetData(HdWalletSubstrateDataTypes.KEY).GetKey(HdWalletSubstrateKeyTypes.ADDRESS))

Generated wallet:

{
    "wallet_name": "dot_wallet",
    "coin_name": "Polkadot (DOT)",
    "mnemonic": "note choose skull orchard also harbor glove elevator motor need spoil deposit",
    "passphrase": "",
    "seed_bytes": "04d8e7c8e0cd3dfdf5333408594906cf7f12fdbaeef2c2300d2106732f9b06a236bec264734f70df337321ab5785cf67b5b969a41a6799793f9f2987c6c39ed6",
    "key": {
        "pub": "6a7459e17e3a5e8f36c3bf7a3cb65ee62c390d15b525b5c5bbcc785bde699b0b",
        "priv": "f8934d24db5df33e2cac806506e036241b558e3881948a9493e3a766e8fc120da4a15393529a5c882f2af70e9afb9c39a003905392441296434a77523df8e58b",
        "address": "13Qae5X36FYNNBWHxYm8WCePu8AGoUixHEtvxjGbZxDiPgTz"
    }
}

NOTE: the seed e271ac40261421ceae5a74caac496268c28d65f7ad27417e0201813f8106e56fba384d91fe2faa3d884157e08cf1abdf013209a38f210abc536d8f87d994d882 is not correct, that's the BIP39 seed but Polkadot uses a different seed generation.

Thank you very much, I really indicated the wrong seed value