1

I checked Swan's Address Derivation Library https://github.com/swan-bitcoin/xpub-tool.

I try to get m44 address, but I got m84. Why? Do you know is it any parameter to force return m44? I tried to pass path: "m/44'/0'/0'/0", but it did not help.

Do you have any idea?

addressFromXPub("xpub6C5oXscLYZwgq2DB42TFC32QcoPa1MeCWUNPZSjydunniCM77TRcBfFnjScJeToVXS5RBDr53Ls5RXvDHujmFSL4Fqc9kkpsMjU1vg68xv7"
  );

export const addressFromXPub = (key) => {
  console.log(
    addressesFromExtPubKey({
      extPubKey: key,
      network: "mainnet",
      addressCount: 3,
    })
  );
};
[
    {path: "m/84'/0'/0'/0/0", address: "bc1qfgnqm6g46ys0h9gh606m76wemka2rrttrac90x"
    },
    {path: "m/84'/0'/0'/0/1", address: "bc1qnvzdj2m4wsrcrtl30j5c304qa77v4h2s8ajp0r"
    },
    {path: "m/84'/0'/0'/0/2", address: "bc1qjf5u77e6clwkxgf7a0shw7zq2nhqr4vjys7an0"
    }
]
1
  • Where in your code are you trying to pass the derivation path as m/44'/0'/0'/0? I don't see it in your question. Also, xpubs already have the derivation path encoded in them. You can't change an xpub's deriv without changing the root and then create a new xpub/ypub/zpub. – m1xolyd1an Feb 27 at 3:46
0

The following key:

xpub6C5oXscLYZwgq2DB42TFC32QcoPa1MeCWUNPZSjydunniCM77TRcBfFnjScJeToVXS5RBDr53Ls5RXvDHujmFSL4Fqc9kkpsMjU1vg68xv7

Corresponds to a level 3 public key w/index of 0x00000080 which is 0h/0'. In the context you've described it probably corresponds to "m/?/?/0'". This key's parent's fingerprint is 0x3ab9169c, so you'd need to provide the parent's full fingerprint to confirm the original derivation path.

Although m44 & m84 have the same master/root key, they have completely different level 1 keys, which would change all lower nodes. In short you can only derive m/... full paths from root keys, not child keys, which you've provided.

Edit: The key you've provided is probably meant for deriving receive & change addresses of a certain address type.

1
  • thanks, do you know here: iancoleman.io/bip39 which field contains the root keys? I tried both: Account Extended Public Key and BIP32 Extended Public Key to pass to addressesFromExtPubKey, but again m84 was returned, strange – János Feb 27 at 21:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.