I have an signing implementation that already works for SIGHASH_ALL, and I'm trying to also support SIGHASH_SINGLE|SIGHASH_ANYONECANPAY.

I'm referencing https://en.bitcoin.it/wiki/OP_CHECKSIG for the behaviors of different SIGHASH types. From my reading, I assumed that there should be no difference between SIGHASH_ALL and SIGHASH_SINGLE|SIGHASH_ANYONECANPAY (aside from the hashtype appended to the end of the transaction being hashed) if the transaction involved only has one input and one output, but from my testing using other tools this does not seem to be the case.

Am I wrong with my interpretation? What modifications would the signing need if it's SIGHASH_SINGLE|SIGHASH_ANYONECANPAY instead of SIGHASH_ALL, assuming there's only a single input and output?


A one input/one output tx signed with SIGHASH_SINGLE|SIGHASH_ANYONECANPAY can still be modified to include more inputs and outputs, as long as the original input and output are not modified.

A tx signed with SIGHASH_ALL cannot be modified at all, and no new inputs or outputs can be added.

  • I was asking more about the procedure for generating the signature script. Am I correct that the only difference is the hash type byte appended to the end of the transaction before hashing, assuming the transaction only has 1 input and 1 output? – Roy Tang Sep 2 '18 at 4:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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