Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export a watch wallet only (with descriptors and without private keys) for an air gap setup #24829

Closed
Tracachang opened this issue Apr 11, 2022 · 12 comments
Labels

Comments

@Tracachang
Copy link

Is your feature request related to a problem? Please describe.

For long time I've seen users looking for a way to do an air gap setup with Bitcoin Core, since there were no easy way people tend to go with other solutions such as armory, electrum which offers an easy and friendly way to do it.

Since Bitcoin Core v 22.0 and with the command listdescriptors it can be done easily:

OFFLINE PC - Create a wallet with descriptors=true, export descriptors with "listdescriptors".
ONLINE PC - Create a wallet without privatekeys, descriptors=true, and importdescriptors to have a functional watch only wallet for receiving funds and create unsigned transactions.

Describe the solution you'd like

Instead of creating two wallets, one offline and a watch only and manually have to export/import descriptors, the wallet containing the private keys could offer an option like "exportwatchonly" that would generate a "watch_wallet.dat" without private keys and all descriptors already imported. Making very easy and user friendly the process to create an air gap setup.

@pinheadmz
Copy link
Member

I don't understand how an "exportwatchonly" command is any more efficient or straight forward than listdescriptors -> importdescriptors ?

@Tracachang
Copy link
Author

I don't understand how an "exportwatchonly" command is any more efficient or straight forward than listdescriptors -> importdescriptors

I did not mean it would be more efficient but much more user friendly (as already exists in electrum for example) to have an option that creates a "watch_wallet.DAT" that they can just load instead of manually listdescriptors and import:

importdescriptors "[{\"desc\": \"wpkh([66bb13d5/84'/0'/0']xpub6CtDSW4S3XVd5uYp9CgsLTZKQcKieJSmjehcvfVJBSy1rPbkKNU3T6UmZ3mn7DoSsTsM6uH8ZKem7LQh3PHyrBAtZopSvF2tonEE7foTWFe/1/*)#a9twa6j5\", \"range\": [0, 1000], \"timestamp\": 1647182091, \"internal\": true, \"watchonly\": true, \"active\": true}]"

@pinheadmz
Copy link
Member

I was able to do what you want to do with a few bash commands (see below).

I suppose we could add arguments -file <path/to/file> to both listdescriptors and importdescriptors that would make this even easier...?

$ bccli -regtest createwallet original
{
  "name": "original",
  "warning": ""
}

$ bccli -regtest listdescriptors | jq .descriptors -c >> ~/Desktop/watchonly.json
$ bccli -regtest -named createwallet wallet_name=watchonly disable_private_keys=true
{
  "name": "watchonly",
  "warning": ""
}

$ bccli -regtest -rpcwallet=watchonly importdescriptors $(cat ~/Desktop/watchonly.json)
[
  {
    "success": true
  },
  {
    "success": true
  },
  {
    "success": true
  },
  {
    "success": true
  },
  {
    "success": true
  },
  {
    "success": true
  },
  {
    "success": true
  },
  {
    "success": true
  }
]

@Tracachang
Copy link
Author

Tracachang commented Mar 28, 2023

I was able to do what you want to do with a few bash commands (see below).

I suppose we could add arguments -file <path/to/file> to both listdescriptors and importdescriptors that would make this even easier...?

Yes please, that would be great.

@Tracachang
Copy link
Author

Tracachang commented Mar 29, 2023

@pinheadmz

I have followed all the steps using the bash commands from your previous answer and using the watch_wallet from the GUI, I am unable to create a receiving taproot address ( it shows both base58 legacy & p2sh-segwit and bech32 but not bech32m).
If I select the "original_wallet" it appears in the GUI all 4 types of address including bech32m.

In any case, from console I can getnewaddress "test" "bech32m" and it works for watch_wallet but for some reason not on GUI.

@pinheadmz
Copy link
Member

Hm, seems to work for me on master branch. The taproot addresses are identical from each wallet.

Screen Shot 2023-03-31 at 10 29 57 AM
Screen Shot 2023-03-31 at 10 29 42 AM

@Tracachang
Copy link
Author

Hm, seems to work for me on master branch. The taproot addresses are identical from each wallet.

Did not try the master branch, I am on v.24.0.1

@pinheadmz
Copy link
Member

Ok I just pulled v24.0.1 and repeated steps with CLI and GUI, same outcome -- are you still unable to do this?

@Tracachang
Copy link
Author

Ok I just pulled v24.0.1 and repeated steps with CLI and GUI, same outcome -- are you still unable to do this?

Just tried again following this commands and I am still unable to see taproot in GUI

$ bitcoin-cli createwallet original
{
  "name": "original",
  "warning": ""
}

$ bitcoin-cli -rpcwallet=original listdescriptors | jq .descriptors -c >> ~/Desktop/watchonly.json
$ bitcoin-cli -named createwallet wallet_name=watchonly disable_private_keys=true
{
  "name": "watchonly_original",
  "warning": ""
}

$ bitcoin-cli -rpcwallet=watchonly importdescriptors $(cat ~/Desktop/watchonly.json)
[
  {
    "success": true
  },
  {
    "success": true
  },
  {
    "success": true
  },
  {
    "success": true
  },
  {
    "success": true
  },
  {
    "success": true
  },
  {
    "success": true
  },
  {
    "success": true
  }
]


@pinheadmz
Copy link
Member

Just tried again following this commands and I am still unable to see taproot in GUI

at all? or just in the watch-only wallet?

@Tracachang
Copy link
Author

Just tried again following this commands and I am still unable to see taproot in GUI

at all? or just in the watch-only wallet?

Just on GUI with the watch-only wallet, but on console using watch-only I can create taproot receiving addresses.

@achow101 achow101 removed their assignment Apr 30, 2023
@pinheadmz
Copy link
Member

@Tracachang We're going to close this issue as "won't fix" for now. I'm going to follow up in #9492 where I see you've already chimed in. I think a simple doc outlining the list/import descriptor commands I commented above and using PSBT for signing would be the most valuable.

As far as the missing taproot addresses in the GUI you've reported - that could be opened as a new issue if you can provide steps to reproduce it with the latest release of Bitcoin Core or master branch (I was unable to reproduce personally)

@bitcoin bitcoin deleted a comment from Meru852 May 2, 2023
@bitcoin bitcoin locked and limited conversation to collaborators May 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants
@pinheadmz @achow101 @Tracachang and others