Open merlinkory opened 5 years ago
Hi, I took a look through your code (thanks for providing it), and can see the following causing problems:
$transaction->input($cur->txid, 0);
Should $cur->vout or something not be passed instead of 0?
$txOut = new TransactionOutput($unspent_sum, $program);
You need to store each $txOut as you loop through $unspents and add each as an input. Then when signing, pass the $txOut used to create the input. Add something like this to the unspents loop:
$txOuts[] = new TransactionOutput($cur->amount*1e8, $program);
and in the signing loop:
$signer->sign($key, $privateKey, $txOuts[$key]);
Hi! I using your library for creating and sign transaction. Now i working in regtest.
After i getting sign transaction i call "sendRowTransaction" on my node (regtest) and getting following error:
error code: -26 error message: mandatory-script-verify-flag-failed (Script evaluated without error but finished with a false/empty top stack element) (code 16)
This is sign transaction: "010000000101f61949c298a20c4a48f8e10da46221f7affda36d49892bfd5243c08a423526000000006b4830450221008407b2aca363ec6e552c2ca9f2ec9850a033946d88291ce2b9c62b40f9546daf022038b43bebc31dc8a6b921b4fa1b13227f47e05abced9b84f1dd7094ddfb84551a01210385379e41c714555988b4130a78ea9b617b0a150a5fef1ca30a14897ed5ceae2affffffff02802fa6040000000017a9146df977bd55c76c917dd49867ff21b57ba0097edc8760e401000000000017a9147f21fb14fd212302036c5b09ec304f820242c2b68700000000"
Code below: