horizontalsystems / bitcoin-kit-android

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

Bitcoin Mainnet Sync Does Not Work #584

Open petarkenic opened 2 years ago

petarkenic commented 2 years ago

When I run the Bitcoin Kit sample app with a custom seed phrase using BIP44, API, and MainNet as parameters, the sync fails to get my transactions that occurred before the Checkpoint. The associatedTransactions for the correct blockHash do not include any of the transactions that are associated with my addresses under the HD wallet.

abdrasulov commented 2 years ago

Try to run it with SyncMode.Full mode.

petarkenic commented 2 years ago

Yes that will work, but the sync is way too long as it does not make use of Checkpoint. There is an issue with syncing transactions when using API as the option.

abdrasulov commented 2 years ago

We checked syncing via API. It worked well for several test accounts. It uses the following API endpoint to retrieve transaction data https://blockchain.info/multiaddr?active=$addresses. Can you please check if it retrieves the transactions for your addresses? Multiple addresses are joined with the "|" symbol

petarkenic commented 2 years ago

We resolved the issue. So what happened was that we were using BIP44 but we had some transactions using the BIP49 generated addresses. The API would fetch the transactions and store the respective block hashes in the app DB. However, the SPV sync would not be able to fetch the transactions associated with the block hash stored which led to no transactions showing up. All in all this is not an issue anymore because we switched to using BIP49. Thanks for testing this out and for the response!

I am wondering why in the following code for the BIP44 block we have Bip49RestoreKeyConverter and Bip84RestoreKeyConverter?

Screen Shot 2022-08-29 at 10 34 28 AM