Open ghost opened 5 years ago
Hey, thanks for the issue. at a glace the code looks good. there's some weird quirks in coinbin (if a p2sh tx is completely unsigned, you need to use the redeemScript AS the input.script, not a script that contains the redeemscript as a data push.. just a heads up, you might need to work around this if signing w/ coinbase first)
- Is my input correct? If not, how to calculate input for the both public keys (adresses)?
I'm not totally sure what you're asking here. The code looks fine - and if you had both privkeys sign in the script, this line would echo 'true'
echo "input valid? " . ($input->verify() ? "true" : "false") . PHP_EOL;
2. How to perform the check on a string as signed transaction, providing both public keys?
You mean verifying each input in the transaction? parse the hex tx, then your app needs to find the scriptPubKey,value for each (txid,vout) being signed. then use the signer to loop over inputs and call verify() as above.
First of all, great library!
I tried above example, but when verifying it with coinb.in the script of the input seems to be empty, it is not marked as signed and not marked as a multisig transaction. From my understanding the transaction should have one signature, right?
01000000000101a14e1eade25cba0cc1a6070178dc17f35ff6f9e33f8df517982e139d63b7f7870000000000ffffffff0260e31600000000001976a9145ac42bde10756fd9fdd9fde7d9989512a9598a1b88ac235fbc0000000000220020f4e644e3b5eae483c8ffa3106547e23f252d3a3d31cea1f3b89f9cf64790e9e1030047304402206653b56fce19e8e575bf727fffc06433960a3b622234cb388ea1dfe3093278a4022053d68bde2e9ae74f2e6d135b69706a0f17abcc8a6ffcad0f7ba08a9e0ea0e8d201475221020a48636b5df07a3f8fbcb9c3d0af1dbe2c6c8250dd7a66c006c44d106acc0a7221038044e721ea7b8bad6d50009d12717f9b2f49479e09a08cde78d0eee8d473450c52ae00000000
Is this related to your comment above using the redeemScript as input script?
Would this look like this?
$transaction = TransactionFactory::build()
->input('87f7b7639d132e9817f58d3fe3f9f65ff317dc780107a6c10cba5ce2ad1e4ea1', 0, $witnessScript->getOutputScript()
If it should, this has no influence on the output transaction or the problem above.
Thanks for your help.
Hi @U77bna - I think that was the trick, for P2SH anyway (not sure about P2WSH). Sorry I don't have any more info - it's been years since I've used it for anything
I'm trying to sign a 2:2 multisig transaction using this library. I've used this example to create the process of signing.
For my current script the process of signing should be like this:
My code at the moment:
Questions: