I am developing some code to derive addresses from various master public keys extracted from a series of wallets for some experiments I want to perform. My code can now work with most wallets I’ve tried to use, but Electrum appears to be breaking down as the XPUB that can be extracted from the Electrum App is from m/0h, not from the normal derived path m/84/0/0, so it causes this code.
xpub_str="zpub6restofthekey..."
bip_obj = Bip84.FromExtendedKey(xpub_str, Bip84Coins.BITCOIN)
addr = bip_obj.Change(Bip44Changes.CHAIN_EXT).AddressIndex(index).PublicKey().ToAddress()
To throw the following exception: “Error”: “Public-only vip object depth (
At first I thought this issue might be using Zpub instead of Xpub, but other wallets like Trezor Suite and Green also used Zpub and managed to generate addresses successfully with the code above.
I would be very grateful if anyone knows how to avoid this problem, or another way to calculate addresses from Electrum XPUB.
Discover more from Earlybirds Invest
Subscribe to get the latest posts sent to your email.