assuming I know in advance how much bitcoin a UTXO has
createrawtransaction in Bitcoin Core requires tx id
and vout
, if you know it and the address which will be used for output then transaction can be created offline.
Then I also need to sign that tx, also offline
Signing will require private key or a wallet with private key depending on which of these RPC commands you prefer to use: signrawtransactionwithwallet
or signrawtransactionwithkey
And finally I can pass the signed tx to someone via bluetooth, and then he can drive to an Internet connection, and broadcast the tx.
Sure. This is possible. I had even worked on a side project which can be used to send bitcoin with text messages (Internet not working but SMS works). You can even encode signed transaction hex in to words.
Related Q&A: Issues decoding the words to transaction hex
I'm pretty sure there isn't a wallet that does this, so this needs to be some special script or a sequence of cli commands
Cold storage (keeping private keys offline) is used by many people in which transaction signing is done offline. Transaction can be created on any device or wallet (online/offline) as long as you have information required to create transaction. For example: tx id
and vout
of UTXOs you are trying to spend.
RPC to create PSBT also requires same information. I am not sure about compatibility of different wallets so creating a transaction in one wallet and signing in other may have issues. However, I have tried creating a transaction and signing it in Electrum in this Q&A: Create unsigned tx (PSBT) in a watch-only wallet using bitcoin core, sign it in electrum and broadcast using bitcoin core
You can try one experiment:
Open Electrum Wallet. Copy one transaction id. Open it in explorer.
Disconnect Internet.
Open Bitcoin Core.
Create transaction with createrawtransaction
Convert to PSBT with converttopsbt
Copy the results and load transaction in Electrum Wallet. Sign it and copy the transaction hex.
Close all wallets. Open https://blockstream.info/tx/push in browser of any online machine.
Broadcast this transaction