_Docs/
Get StartedModulesPlatformDeployCookbookChangelogReference
_Stack
_Modules
  • Ledger
  • Numscript
    • Program Structure
    • Selecting an Interpreter
    • Unambiguous Monetary Notation
    • CLI
    • Numscript specs format
    • Reference
      • Send
      • Sources
      • Destinations
      • Rounding
      • Save
      • Overdraft
      • Variables
      • Metadata
      • oneofexp
      • Account Interpolationexp
      • get_assetexp
      • get_amountexp
      • Mid-script Function Callsexp
      • Asset Colorsexp
  • Connectivity
  • WalletsEE
  • FlowsEE
  • ReconciliationEE
  1. Modules
  2. Numscript
  3. Reference
  4. Asset Colors
Numscript

Asset Colors

Numscript

Requires flag: experimental-asset-colors

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:

Numscript
send [COIN 100] (
  source = @treasury \ "GRANT"
  destination = @programs:education
)

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:

Numscript
send [COIN 100] (
  source = {
    @treasury \ "GRANT"
    @treasury \ "DONATION"
    @treasury
  }
  destination = @programs:education
)

Try grant-colored funds first, then donation-colored, then any color.

With overdraft#

Color restrictions can be combined with overdraft:

Numscript
send [COIN 100] (
  source = @treasury \ "GRANT" allowing unbounded overdraft
  destination = @programs:education
)

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
Mid-script Function CallsConnectivity
On This Page
  • Syntax
  • Ordered color fallback
  • With overdraft
  • Use cases