I've done some testing with pybitcointools and one of the BitcoinCore test vectors with a SIGHASH of zero.
For SIGHASH =0
, the Tx which is signed
- does not have the 4 nullbytes appended, ie for SIGHASH 1 there'd be
01000000
appended - the Tx structure is hashed, and the hash is reversed
It's just a matter of appending 4 nullbytes, instead of 01000000
, to the signing transaction.
The Core software checks for this non-standard hashtype now, however we can see there's no problem in validating these rare transactions since the code only checks for SIGHASH ACP, SINGLE & NONE. See Python-Bitcoinlib's code for a Python interpretation
See this test vector, where the hash being validated is 11743b220e9e24e89abd4ff124a2740531fe7d7f9b4e26de14710a532fd543e2
.
FWIW, Pybitcointools needs to have the txhash
function edited so that instead of if hashcode:
, it reads if hashcode is not None:
. The else clause in that function was confusing me, but it appears to be for hashing signed transactions (ie to return the TxID)