If i remember correctly (my node was shut down a long, long time ago), i just used to create the raw transaction on the watch-only (online) wallet, then transferred the raw (unsigned) transaction to the offline machine to sign it, and then transfer the signed transaction back to the online machine... IIRC, that way you didn't have to transfer any other data between your online machine and your airgapped one.
I know that doesn't 100% cover your question, but i just wondered if you might have been overthinking
... It's easyer to create the unsigned tx on your online machine, transfer this unsigned tx to the offline machine for signing, and back to the online machine for broadcasting than it is to synchronise an offline node.
I switched to a hardware wallet, and that's basically what happens with a HW wallet aswell: your watch only desktop wallet creates an unsigned tx, transfers it to your HW for signing (which doesn't have a clue about the utxo set, it just receives the unsigned tx), and then the signed tx goes from the HW wallet to the desktop wallet for broadcasting.
EDIT: if you're afraid you made an error when selecting inputs and calculating the fee, you can decode the raw unsigned transaction, either by using the cli, or by using the (offline, for your privacy) version of coinb.in (for example). That way, you can verify what you're signing, and you can make sure you didn't mess up the fee calculation before signing...
Thanks for your help!
You are right - we can create a raw transaction on the watch-only (online) wallet. By doing so, we avoid the first step on the offline pc: copying the node data.
The idea is not to have the .dat file on an online PC, for security reasons.
About the hardware wallets: I don't trust on them. It runs a specific firmware that we have no control.
But anyway ... I see your point. Anyone can do what they want and take the risks.
Just create a cold-storage setup that the new "
descriptor wallet" can do.
Follow this instructions:
Bitcoin core create a watch only wallet and sign transactions offline [Tutorial]In the steps to export and import the descriptor(
s), you may import all instead of just the selected script type if you want to be able to generate all four address types.
Or are you trying this on an existing non-descriptor wallet?
If so, you can create a "
blank" and "
disable_private_key" wallet in the online PC and import the necessary address(
es) as descriptors. (
descriptors.md)
Then you can do the provided steps of creating the PSBT in the online machine to be signed in the offline machine.
Let me take a look at this. I will return if I have any questions. It's interesting.
But I read in that topic that "Your online PC must have bitcoin core installed and synched", so we cannot avoid having a synched node? (2nd question I posted here). Or maybe we can use a public node to broadcast the Tx... ? The idea is to find the easiest and fastest way. Let me take a deep look.
Creating a watch-only wallet on the online pc and import descriptions isn't insecure right ? I'm just importing 2 descriptors, it's not like my entire .dat file I suppose ...
The idea is not to have the .dat file on an online PC, for security reasons.
What kind of user errors are you looking to prevent by having Bitcoin Core select the UTXOs instead of you?
Basically these are the parameters to create a raw tx:
./bitcoin-cli -regtest createrawtransaction '''[ { "txid": "'$utxo_txid'", "vout": '$utxo_vout' } ]''' '''{ "'$recipient'":$rcp }'''
$utxo_txid and $utxo_vout are values that you have to manually select using the cmd listunspent.
This is how it works:
https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line/blob/master/04_4_Sending_Coins_with_a_Raw_Transaction.mdRead at the end of the doc:
The disadvantages. It's easy to lose money. There are no warnings, no safeguards, and no programmatic backstops unless you write them. It's also arcane. The formatting is obnoxious, even using the easy-to-use bitcoin-cli interface, and you have to do a lot of lookup and calculation by hand.
The task is easy when you only use 1 full UTXO. But things get more complicated when you have to use more than 1, do some calculations, etc.
So... what I'm looking for is to forget about this. Let BitcoinCore do it for me, why don't we have a "magic" command to calculate this automatically? In other clients like the Kaspa client (other coin that uses UTXO format), it's automatic. Why didn't bitcoin core do this? It is a great intrigue that I have. Or maybe there is something that I still don't know.
EDIT: I see this command fundrawtransaction ...
https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line/blob/master/04_5_Sending_Coins_with_Automated_Raw_Transactions.md maybe this is the "automatic" thing that i was looking for. Lol.