CashScript has several functions builtin for things like cryptographic and arithmetic applications. It also includes many common operators, although some important ones are notably missing due to the limitations of the underlying Bitcoin Script.
Returns the absolute value of argument
Returns the minimum value of arguments
Returns the maximum value of arguments
true if and only if
x >= lower && x < upper.
Returns the RIPEMD-160 hash of argument
Returns the SHA-1 hash of argument
Returns the SHA-256 hash of argument
Returns the RIPEMD-160 hash of the SHA-256 hash of argument
Returns the double SHA-256 hash of argument
Signature checking functions
All signature checking functions must comply with the NULLFAIL rule. This means that if you want to use the output of a signature check inside the condition of an if-statement, the input signature needs to either be correct, or an empty byte array. When you use an incorrect signature as an input, the script will fail.
Checks that transaction signature
s is valid for the current transaction and matches with public key
Performs a multi-signature check using a list of transaction signatures and public keys.
checkMultiSig() call can be simulated using multiple
Checks that sig
s is a valid signature for message
msg and matches with public key
An overview of all supported operators and their precedence is included below. Notable is a lack of multiplication and exponentiation, since these operations are not supported by the underlying Bitcoin Script.
|7||Postfix increment and decrement|
|9||Division and modulo|
|10||Addition and subtraction|
|10||String / bytes concatenation|
|12||Equality and inequality|