bitcoin core – What’s the distinction between signrawtransactionwithwallet vs signrawtransactionwithkey in signing unsigned uncooked transaction?

0
41


signrawtransactionwithwallet is used to signal transactions on your pockets in which you’ll keep away from coming into non-public keys for spending totally different UTXOs because the non-public keys are in your pockets. You could have to enter passphrase utilizing walletpassphrase

signrawtransactionwithkey is used to signal transactions for spending any UTXO utilizing non-public keys

Examples:

  1. I create a transaction for spending UTXO related to deal with tb1qlqyjzjuxel0r80gs97uf5snh0a0kesmjyxxzey that belongs to my pockets
createrawtransaction "[{"txid":"a1a564ae1983e1a87e731c4b9b205f3e8edbd724bb03d4474090f32ccd8f55a0","vout":0}]" "[{"tb1qlu4kjktgcdru8cjnlx47me2ha4phxgceg2v4mj":0.01}]" 0 true

Signal the transaction utilizing signrawtransactionwithwallet with out coming into any non-public key

signrawtransactionwithwallet 0200000001a0558fcd2cf3904047d403bb24d7db8e3e5f209b4b1c737ea8e18319ae64a5a10000000000fdffffff0140420f0000000000160014ff2b695968c347c3e253f9abede557ed4373231900000000

Or I may signal the identical transaction utilizing non-public key for tb1qlqyjzjuxel0r80gs97uf5snh0a0kesmjyxxzey

dumpprivkey tb1qlqyjzjuxel0r80gs97uf5snh0a0kesmjyxxzey
signrawtransactionwithkey "0200000001a0558fcd2cf3904047d403bb24d7db8e3e5f209b4b1c737ea8e18319ae64a5a10000000000fdffffff0140420f0000000000160014ff2b695968c347c3e253f9abede557ed4373231900000000" "["cT29Pb7V9kxCp6VRfwNNips8T9beVV6AkJDJ9PZcn1RSx3pCnfCd"]"
  1. I create a transaction in Bitcoin Core for spending UTXO that belongs to my pockets in Electrum and personal key for it’s in Electrum.

createrawtransaction "[{"txid":"542646583f5bd9b8424832d84ccfd23148f1e19b1b75cf3945bc8693d2dcb82e","vout":2}]" "[{"tb1qlu4kjktgcdru8cjnlx47me2ha4phxgceg2v4mj":0.022}]" 0 true

I copy its non-public key from Electrum.

private-key-electrum

Signal transaction in Bitcoin Core utilizing signrawtransactionwithkey:

signrawtransactionwithkey "02000000012eb8dcd29386bc4539cf751b9be1f14831d2cf4cd8324842b8d95b3f584626540200000000fdffffff01c091210000000000160014ff2b695968c347c3e253f9abede557ed4373231900000000" "["cSBRq5UwGRZdKwLh6XGf3XFkYDvLdz6WwMxmtTdTvrNyw76mHHAV"]"



Supply hyperlink

Leave a reply