What goes in the tx hash preimage when signing with 0x83 (SINGLE|ANYONECANPAY)? I have script to create a P2WPKH to P2WPKH transaction (1 input, 1 output) and sign it with the sighash type 0x01 SIGHASH_ALL.

Which fields would I need to change in the tx digest preimage to turn the signature into one with a sighash type of 0x83 (SINGLE|ANYONECANPAY)? I'm having trouble understanding the documentation in bip_143.

For reference, the tx digest preimage:


  Double SHA256 of the serialization of:
       1. nVersion of the transaction (4-byte little endian)
       2. hashPrevouts (32-byte hash)
       3. hashSequence (32-byte hash)
       4. outpoint (32-byte hash + 4-byte little endian) 
       5. scriptCode of the input (serialized as scripts inside CTxOuts)
       6. value of the output spent by this input (8-byte little endian)
       7. nSequence of the input (4-byte little endian)
       8. hashOutputs (32-byte hash)
       9. nLocktime of the transaction (4-byte little endian)
      10. sighash type of the signature (4-byte little endian)
From BIP143:


  If the ANYONECANPAY flag is not set, hashPrevouts is the double SHA256
  of the serialization of all input outpoints;
  
  Otherwise, hashPrevouts is a uint256 of 0x0000......0000.


All the details you need are in the BIP