trustwallet / wallet-core

Cross-platform, cross-blockchain wallet library.
https://developer.trustwallet.com/wallet-core
Apache License 2.0
2.81k stars 1.58k forks source link

Wrong BTC and LTC BIP44 paths #633

Closed cbhaiji closed 5 years ago

cbhaiji commented 5 years ago

Describe the bug For BTC and LTC derivationPath is not correct. Hence it is not generating correct address as well.

To Reproduce

CoinType.bitcoin.derivationPath()
"m/84\'/0\'/0\'/0/0"

CoinType.litecoin.derivationPath()
"m/84\'/2\'/0\'/0/0"

Expected behavior

CoinType.bitcoin.derivationPath()
"m/44\'/0\'/0\'/0/0"

CoinType.litecoin.derivationPath()
"m/44\'/2\'/0\'/0/0"

Additional context For following currencies, ethereum and dash it is giving correct derivationPath henec generating correct address as well

CoinType.ethereum.derivationPath()
"m/44\'/60\'/0\'/0/0"
CoinType.dash.derivationPath()
"m/44\'/5\'/0\'/0/0"
hewigovens commented 5 years ago

We're using bip84 for bitcoin and litecoin

cbhaiji commented 5 years ago

@hewigovens is there any way we can generate bip44 addresses from this library? It is since for all our coins we are using BIP44. Also, can we generate addresses for Bitcoin Testnet?

hewigovens commented 5 years ago

Yes, you can change the path in coins.json and use BitcoinAddress, some forks have done this; we don't support testnet