Author

Topic: Problem witch signrawtransaction witch 0 vout (Read 4280 times)

full member
Activity: 202
Merit: 100
I bumped into the same error message, and couldn't find any explanation for it online:

Code:
Previous output scriptPubKey mismatch:
OP_DUP OP_HASH160 efe62d2ff703262ebbadaa9882fb7eb865bf2f4e OP_EQUALVERIFY OP_CHECKSIG
vs:
OP_DUP OP_HASH160 f2fa7f568b0cf04d669814198301bca0898bf190 OP_EQUALVERIFY OP_CHECKSIG (code -22)

Can anyone break down what is happening here?

EDIT:
P.S. wrt the title. Yes, signrawtransaction is a one heck of a witch Smiley
member
Activity: 72
Merit: 10
Hi,

I try to make my own script to sendtransaction witch privatekey stored in database.
And everything works but only when txid from input have 0 vout can't be signed.

Code:
$rawtx = "0100000001165d7df25be4cb748cff930a91b183715f741ded0d84200bb2a7d3f28c8f9ff70000000000ffffffff01a0860100000000001976a9148b0e8744269d5fd88d0fe28558fb73ffc0a0a3ef88ac00000000"
$tx_info = $bitcoin->decoderawtransaction($rawtx);
$scriptPubKey= $tx_info['vout'][0]['scriptPubKey']['hex'];
$txid = 'f79f8f8cf2d3a7b20b20840ded1d745f7183b1910a93ff8c74cbe45bf27d5d16';
$to_sign = array();
$to_sign[] = array(
        "txid" => $txid,
        "vout" => (int) 0,
        "scriptPubKey" => $scriptPubKey
        );
include('jsonrpc.php');
$a = rpcQuery('signrawtransaction',array($raw_tx,$to_sign,array('5Jd1E6a49qasdff8oZ8Gurnc8AxfwfUfuzkN2iGaJv6G1neCM')));
var_export($a); exit;

RETURN:
array (
  'r' => NULL,
  'e' =>
  stdClass::__set_state(array(
     'code' => -22,
     'message' => 'Previous output scriptPubKey mismatch:
OP_DUP OP_HASH160 d2abdc1db61a38b33bc429c97c4b8000046aa475 OP_EQUALVERIFY OP_CHECKSIG
vs:
OP_DUP OP_HASH160 8b0e8744269d5fd88d0fe28558fb73ffc0a0a3ef OP_EQUALVERIFY OP_CHECKSIG',
  )),

If input tx have more than 1 vout everythink works fine:
Code:
array (
  'hex' => '01000000018cd23d6f.......c00000000',
  'complete' => true,
Jump to: