Requires flag: experimental-asset-colors
This is a feature of the experimental Numscript interpreter. To run it through the API, set runtime: experimental-interpreter in the transaction request body (the default is machine) and enable the relevant feature flag. See Selecting an Interpreter for per-feature availability.
Restrict which funds can be sourced from an account based on a color tag. Colors track the origin or purpose of funds — useful for compliance, earmarking, or regulatory constraints.
Syntax#
Use \ after a source account to restrict by color:
Only funds tagged with the "GRANT" color in @treasury are used. If the account has 200 COIN total but only 80 are tagged "GRANT", this transaction fails with insufficient funds.
Ordered color fallback#
Combine with ordered sources to try different colors in priority:
Try grant-colored funds first, then donation-colored, then any color.
With overdraft#
Color restrictions can be combined with overdraft:
Use cases#
- Earmark funds for specific purposes (grants, donations, operating)
- Regulatory compliance — track fund origins through the ledger
- Prevent mixing of restricted and unrestricted funds