MultiversX Tracker is Live!

Can't get the bip32masterkey from mnemonic seed (Python)

Bitcoin Stack Exchange

Bitcoin News / Bitcoin Stack Exchange 118 Views

I'm trying to understandand implement the functioning of Hierarchical deterministic wallets. But I can't get the bip32masterkey based on this tutorial : https://medium.com/mycrypto/the-journey-from-mnemonic-phrase-to-address-6c5e86e11e14

this mnemonic seed : 0x77cdf1d92225adc0e67b1b4f5a31820251d518b3af074df25a07b751947fd07ebd29a4d0e57b84ea9de03a9123e2a6ea1e3ed739d4c562efec21f1bb0a54a879

should give me this bip32masterkey : 0x300b155f751964276c0536230bd9b16fe7a86533c3cbaa7575e8d0431dbedf23f9945bb8b052bd0b0802c10c7c852e7765b69b61ce7233d9fe5a35ab108ca3b6

but instead I have (pbkdf2) : 0x11df5cd2d2095dde0a46a8de0c2aba91a565e16dd0e5877d21285e605659d587bd3b3c72cba372ecf3b26fdf27151d9dc5d9f341760784cb04540f95d193c383

and this (hmac-sha512): 0xc661464729610902524d0919cc3000af9bfbd4fa003e78979b6026bb24d150ae99c5f70573e3eaf1b04ab3c735adc7e410bb65557e1f35cdf29f87825f9699c5

here's the code i'm using :

def get_bip32masterkey(seed): master_key = pbkdf2_hmac("SHA512", bytes(binascii.a2b_hex(seed)), bytes("Bitcoin seed".encode()), 1).hex() return (master_key)

I also tried with hmac instead of pbkdf2 but I cant get the right bip32masterkey, does someone see the point i'm missing ?

that's the code I'm using with hmac :

def bip32masterkey(seed): seed = binascii.a2b_hex(seed) masterkey = hmac.new(key=bytes("Bitcoin seed".encode()), msg=seed, digestmod=sha512).hexdigest() return (masterkey)

(I'm not a python dev I'm just trying to understand the basis)

Thank you in advance to all for your answers

EDIT : It looks like the example I was using provide false information and my hmac implementation is working.


Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments