Friday, November 22, 2024

bitcoin core – Can hashtype in BTC scriptSig contained worth aside from 0x01, 0x02, 0x03, 0x80, 0x81, 0x82, 0x83?

Sure, the sighash kind could be aside from 0x01, 0x02, 0x03, 0x80, 0x81, 0x82, and 0x83, however it may’t be values like 1190874345 or -886562767. You will note these within the checks due to the precise features being examined, however these sighash sorts won’t work in precise transactions.

In precise transactions, the sighash kind is the final byte of the signature merchandise. As a result of it’s one byte, there are solely 256 potential sighash kind values. Nonetheless, in creating the sighash (and the features that create that) take a signed int which is 4 bytes. So the unit checks for that operate use legitimate values for the operate however these are usually not legitimate in transactions.

So in precise transactions, you need to use different sighash sorts. How they behave is a little bit exhausting to explain. Confusingly, typically the sighash kind is handled as a bit set, and different instances, as an int.

If the eigth bit (most important bit) is ready, then the SIGHASH_ANYONECANPAY habits will apply. If taking simply the primary 5 bits is the same as 2, then SIGHASH_NONE habits applies. And if taking simply the primary 5 bits is the same as 3, then SIGHASH_SINGLE habits applies. All values that don’t meet these necessities (which incorporates the default SIGHASH_ALL 0x01) all imply to make use of the SIGHASH_ALL guidelines.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles