Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: RainHawk on May 13, 2014, 08:17:36 PM



Title: bitcoind signrawtransaction returning unsigned raw transaction
Post by: RainHawk on May 13, 2014, 08:17:36 PM
Using bitcoind on testnet I am trying to create a transaction and sign it.  When I sign the transaction, the signrawtransaction seems to return the unsigned raw transaction and I'm not sure why.

Here is the address I'm using:
Code:
private key - 90899252286880548862320809518235591512906351863862101558028130803471982419619 (WIF:937RZBkjaoM8yuMs5gjtuoZ14NPGzijnVQ74P6uxjv3TBgVbGxa)
public Key: 03f59d354ba386bdcd2315cde644061fd35c7601a80c6ffc8e4ed1886379844236
address: mt8qmeN1jH4wa1iBiAC2XkhKwrkjeAUSwE

Here is the output I'm trying to spend:
Code:
txid: fb34043cec50a7a51a556af34930de629b9e858c4e9edf6a8dd7bad9b540cb2a
vout: 0

I'm trying to send coin to 2NDhQpDsKnH27Awfew32mUPBkvM15zzFfzW (And the remainder should go back to my original address)

create raw transaction:
Code:
createrawtransaction '[{"txid":"fb34043cec50a7a51a556af34930de629b9e858c4e9edf6a8dd7bad9b540cb2a","vout":0}]' '{"mt8qmeN1jH4wa1iBiAC2XkhKwrkjeAUSwE":0.10000000,"2NDhQpDsKnH27Awfew32mUPBkvM15zzFfzW":1.00000000}'

result from bitcoind:
01000000012acb40b5d9bad78d6adf9e4e8c859e9b62de3049f36a551aa5a750ec3c0434fb0000000000ffffffff0280969800000000001976a9148a6b09aed1185103e52c3127a136f87905bc387d88ac00e1f5050000000017a914e0565e434447cf9a45aea855454b49dabd306d808700000000
sign raw transaction:
Code:
signrawtransaction "01000000012acb40b5d9bad78d6adf9e4e8c859e9b62de3049f36a551aa5a750ec3c0434fb0000000000ffffffff0280969800000000001976a9148a6b09aed1185103e52c3127a136f87905bc387d88ac00e1f5050000000017a914e0565e434447cf9a45aea855454b49dabd306d808700000000" '[{"txid":"fb34043cec50a7a51a556af34930de629b9e858c4e9edf6a8dd7bad9b540cb2a","vout":0,"scriptPubKey":"76a9148a6b09aed1185103e52c3127a136f87905bc387d88ac"}]' '["937RZBkjaoM8yuMs5gjtuoZ14NPGzijnVQ74P6uxjv3TBgVbGxa"]' "ALL"

result from bitcoind
{
"hex" : "01000000012acb40b5d9bad78d6adf9e4e8c859e9b62de3049f36a551aa5a750ec3c0434fb0000000000ffffffff0280969800000000001976a9148a6b09aed1185103e52c3127a136f87905bc387d88ac00e1f5050000000017a914e0565e434447cf9a45aea855454b49dabd306d808700000000",
"complete" : false
}

Any ideas about where I went wrong that the signed transaction appears unsigned and complete is marked false?


Title: Re: bitcoind signrawtransaction returning unsigned raw transaction
Post by: fbueller on May 13, 2014, 10:47:55 PM
If the private key is already in your wallet just leave it out. You can leave out ALL too unless for some specific reason you need to use it.


Title: Re: bitcoind signrawtransaction returning unsigned raw transaction
Post by: RainHawk on May 14, 2014, 11:39:32 AM
I would like to create and sign the transaction without putting the private key into bitcoind, thank you though.


Title: Re: bitcoind signrawtransaction returning unsigned raw transaction
Post by: RainHawk on May 14, 2014, 05:59:39 PM
I tracked down what my mistake was, the wallet import format key I was using was incorrect.

The steps listed at https://en.bitcoin.it/wiki/Wallet_import_format don't mention that the WIF changes based on if you intend to use the compressed or uncompressed public key to create the address.  Before getting the checksum I needed to add the byte 0x01 to the end of the versioned private key.

https://en.bitcoin.it/wiki/List_of_address_prefixes tricked me a bit too since it says that testnet private keys should start with a 9 ( compressed private keys should start with a c it looks like).