Bitcoin Forum
May 08, 2024, 03:20:49 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Problem witch signrawtransaction witch 0 vout  (Read 4264 times)
svirus (OP)
Member
**
Offline Offline

Activity: 72
Merit: 10


View Profile WWW
April 21, 2013, 10:48:14 AM
Last edit: April 22, 2013, 04:46:30 PM by svirus
 #1

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,

1715138449
Hero Member
*
Offline Offline

Posts: 1715138449

View Profile Personal Message (Offline)

Ignore
1715138449
Reply with quote  #2

1715138449
Report to moderator
1715138449
Hero Member
*
Offline Offline

Posts: 1715138449

View Profile Personal Message (Offline)

Ignore
1715138449
Reply with quote  #2

1715138449
Report to moderator
In order to achieve higher forum ranks, you need both activity points and merit points.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715138449
Hero Member
*
Offline Offline

Posts: 1715138449

View Profile Personal Message (Offline)

Ignore
1715138449
Reply with quote  #2

1715138449
Report to moderator
dansmith
Full Member
***
Offline Offline

Activity: 202
Merit: 100


View Profile
June 04, 2013, 10:11:53 AM
 #2

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

https://tlsnotary.org
Transferable webpage content notarization.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!