0

Should PSBT finalizers/extractors and deserialization functions enforce the rule that a taproot schnorr signature should only append a SIGHASH_* unless it is SIGHASH_DEFAULT (0), or is it left to the implementer's discretion?

Ref: https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki#cite_note-21

4
  • Are you asking whether the finalizer should append a sighash byte for SIGHASH_DEFAULT signatures? Well, no, since it would make it invalid? Commented Nov 17, 2023 at 12:56
  • No, i am asking this - should a finalizer check the signature (PSBT_IN_TAP_KEY_SIG/PSBT_IN_TAP_SCRIPT_SIG) and remove SIGHASH_DEFAULT and if it exist and then use the 64 byte signature? Or throw error?
    – solar
    Commented Nov 17, 2023 at 13:14
  • Currently, bitcoinjs-lib finalizer blindly adds the 65 byte signature to the witness even if the sighash is SIGHASH_DEFAULT.
    – solar
    Commented Nov 17, 2023 at 13:27
  • I believe the extractor role should check the validity of the transaction it produces, therefore it should explicitly error. Let me post a proper answer. Commented Nov 17, 2023 at 14:10

1 Answer 1

1

This boils down to how to treat invalid signatures provided in a PSBT. I believe there is some room for implementation-defined behaviour with regard to the finalizer role. For instance if it can get around the invalid signatures by satisfying another spending path.

However the specification for the extractor role is pretty clear:

The Extractor should produce a fully valid, network serialized transaction if all inputs are complete.

Since the input finalizer and transaction extractor roles are often combined, and since explicit is better than implicit, i believe it would make sense to explicitly raise an error on an invalid signature. But nothing prescribes it in the specification itself.

1
  • Spec is not clear. But the case you made makes sense. Thanks.
    – solar
    Commented Nov 17, 2023 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.