Function input_hash

Source
pub fn input_hash(a: u32) -> Option<u256>
Expand description

Return the SHA256 hash of the following:

  • If the input is not a pegin, then the byte 0x00.
  • If the input is a pegin, then the byte 0x01 followed by the parent chain’s genesis hash (32 bytes).
  • The input’s serialized previous transaction id (32 bytes).
  • The input’s previous transaction index in big endian format (4 bytes).
  • The input’s sequence number in big endian format (4 bytes).
  • If the input has no annex, or isn’t a taproot spend, then the byte 0x00.
  • If the input has an annex, then the byte 0x01 followed by the SHA256 hash of the annex (32 bytes).

Return None if the input does not exist.

§Cost

965 mWU (milli weight units)