I see the wiki page Script, and the page on Contracts makes some remarks on things like signature numbers and SIGHASH flags, but it seems incomplete and not very friendly to someone not familiar with the protocol. Is there an official specification of the transaction protocol other than the wiki pages? Or do I have to read the source code?
Or do I have to read the source code?
This is the only "official specification". The wiki pages have a lot of good info, but they sometimes contain inaccuracies or important omissions.
There's some info about the SIGHASH flags here: