Bitcoin Forum

Bitcoin => Mycelium => Topic started by: raducostea on October 06, 2017, 07:39:20 AM



Title: Mycelium wallet not showing balance
Post by: raducostea on October 06, 2017, 07:39:20 AM
So i am using HD mycelium wallet with the payment gateway. I have generated about 100 addresses and about 15 of them have been paid and have confirmed amounts. The problem is that mycelium android app only sees 18 addresses and only 1 transaction. I checked the other addresses and they are derived correctly is just that they are not imported in my wallet. Is like mycelium doesn't want to check more derived addresses for existing balance.


Title: Re: Mycelium wallet not showing balance
Post by: HCP on October 10, 2017, 07:08:29 AM
Sounds like a "Gap Limit" issue. If those payments are out past the Mycelium "gap limit", then the wallet won't find them... Gap limits exist so that wallets don't search forever looking for transactions that don't exist on unused addresses... the theory being that the large majority of users use addresses consecutively... they don't generate 100 addresses, spam them out... and get transactions sent to random ones out of order.

I think the Mycelium Gap Limit is the BIP44 default of "20"...
Code: (https://github.com/mycelium-com/wallet/blob/master/wapi/src/main/java/com/mycelium/wapi/wallet/bip44/Bip44Account.java)
   private static final int EXTERNAL_FULL_ADDRESS_LOOK_AHEAD_LENGTH = 20;
   private static final int INTERNAL_FULL_ADDRESS_LOOK_AHEAD_LENGTH = 20;
Basically, if it is hunting through the list of generated addresses and finds 20 unused in a row, it will stop searching. Once one (or more) of those "20" addresses becomes used, the gap limit "search window" will slide along and more addresses will be searched... finding more used addresses.

Looking at that code, you cannot alter the gap limit in Mycelium ("static final" is a fixed constant value)... to confirm that those transactions have been received, you'd need to import your key into another wallet like "Electrum" on a desktop that allows you to manually configure the Gap Limit size... or use the BIP39 tool (https://iancoleman.github.io/bip39/) and check the addresses by hand in a blockexplorer...

Or you'd have to download the source code... alter those values and compile your own APK :P