How can I construct a transaction using a watch only wallet RPC and cold sign using any nodejs library? In the end, I have to send this to the blockchain using the daemon or watch only wallet RPC.
1 Answer
Using the wallet RPC on your view only (hot) wallet, you can call transfer with get_tx_metadata: true
and do_not_relay: true
which will yield an unsigned_txset
in the response.
Then on the spend wallet RPC (your cold wallet), call sign_transfer, passing in the unsigned_txset
from above, which will yield a signed_txset
in the response.
Back on the view only (hot) wallet RPC, call submit_transfer, passing the data from signed_txset
above in the tx_data_hex
parameter.
The linked methods all have examples of these steps using curl. The calls are just simple HTTP POST requests, so libraries are not really needed.
-
It's not solve my problem. I can't use cold wallet in my solution, I want to sign transaction in my nodejs application. In other words, the private spend key should not leave my code.– intosKaiNov 7, 2019 at 6:06
-