mycelium-com / wallet-android

Mycelium Bitcoin Wallet for Android
http://mycelium.com
Other
658 stars 319 forks source link

Only one unused HD account is allowed #592

Open BitBargain opened 3 years ago

BitBargain commented 3 years ago

Trying to create a new HD account... The app won't allow me because I can only have one unused account.

The MyCelium app believes that I have an unused HD account when I don't. All archived and active HD accounts have at least a few transactions.

Is it perhaps checking for 0-balance HD accounts instead of unused ones? Please look into this and see if it can be fixed. Thank you.

Giszmo commented 3 years ago

Please activate your highest index archived account. Maybe the app is not aware of its transactions.

BitBargain commented 3 years ago

I believe the highest one is active. I always run into this when wanting to send all remaining coins out from the latest active one, then start a new account. I am currently past this point (having created a fresh wallet), so I can't reproduce this (or rather, high costs and time). I am fairly sure that the latest account was active and that I have tried reactivating some accounts as a test. But thanks for the suggestion anyway, I will try reactivating the latest account (if it's even archived) the next time I find myself in this situation.

BitBargain commented 3 years ago

Just to confirm, this happened again, after the update. I have accounts like this

After Acct6 got the coins sent out, I archived it. Now I'm trying to create a new account and it says "only one HD account is allowed".

I have re-activated all the archived accounts and hoping for the best... but even without activation, if I don't have any HD accounts that lack transactions, MyCelium should allow me to create a new one, and not wait for confirmations on my last account or anything like that.

BitBargain commented 3 years ago

Update: after un-archiving all accounts, it did indeed allow me to create a new one. But there is room for improvement. It'd be nice if I didn't have to do that.

Giszmo commented 3 years ago

I fully agree. This is a bug and needs to be fixed.

martinoshub commented 2 years ago

Bump. This limitation should be removed. As well as the app denying the ability for me to archive accounts in offline mode (without internet). I should be able to add, archive or activate accounts regardless of transaction information.

Giszmo commented 2 years ago

Bump. This limitation should be removed. As well as the app denying the ability for me to archive accounts in offline mode (without internet). I should be able to add, archive or activate accounts regardless of transaction information.

The relevant BIP mandates to not have gaps in the sequence of accounts. They will probably not change this aspect.

martinoshub commented 2 years ago

The relevant BIP mandates to not have gaps in the sequence of accounts. They will probably not change this aspect.

There is no need to have gaps in the sequence of accounts. This is a bug.

1) I never tried to create an account while having an unused account. All the accounts in the HD list (whether archived or active) did have at least one transaction. "Unused" should mean "no transactions" rather than "0 balance".

2) Re-activating all archived accounts allowed me to create a new one again, that's why it's confirmed to be a bug. That shouldn't happen. It's a pity that I had to do this while being connected to the internet and I couldn't just activate/archive offline.

3) Though fixing this bug would suffice for me, it wouldn't be the end of the world if in the advanced settings a user could speficy their own gap limit.

meowmachine commented 2 years ago

I am experiencing this bug too but I discovered a workaround solution. I have 9 accounts and all of them either have a current balance or have had at least 1 transaction. None of them are "unused". I have tried to re-activate (unarchive) all of the accounts to add another account but the app still won't let me do it. It says I can only have one unused HD account.

To get around this problem, first go into the Mycelium settings and enable the "Show address path" setting so you can see the full derivation path in each of your accounts. After you enable that setting, choose an account and go to the "Balance" page. You should see something like m/49'/0'/7'/0/2. Find the account that has the highest account number. The account number is the second digit. In my example, my account number would be 7. Your HD wallet as well as all of its accounts and addresses are organized using that derivation path. If you don't understand how derivation paths work, spend a moment to google it before proceeding. You can also probably understand how derivation paths work just by playing around with the settings in the BIP 39 tool.

After observing the derivation paths and account numbers for my current accounts in Mycelium, I imported my BIP 39 mnemonic (recovery seed) into an offline copy of iancoleman's "BIP 39 Tool". You can find the repo at iancoleman/bip39 on github. Then, I went to the BIP 49 tab, and changed the account number to 10. I chose 10 because account # 9 was my highest account in mycelium and I want to add one more. Don't choose random account numbers or you may misplace your bitcoin if you ever need to recover your wallet. When wallets recover from a seed, they don't scan for an infinite number of accounts. So make sure you only use sequential account numbers (0,1,2,3,4,5,etc). If you want to create an account with bech32 addresses, you can use the BIP 84 tab instead of the BIP 44 tab. Then, I clicked the "Account Extended Private Key" box in the BIP 39 tool to display the QR code for this account's extended private key. Finally, in Mycelium, I went to Add Account > Advanced and More > Scan Bitcoin address, private key, or HD bitcoin-account and I scanned the QR code from the BIP 39 tool. That forced Mycelium to import another account into my wallet regardless of whether it thinks I have unused accounts or not. You can verify it worked by looking at the new deposit address that Mycelium gives you for your new account and make sure it matches the first address in the BIP 39 tool.

