sparrowwallet / sparrow

Desktop Bitcoin Wallet focused on security and privacy. Free and open source.
https://sparrowwallet.com/
Apache License 2.0
1.21k stars 173 forks source link

[Feature Request] Custom Account Index # #1446

Open InfiniteQE opened 1 week ago

InfiniteQE commented 1 week ago

Regarding Account Discovery, some time ago SparrowWallet added in the Settings tab Add Account (where a drop down box of the next 20 unused Accounts is listed).

My Request is to allow for any custom Account Index - I can understand why you wouldn't want newbies to have access to this feature - they might accidentally lose access to their Bitcoin at a random derivation path account index that they will never find again.

Nonetheless, The BIP48 (and probably all other HD BIPs) supports Account Indexes in the range of 0 - 2147483647 (= 2^31 -1).

My reason for wanting am Account Index larger than what Sparrow's 1-20 dropdown box allows, is for a Hidden Wallet, like using a Passphrase. For BIP48 Multisig, adding a Passphrase is not universal, and for example is not supported by Seedhammer.

Airgapped Signing Devices including Seedsigner, Coldcard Mk4 + Q, Passport and Jade support exporting of cosigner's XPUBs for a specified m/48'/0'/{Account_Index}'/2' but I would like to extend that to a much bigger Account Index

shuf --random-source='/dev/urandom' -n 1 -i 1-2000000000

I'll admit I have't tested any hardware signer with exporting a 10 digit Account Index XPUB, but this is standard compliant, and will serve a similar function as a Passphrase, without having the complexity of needing to record : All cosigner's mnemonic seeds, All cosigner's XPUBS/wallet descriptors for : no Passphrase, and with Passphrase(s). This method only requires the user to backup all mnemonic seeds and all XPUBs plus the unique Account Index which is part of the wallet descriptor backup.

This is a safer more bullet proof system of backup if the user wants to make a hidden multisig wallet, and had to choose between either Passphrase or Account Index to achieve it.

Update : Passport and Seedsigner can export a multisig Account Index of 2^31 -1 Jade can export a multisig Account Index of 65,535 Coldcard Q can export a multisig Account Index of 9,999

I initialized 5 airgapped hardware signing devices with 24 words mnemonic seeds, and created a 3-of-5 Multisig wallet in SparrowWallet m/48'/0'/0'/2' importing each hardware signer via QR code.

I was able to Add Accounts in Sparrow via the settings tab, 0-14.

Passport, Seedsigner, Jade and Coldcard Q could export Non-Zero Account xpubs, but Keystone 3 doesn't so it was necessary to load Keystone's mnemonic on Seedsigner as an ephemeral seed for xpub import.

I then tested an account index of 2,000,000,000

For this I added Passport and Seedsigner as Devices in Specter, loaded the Keystone 3, Jade and Coldcard Q mnemonics into Seedsigner as ephemeral seeds, and imported the remaining 3 mnemonics as signing devices into Specter, all airgapped.

Then Add Wallet to create 3-of-5 multisig wallet in Specter, with all 5 Cosigners as m/48'/0'/2000000000/2' then export fro Specter as JSON, and Open Wallet to import into SparrowWallet.

I was able to successfully import via QR code this multisig wallet's descriptor into all 5 hardware signing devices, then create a spend transaction in Sparrow from m/48'/0'/2000000000'/2', Read and Sign via QR code on all 5 devices, and Sparrow was able to import via camera all 5 signatures off their device screens.

I would very much like to cut out the Specter step for high Account Index multisig creation, as Sparrow enforces all cosigners having the same descriptor and account index, but Specter allows each cosigner to use a different descriptor.

Screenshot 2 Billion Screenshot 2 signatures Screenshot 3 signatures

craigraw commented 1 week ago

I would very much like to cut out the Specter step for high Account Index multisig creation, as Sparrow enforces all cosigners having the same account index

This is true for sub accounts, but not true for the first account. Given the use case is a hidden wallet, does it not make sense to simply create a new wallet?

As a side note, I suggest comparing the entropy of a simple number to that of a passphrase. A passphrase achieves much higher entropy over the same number of characters due to the much wider set of choices for each character.

InfiniteQE commented 6 days ago

Hi Craig,

It wasn't apparent to me that I could just enter any valid Derivation path when creating a new multisig wallet / importing cosigners. Indeed it looks to be possible already when creating a new wallet.

I did do the maths after my post and realized 2^31 is only equal to 3 words from the short EFF word list, so fewer bits of entropy that a recommended length passphrase. It did make me wonder however, assuming there are no hash collisions, why are there only 2.1 Billion possible hardened keys for each BIP32 level, it seems restrictive, but I guess that there would be many more than 2^31 possible XPRIVs

Is there any way to combine two SparrowWallet .db files , or to Export as JSON files (say Wallet 1 (Account 0,1,2,3,4) and Wallet 2 (Account 1,000-1,004)), combine the JSONs , and reimport into a single SwallowWallet .db ?

For Specter I needed to add Coldcard Q as "Other" as it disables QR camera (assumes it is a Coldcard Mk1-4 w/o camera). I edited Specter's JSON from "other" to "coldcard" prior to Open Wallet in Sparrow - the Coldcard Q is listed as a Connected wallet, whereas all others I modified from "other" (Jade) imported as Airgapped. Is there a way to import a Coldcard from JSON as Airgapped ?