Bitcoin Forum
February 24, 2018, 04:31:14 AM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Problem witch signrawtransaction witch 0 vout  (Read 4164 times)
svirus
Member
**
Offline Offline

Activity: 71
Merit: 10


View Profile WWW
April 21, 2013, 10:48:14 AM
 #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,

1519446674
Hero Member
*
Offline Offline

Posts: 1519446674

View Profile Personal Message (Offline)

Ignore
1519446674
Reply with quote  #2

1519446674
Report to moderator
Automated Bitcoin Fork Extraction Tool WE DO TOUGH WALLETS: BCH | BTG | BCD | SBTC | UBTC | B2X | BCX | BTF Electrum 2FA, Trezor, Ledger, SegWit, Bech32
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1519446674
Hero Member
*
Offline Offline

Posts: 1519446674

View Profile Personal Message (Offline)

Ignore
1519446674
Reply with quote  #2

1519446674
Report to moderator
1519446674
Hero Member
*
Offline Offline

Posts: 1519446674

View Profile Personal Message (Offline)

Ignore
1519446674
Reply with quote  #2

1519446674
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:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!