Giter Club home page Giter Club logo

Comments (2)

iancoleman avatar iancoleman commented on August 20, 2024

Thanks for this.

I reproduced the original discrepancy with electrum.

However bip32.org and rust crate bip32 both match this tool.


Testing further, bip32.org derivation matches this tool. So maybe electrum is not generating correctly? To reproduce:

Load http://bip32.org/

Enter Root Bip32 extended key
xprv9s21ZrQH143K2RNTXyvRSpYo18F2u9zxag3PwCqZgZbyEATwSERJQixPzL5cXHrV7EiVPTWp1u5UTZ1gdYqcRVqf2bf4iapyxsLDYM7Vd68

Set Derivation Path to custom

Set Custom Path to m/44'/0'/0'/0/20

See the address is
1DCcxvVrj6tFrPfg4YZWYme4BYNS1d34D6
which matches this tool but does not match electrum


Testing further, rust crate bip32 also matches this tool. Minimal example:

use bip32::{Mnemonic, PublicKey, Prefix, XPrv};
fn main() {
    // Generate Mnemonic using the default language (English)
    let m = "mystery sorry truck rural express wait method winner enforce logic gospel silent alone fantasy ride pilot price pool token chair dress mansion canvas current";
    let mnemonic = Mnemonic::new(m, Default::default()).unwrap();
    // Derive a BIP39 seed value using the given password
    let seed = mnemonic.to_seed("");
    // Derive the root `XPrv` from the `seed` value
    let root_xprv = XPrv::new(&seed).unwrap();
    println!("Root xprv {:?}", root_xprv.to_string(Prefix::XPRV));
    // Derive a child `XPrv` using the provided BIP32 derivation path
    let child_path = "m/44'/0'/0'/0/20";
    let child_xprv = XPrv::derive_from_path(&seed, &child_path.parse().unwrap()).unwrap();
    // Get the `XPub` associated with `child_xprv`.
    let child_xpub = child_xprv.public_key();
    // Get the ECDSA/secp256k1 signing and verification keys for the xprv and xpub
    let verification_key = child_xpub.public_key();
    println!("Public Key Hex: {:x?}", verification_key.to_bytes());
}

Open to ideas about why this difference exists. I can't work out how to generate the electrum key at index 20.

from bip39.

nullsavvy avatar nullsavvy commented on August 20, 2024

Sorry I'm not familiar enough with the matter to give any idea about why this difference exist.
But thank you very much for the detailed problem analysis, which I can use to drop an issue at electrum.
Maybe they can explain us what is happening at index 20.

from bip39.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.