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, validation expr, hook set values, witness expr.
  • Operators (+ - * /, comparisons, && || !) and references (compile_params.X, params.X, input_id.amount_sat, input_id.asset, input_id.present).
  • Functions: pow(base, exp), index_of(id), concat(...).
  • The special fees value used in change formulas.
  • Derived params ("derived": true): interest = PRINCIPAL_AMOUNT * PRINCIPAL_INTEREST_RATE / 10000, and params derived from issuance outpoints.

See Spec.md ยง9 for the formula grammar in the meantime.