2

I have stored my bitcoins on Bitcoin Core in a few P2PKH addresses with many UTXOs. I would like to have a plan, how these bitcoins can be moved air-gapped to a more up-to-date setup (not discussed here).

I have not touched this computer (OFFLINE) for many years and I am afraid to connect it to the internet.

I assume that I need to have access to the lastest UTXO set and then create air-gapped transactions. But how exactly can this be done?

Is it possible to setup a Bitcoin Core on another online computer (ONLINE) and import the addresses using "importaddress"?
Is it (and how) possible to create an unsigned transaction on this ONLINE computer including all UTXOs of one of the imported (watch-only) addresses?
And then move this unsigned transaction to the old offline computer (OFFLINE) with the old wallet.dat file and sign the transaction?

Is this possible or is there another way to do this air-gapped?

Has anyone documented all the necessary steps?

Thanks for your help!

-A frightened hodler

13
  • You can create a raw transaction, sign it and get the hex value offline bitcoin.stackexchange.com/questions/69842/… Next you can broadcast it using other node on another machine which is online.
    – Prayank
    Aug 26 '20 at 17:10
  • Thank you. But manually creating a transaction with many inputs seems too error-prone to me. Is this possible using the GUI?
    – hodddl
    Aug 26 '20 at 18:40
  • Maybe you can create a watch-only wallet i.imgur.com/IFrWWGc.png on another machine to create unsigned transaction which spends the UTXOs. Sign this tx on machine which has offline wallet with private keys and broadcast it later from other machine. Last two things may need console.
    – Prayank
    Aug 26 '20 at 20:46
  • 1
    I have asked one question related to this issue: bitcoin.stackexchange.com/questions/99046/…
    – Prayank
    Sep 16 '20 at 7:17
  • 1
    bitcoin.stackexchange.com/a/99112
    – Prayank
    Sep 19 '20 at 8:45
2

Update Aug 1, 2021: this answer covers Bitcoin Core <= 0.20.1. For Bitcoin Core >= 0.21.0 using the GUI-integration for PSBTs check the second answer.

Yes, it's possible using descriptors and PSBTs.

How to spend/sweep p2pkh UTXOs air-gapped using Bitcoin Core's GUI and PSBTs.

Here are the required steps, most of them have to be entered into Bitcoin Core's console.

OFFLINE

  • export the descriptor of the p2pkh address:

     getaddressinfo ADDRESS

  • copy the "desc": "pkh([....", output to the ONLINE computer

ONLINE

  • optional: create a new wallet in Bitcoin Core
  • import the descriptor from above into Bitcoin Core:
     importmulti '[{ "desc": "pkh([....", "timestamp":0, "label":"import", "watchonly":true }]'
  • optional: check that the following is now "solvable":
     getaddressinfo ADDRESS
  • now create the unsigned PSBT using Bitcoin Core's GUI
  • copy the unsigned PSBT (YOUR-PSBT) to the OFFLINE computer

OFFLINE

  • if needed unlock your wallet
    walletpassphrase "YOUR_WALLET-PASSWORD" 600
  • optional: check the PSBT
     decodepsbt YOUR-PSBT
    and
     analyzepsbt YOUR-PSBT
  • sign your PSBT:
    walletprocesspsbt YOUR-PSBT
  • finalize your PSBT:
    finalizepsbt OUTPUT-FROM-WALLETPROCESSPSBT-ABOVE
  • copy the hex output from above to your ONLINE computer

ONLINE

  • send the raw transaction using
    sendrawtransaction HEX-FROM-ABOVE
  • optional: copy the raw transaction into an block explorer like blockstream.info instead

Done!

Feedback is welcome!

3
  • Hi hodddl, am i understanding correctly that the difference between your two answers is that one is CLI-based and the other GUI-based? I think it might make sense to combine them both in one answer where give both variants for the offline step, as the two answers do not look obviously different to a skimming reader in the first place.
    – Murch
    Jul 15 at 21:43
  • Hi Murch, thank you for your feedback. The first answer covers Bitcoin Core <= 0.20.1 and required a lot of CLI commands. The second answer is an update covering Bitcoin Core >= 0.21.0 using the GUI-integration for PSBTs.
    – hodddl
    Jul 28 at 13:21
  • Maybe you could add a little pointer at the top of this answer in which case people should read the other answer instead. :)
    – Murch
    Jul 28 at 17:16
1

Yes, it's even easier using Bitcoin Core 0.21.0, descriptors and PSBTs.

How to spend/sweep p2pkh UTXOs air-gapped using Bitcoin Core's 0.21.0 GUI and PSBTs.

Here are the required steps, many of them have to be entered into Bitcoin Core's console.

OFFLINE (best to use a laptop booted from a Ubuntu USB-stick and no internet connected)

  • export the descriptor of the p2pkh address:

     getaddressinfo ADDRESS

  • copy the "desc": "pkh([....", output to the ONLINE computer

ONLINE

  • optional: create a new wallet in Bitcoin Core
  • import the descriptor from above into Bitcoin Core:
     importmulti '[{ "desc": "pkh([....", "timestamp":0, "label":"import", "watchonly":true }]'
  • optional: check that the following is now "solvable":
     getaddressinfo ADDRESS
  • now create the unsigned PSBT using Bitcoin Core's GUI: "Send", "Create Unsigned", "Create Unsigned" and "Save"
  • copy the file containing the unsigned PSBT to the OFFLINE computer

OFFLINE

  • if needed unlock your wallet
    walletpassphrase "YOUR_WALLET-PASSWORD" 600
  • now import the file from above and sign the unsigned PSBT using Bitcoin Core's GUI: "File->Load PSBT from file"
  • double check the transaction and "Sign Tx"
  • then select "Copy to Clipboard"
  • copy this hex output (now in your Clipboard) from above to your ONLINE computer

ONLINE

  • send the raw transaction using
    sendrawtransaction HEX-FROM-ABOVE
  • optional: copy the raw transaction into an block explorer like blockstream.info instead

Done!

Feedback is welcome!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.