Formulas are string expressions evaluated at transaction build time. They appear
in output/input amount_sat, validation expr, hook set values, and witness
expr.
Operator Description
+ - * /Integer arithmetic (division truncates)
== != < <= > >=Comparison (returns boolean)
&& || !Boolean logic
( )Grouping
Syntax Description
compile_params.NAMECompile parameter by name
params.NAMEAction parameter by name
args.NAMEAction argument by name
input_id.amount_satSatoshi amount of a resolved input
input_id.assetAsset ID of a resolved input (hex string)
input_id.presentBoolean — whether an optional input was found
output_id.amount_satSatoshi amount of a constructed output (post-construction)
feesEstimated transaction fee (used in change formulas)
Function Signature Description
pow(base, exp)(u64, u64) → u64 Integer exponentiation
index_of(id)(input or output id) → u32 Transaction index of a named input/output
concat(a, b, …)(bytes…) → bytes Byte concatenation (OP_RETURN data only)
See Spec.md §9
for the authoritative grammar.