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