Be aware that after manually adding an account using this method, Mycelium will not display the correct derivation path for the account on the Balance page because it thinks the account you imported is from a completely different wallet even though it is not. Mycelium will always show the account number as 0, like this: m/49'/0'/0'/0/0. This isn't a serious problem as long as you manually keep track of what your account numbers are. Using this method could probably also cause account collisions if you manage to make a new account through Mycelium in the future. You'd have two identical accounts but you wouldn't lose your bitcoin. Finally, as long as you imported your existing Mycelium recovery seed (mnemonic) into the BIP 39 tool instead of generating a new mnemonic, your wallet will be backed up like normal and no additional backup actions are required.

Caution: only use a verified copy of iancoleman's BIP 39 tool and only use it OFFLINE. If you somehow manage to use a compromised version of the BIP 39 tool, all of your bitcoin can be stolen.

phptek commented 2 years ago

Just like @BitBargain said, I can confirm that re-enabling all my archived accounts allowed me to create new HD Accounts again. As an aside, is it part of BIP39 that after restoring I need to have somehow remembered the exact account names, in order to see and interact with my balances? I find that very weird.

meowmachine commented 2 years ago

No you don't need to remember the exact account names/labels. If you manually add a new account like the way I described, you just need to remember which account numbers you are using because there's no guarantee Mycelium will restore all of your accounts automatically. The account names/labels themselves don't mean anything. They are just a text label in Mycelium for your reference and nothing else. The important part to remember is the account number (as seen in a derivation path). If you restore a wallet from seed, you will lose your account names/labels anyways. Your bitcoin will be restored but the account labels will be lost. After a restore, the account names in Mycelium will say something like: Account 1, Account 2, Account 3, Account 4, etc.

If you use a different BIP39 wallet to restore from seed (such as electrum wallet), it will ask you which derivation path you'd like to restore. If you don't remember which account number or derivation path you used, then you'll have to start guessing. There's too many possible bitcoin addresses for an app like Mycelium to scan for. That's why it's best to use sequential account numbers starting at 0, which Mycelium does automatically for you when you generate a new account. I'm not sure how many accounts Mycelium will automatically scan for when doing a restore. It's best to stay organized anyways so you can restore using a different BIP39 wallet in case the Mycelium project goes away or stops working.

You should make a test wallet with the BIP 39 mnemonic tool and import a few different accounts into Mycelium and electrum wallet to see how it works so you can gain confidence in the restore method. Observe which receiving addresses Mycelium or electrum generates and compare it to what you see in the BIP 39 tool. It will make sense once you start playing around with it a little bit.

6a8d7a commented 2 years ago

I don't know how to make a transaction on another wallet when I put the wallet from another plate it tells me invalid. please help. I want to withdraw my money I don't know how

meowmachine commented 2 years ago

First, slow down and make sure you're doing everything right before attempting random things. Your money isn't going anywhere. Don't attempt to import your mnemonic seed into any other website or software that isnt 100% trustworthy. Second, you aren't providing enough info for anyone to help you. What wallet software (mycelium?) are you trying to import to and from? Explain in detail the steps that you are trying. And what does the error message exactly say? Invalid what?

6a8d7a commented 2 years ago

thank you in the end as I am used to making transactions on blockchain and local bit, I introduced my blockchain bitcoin wallet and I also tried with local bit the message that appears is: invalid address or fio name

meowmachine commented 2 years ago

Sorry, I still don't have enough details to understand or answer your question.

6a8d7a commented 2 years ago

ok sur mon portefeuille mycelium (portefeuille legacy (P2PKH) j'ai des bitcoins que j'ai reçu par trading avec mon courtier . et donc dans la partie solde on peut voir le portefeuille ,le bitcoin et le montant en dollars et aussi l'option envoyer et recevoir. et quand je clic sur envoyer je voie: numériser le code , mes adresses , presse-papier qui s'est actuellement désactivé puis saisie manuelle. j'ai fait saisi manuelle pour copier une autre adresse bitcoin il met invalide adresse ou fio name. et quant je clic sur mes adresses cette partie est vide . car la ba il y a mes comptes et l'adresse book qui est vide dans mes comptes il n y a que mes adresses mycelium . aujourd’hui je constate qu'il y a un triangle placé devant le compte qui contient les bitcoins.

je traduit en anglais pour envoyer car je ne comprends pas l'anglais

Okay on my mycelium wallet (legacy wallet (P2PKH) I have bitcoins that I received by trading with my broker. and so in the balance part we can see the wallet, the bitcoin and the dollar amount and also the send and receive option. and when i click send i see: scan code, my addresses, clipboard which has currently disabled then manual input. i did manually entered to copy another bitcoin address it encountered invalid address or fio name. and when I click on my addresses this part is empty. because there are my accounts and the address book which is empty in my accounts there are only my mycelium addresses. today I see that there is a triangle placed in front of the account that contains the bitcoins.

6a8d7a commented 2 years ago

PLEASE MYCELIUM1 MYCELIUM2