non-public key – Python: Why the addresses and keys generated by pywallet and bip32utils utilizing the identical 12 mnemonic phrases do not match?


I attempted to generate wallets through the use of pywallet and bip32utils (Python). However I famous that the addresses/keys of the two wallets, specifically wallet_pywallet and wallet_bip39 do not match with one another.

I famous that the addresses/keys of wallet_bip39 match with Exodus, however wallet_pywallet does not. We’ve been utilizing pywallet for such a very long time so I imagine wallet_pywallet must be appropriate as properly. Why is there such a discrepancy?

Under is the code, whereas the code for wallet_bip39 is obtained from this submit.

from pywallet import pockets
import binascii
import mnemonic
import bip32utils

def bip39(mnemonic_words):
    mobj = mnemonic.Mnemonic("english")
    seed = mobj.to_seed(mnemonic_words)

    bip32_root_key_obj = bip32utils.BIP32Key.fromEntropy(seed)
    bip32_child_key_obj = bip32_root_key_obj.ChildKey(
        44 + bip32utils.BIP32_HARDEN
        0 + bip32utils.BIP32_HARDEN
        0 + bip32utils.BIP32_HARDEN

    return {
        'mnemonic_words': mnemonic_words,
        'addr': bip32_child_key_obj.Handle(),
        'publickey': binascii.hexlify(bip32_child_key_obj.PublicKey()).decode(),
        'privatekey': bip32_child_key_obj.WalletImportFormat(),
        'coin': 'BTC'

mnemonic_words = pockets.generate_mnemonic()
wallet_pywallet = pockets.create_wallet(community="BTC", seed=mnemonic_words, youngsters=0)
wallet_bip39 = bip39(mnemonic_words)

Supply hyperlink

Leave a reply