bitcoinjs-lib icon indicating copy to clipboard operation
bitcoinjs-lib copied to clipboard

reactnative generate address error

Open jiegege10 opened this issue 10 months ago • 7 comments

const seed = await bip39.mnemonicToSeed(mnemonic) const root = bip32.fromSeed(seed); const path = "m/44'/0'/0'/0/0" const child = root.derivePath(path) const bean = await payments.p2pkh({pubkey: child.publicKey})

The address generated in the vue project is correct and the same code. I changed the encryption to crypto-browserify. The address signature is correct, but the last six digits are wrong. How should I solve this problem?

jiegege10 avatar Apr 23 '24 09:04 jiegege10

What version are you using?

If not the latest, try using the latest.

junderw avatar Apr 23 '24 11:04 junderw

What version are you using?

If not the latest, try using the latest.

I'm using the latest version

jiegege10 avatar Apr 23 '24 12:04 jiegege10

What does this mean: "I changed the encryption to crypto-browserify"

junderw avatar Apr 23 '24 13:04 junderw

crypto-browserify has nothing to do with address creation... we don't use it. We don't use the NodeJS crypto API for hashes. We use noble.

junderw avatar Apr 23 '24 13:04 junderw

You are using v6.1.5?

junderw avatar Apr 23 '24 13:04 junderw

You are using v6.1.5?

yes,But in my vue project, the generated address is correct. But the address generated in Reactnative is wrong. The code is the same

jiegege10 avatar Apr 24 '24 16:04 jiegege10

You are using v6.1.5?

yes,But in my vue project, the generated address is correct. But the address generated in Reactnative is wrong. The code is the same

@jiegege10 What does "the last six digits are wrong" mean? Are you referring to the bean.address of P2PKH? I suggest you print root.fingerprint to see if xpub is the same as expected in both environments

jasonandjay avatar Apr 30 '24 02:04 jasonandjay