horizontalsystems / bitcoin-kit-ios

Comprehensive Bitcoin development library for iOS, implemented on Swift. SPV wallet implementation for Bitcoin, Bitcoin Cash, Litecoin and Dash blockchains. Comprehensive Bitcoin development library for iOS, implemented on Swift. SPV wallet implementation for Bitcoin, Bitcoin Cash, Litecoin and Dash blockchains. Fully compliant with existing standards and BIPs.
https://unstoppable.money
MIT License
241 stars 72 forks source link

Balance not fetched after syncing via API #461

Closed cybercent closed 4 years ago

cybercent commented 4 years ago

When loading a wallet from an existing seed, after API syncing, the balance is not recovered (displayed as 0).

Tested on:

esen commented 4 years ago

Hi @slash7

Are you trying to restore a wallet which had some coins in some other wallet app? If yes, what's the derivation path used in that wallet? BIP84?

You may have wrong key derivation used for Bech32 address where you have your coins. Wallets that use BIP44, BIP49 or BIP84 derivation paths, are assumed completely different wallets. Even if the seeds are the same. Theoretically(with no compliance to BIPs) Bech32 address can be generated from any key from any derivation path.

Thanks for reporting.

cybercent commented 4 years ago

Hi @esen

Thanks for answering. I've tried restoring a wallet created with Electrum on the Testnet. The address is a bech32 address so I assumed the derivation path is BIP84, otherwise, the address would have been Base58Check encoded. I'll look into the Electrum derivation paths, maybe they used BIP49 and that might explain it. Thanks.