Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Formulas & derived params

📝 Draft. This chapter has not been reviewed yet — content may be incomplete or change.

Problem. Compute amounts, indices, and parameter values from other values instead of hard-coding them.

🚧 This recipe is a stub. Outline of what it will cover:

  • Where formulas appear: output/input amount_sat, a param's compute, and hook set values. (Not witnesses — a witness takes a literal value, not an expression.)
  • Operators (+ - * /, comparisons, && || !) and references (instance.X, params.X, input_id.amount_sat, input_id.asset, input_id.present).
  • Functions: pow(base, exp), and concat(...) for OP_RETURN data only.
  • The special fee value used in change and re-lock formulas.
  • Computed params ("compute": "..."): interest = PRINCIPAL_AMOUNT * PRINCIPAL_INTEREST_RATE / 10000, and params derived from issuance outpoints.

In the meantime the formula language reference has the operators, the references, and the $ prefix rule.