Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how can I sign it using bitcoin-php version 1.0? #835

Open
afk11 opened this issue Feb 20, 2020 · 4 comments
Open

how can I sign it using bitcoin-php version 1.0? #835

afk11 opened this issue Feb 20, 2020 · 4 comments

Comments

@afk11
Copy link
Member

afk11 commented Feb 20, 2020

Having the raw transaction (non-signed), how can I sign it using bitcoin-php version 1.0?

Originally posted by @Gwinest in #166 (comment)

@afk11
Copy link
Member Author

afk11 commented Feb 20, 2020

Decode a transaction
https://github.com/Bit-Wasp/bitcoin-php/blob/1.0/examples/doc/tx/005_create_tx_from_hex.php
Sign a P2SH multisig transaction. There are examples of other address types. Just delete the part that builds the spend transaction, and call TransactionFactory::fromHex instead.
https://github.com/Bit-Wasp/bitcoin-php/blob/1.0/examples/tx.spend.p2sh.multisig.php

@Gwinest
Copy link

Gwinest commented Feb 20, 2020

It still does not work, I'm using the following scripts from the examples folder:
transactionBuilder.php
tx.sighash.single.bug.php

I'm uniting both of them to build the Transaction and sign in.

But it gives me an error: Uncaught BitWasp\Bitcoin\Exceptions\ScriptQualificationError: Invalid script signature - must be PUSHONLY.

@afk11
Copy link
Member Author

afk11 commented Feb 20, 2020

Unfortunately I can't debug your code without seeing it. Based on the error, you probably put the redeem or output script in the scriptSig instead of pushing it..

@Gwinest
Copy link

Gwinest commented Feb 22, 2020

Your assumption was correct, indeed. It worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants