Post
Topic
Board Development & Technical Discussion
Re: Cold signing a transaction using bitcoin-qt
by
DannyHamilton
on 14/06/2014, 15:53:08 UTC
What have I done wrong?

From a hot wallet, I start off by executing listunspent
listunspent
[
{
"txid" : "3d01e3b94195808a866bd75cd5a9a3d1d6ee0385fdd20025aacb4215bb9117e2",
"vout" : 1,
"address" : "moDNytfZa69vc2Hz1ELjPaSJ2DheWiCjT6",
"scriptPubKey" : "76a914546e2062ba7c72e2e2589e5ad89a4cbc35b595eb88ac",
"amount" : 0.57974817,
"confirmations" : 223
}
]

So basically I want to send to a hot wallet public key (mvDLEEymmEijZXyrrNRL3aPMhH8q2m8vE1) from cold wallet public key (mvNAGP5nNef6MHfB6Tcu426MJboBqrwJZV).


You are mistaken.  That unspent output was received at moDNytfZa69vc2Hz1ELjPaSJ2DheWiCjT6 (not at mvNAGP5nNef6MHfB6Tcu426MJboBqrwJZV).  See where it says "address" in the output?

The cold wallet only has 0.57 - 0.0001 fee = send 0.5699, which means the cold wallet will be empty if the transaction is successful, so no change address needed I guess?

You are mistaken.  The output is 0.57974817 BTC.  If you send 0.57 and include a 0.0001 fee, then there will be 0.00964817 BTC change.  If you do not send this change to an address, then the fee will be 0.00974817 BTC.

Therefore, I run the following from the hot wallet:
createrawtransaction '[{"txid":"3d01e3b94195808a866bd75cd5a9a3d1d6ee0385fdd20025aacb4215bb9117e2","vout":1}]' '{"mvDLEEymmEijZXyrrNRL3aPMhH8q2m8vE1":0.5699
}'

Which in-turn returned the following value. 0100000001e21791bb1542cbaa2500d2fd8503eed6d1a3a9d55cd76b868a809541b9e3013d01000 00000ffffffff0130996503000000001976a914a134b5919d09350f6232260ed1313f73ac6b7bae 88ac00000000

So that seemed to work.

Then from the cold wallet, I get the private key:
dumpprivkey mvNAGP5nNef6MHfB6Tcu426MJboBqrwJZV

Wrong private key.  You needed to run:

Code:
dumpprivkey moDNytfZa69vc2Hz1ELjPaSJ2DheWiCjT6

And I try to sign the transaction from the cold wallet
signrawtransaction '0100000001e21791bb1542cbaa2500d2fd8503eed6d1a3a9d55cd76b868a809541b9e3013d01000 00000ffffffff0130996503000000001976a914a134b5919d09350f6232260ed1313f73ac6b7bae 88ac00000000'  '[{"txid" : "3d01e3b94195808a866bd75cd5a9a3d1d6ee0385fdd20025aacb4215bb9117e2","vout" : 1,"scriptPubKey" : "76a914546e2062ba7c72e2e2589e5ad89a4cbc35b595eb88ac"}]' '["mvNAGP5nNef6MHfB6Tcu426MJboBqrwJZV's private key here"]'

but it returns:
{
"hex" : "0100000001e21791bb1542cbaa2500d2fd8503eed6d1a3a9d55cd76b868a809541b9e3013d01000 00000ffffffff0130996503000000001976a914a134b5919d09350f6232260ed1313f73ac6b7bae 88ac00000000",
"complete" : false
}

What am I doing wrong?

You're using the wrong private key.