Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reactnative generate address error #2085

Open
jiegege10 opened this issue Apr 23, 2024 · 7 comments
Open

reactnative generate address error #2085

jiegege10 opened this issue Apr 23, 2024 · 7 comments

Comments

@jiegege10
Copy link

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?

@junderw
Copy link
Member

junderw commented Apr 23, 2024

What version are you using?

If not the latest, try using the latest.

@jiegege10
Copy link
Author

What version are you using?

If not the latest, try using the latest.

I'm using the latest version

@junderw
Copy link
Member

junderw commented Apr 23, 2024

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

@junderw
Copy link
Member

junderw commented Apr 23, 2024

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
Copy link
Member

junderw commented Apr 23, 2024

You are using v6.1.5?

@jiegege10
Copy link
Author

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

@jasonandjay
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants