10 - value
Last updated
Last updated
The value of the input (value) is an 8 byte little endian integer representing the satoshi value of the UTXO being signed.
This can be useful when enforcing process states that require either static or dynamic satoshi values to be used or otherwise checked in each iteration of the transaction.
Checking the value can be a useful gating process to decide whether or not to end a process. In this example, the input value is checked, and if found to be less than 16 satoshis, an alternative condition is created.
<r_tx_preimg>
...
Version, hash_prevouts, hash_nSequence, hash_outpoints and the script have been removed
<r_tx_preimg>
OP_8
length is 8 bytes long
<r_tx_preimg> 0x08
OP_SPLIT
Split value
<8byte_value> <rr_tx_preimg>
OP_SWAP
Move to top of stack
<rr_tx_preimg> <8byte_value>
OP_BIN2NUM
Optimally encode the integer value
<rr_tx_preimg> <value>
OP_16
16 satoshis is our limit
<rr_tx_preimg> <value> 16
OP_GREATERTHANOREQUAL
numeric check
<rr_tx_preimg> <result>
OP_IF
if greater than
<rr_tx_preimg>
...
process
<rr_tx_preimg>
OP_ELSE
if less than
<rr_tx_preimg>
...
alternative process
<data_items>
OP_ENDIF
Resulting outcome