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

Signing of P2SH transactions is not implemented except for P2SH Multisig #203

Open
bappelt opened this issue Dec 13, 2020 · 3 comments
Open
Labels

Comments

@bappelt
Copy link

bappelt commented Dec 13, 2020

The getSignatures() method on Transaction fails if the transaction being signed is a non-multisig P2SH transaction.

Expected Behavior

The transaction signature should be returned.

Current Behavior

The method throws Abstract Method Invocation: Trying to sign unsupported output type (only P2PKH and P2SH multisig inputs are supported) for input

Possible Solution

Steps to Reproduce (for bugs)

the following code attempts to sign a transaction spending from a trivial P2SH address with a locking script of

OP_5 OP_EQUAL <pubkey> OP_CHECKSIG

$ node
> const dashcore = require('@dashevo/dashcore-lib');
undefined
> tx = dashcore.Transaction('03000000018618449e1b1f090518ff2d2e7ec185af7688aca26b7c3a4a35db0c45117a05e30000000028005525558721032a90617b3d14645bb0db5acc83037ff4953ea7ecb2403430dd81375a2d69aeacacffffffff0118c69a3b000000001976a914efb38bcb860f3704cadab10947be89b7b24de70a88ac00000000')
<Transaction: 03000000018618449e1b1f090518ff2d2e7ec185af7688aca26b7c3a4a35db0c45117a05e30000000028005525558721032a90617b3d14645bb0db5acc83037ff4953ea7ecb2403430dd81375a2d69aeacacffffffff0118c69a3b000000001976a914efb38bcb860f3704cadab10947be89b7b24de70a88ac00000000>
> tx.getSignatures('cUstHm2KaHLXsqcVmq3eKkSs4258WCaHByvqMMmNVjrcFWCWWkCb')
Abstract Method Invocation: Trying to sign unsupported output type (only P2PKH and P2SH multisig inputs are supported) for input: {"prevTxId":"e3057a11450cdb354a3a7c6ba2ac8876af85c17e2e2dff1805091f1b9e441886","outputIndex":0,"sequenceNumber":4294967295,"script":"005525558721032a90617b3d14645bb0db5acc83037ff4953ea7ecb2403430dd81375a2d69aeacac","scriptString":"OP_0 OP_5 37 0x558721032a90617b3d14645bb0db5acc83037ff4953ea7ecb2403430dd81375a2d69aeacac"}
Error
   at Error.NodeError (dashcore-lib/lib/errors/index.js:23:41)
   at Input.getSignatures (dashcore-lib/lib/transaction/input/input.js:188:9)
   at forEachInput (dashcore-lib/lib/transaction/transaction.js:1168:18)
   at arrayEach (lodash/lodash.js:516:11)
   at Function.forEach (lodash/lodash.js:9368:14)
   at Transaction.getSignatures (dashcore-lib/lib/transaction/transaction.js:1167:5)
  > 

Context

P2SH transactions are needed to implement more sophisticated transactions like atomic swaps

Your Environment

  • Version used: 0.18.15
@bappelt bappelt added the bug label Dec 13, 2020
@Alex-Werner
Copy link

Hello @bappelt,

Thank you for raising this issue.
This has been added to our backlog and will be dealt with as soon as possible !

@SamKirby22
Copy link

Agreed on triage to process as a P3.

@dashameter
Copy link

retest failed, the above example still throws on @dashevo/[email protected]:

tx.getSignatures('cUstHm2KaHLXsqcVmq3eKkSs4258WCaHByvqMMmNVjrcFWCWWkCb')
Abstract Method Invocation: Trying to sign unsupported output type (only P2PKH and P2SH multisig inputs are supported) for input: {"prevTxId":"e3057a11450cdb354a3a7c6ba2ac8876af85c17e2e2dff1805091f1b9e441886","outputIndex":0,"sequenceNumber":4294967295,"script":"005525558721032a90617b3d14645bb0db5acc83037ff4953ea7ecb2403430dd81375a2d69aeacac","scriptString":"OP_0 OP_5 37 0x558721032a90617b3d14645bb0db5acc83037ff4953ea7ecb2403430dd81375a2d69aeacac"}

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

No branches or pull requests

4 participants