Ledger

Assets

Represent currencies and other units of value as Ledger assets.

An asset is anything that can be held in an account and moved between accounts. In Formance, an asset is identified by a string: a name, optionally followed by a decimal precision.

What it's for#

Assets let the ledger track fundamentally different things in the same system (currencies, loyalty points, in-app tokens, and anything else) without mixing them. Each account holds balances per asset independently.

Asset notation#

An asset is written as NAME or NAME/PRECISION, where NAME is an uppercase identifier and PRECISION, when present, is the number of decimal places. Whole-unit assets such as JPY and COIN carry no suffix. All amounts in the ledger are stored as integers, and the precision suffix is a naming convention for your benefit: it tells your application where to put the decimal point. The ledger does not read it.

AssetMeaningExample amountRepresents
USD/2US dollars, 2 decimal places10000$100.00
EUR/2Euros, 2 decimal places4999€49.99
BTC/8Bitcoin, 8 decimal places1000000001 BTC
JPYJapanese yen, whole units5000¥5,000

There is no currency registry, and the ledger does not interpret the precision. It checks that the asset matches the pattern [A-Z][A-Z0-9]{0,16}(_[A-Z]{1,16})?(/\d{1,6})? and then treats the whole string as an opaque key for a balance. It never divides by 10^precision, and it does not relate USD/2 to USD/3 — to the ledger those are two unrelated assets. Scaling and formatting are entirely your application's responsibility.

The one place on the platform that splits an asset into <name>/<precision> is Numscript's asset-scaling feature, which moves value between differently-scaled balances of the same asset. It is opt-in: it requires the experimental interpreter and the experimental-asset-scaling feature flag. Everywhere else — and for any name without a /, such as JPY or COIN — the asset is just a string. For a detailed specification of how assets and amounts are represented in Numscript, see Unambiguous Monetary Notation.

Multi-asset accounts#

The Formance Ledger is a multi-asset ledger. Multiple assets can be held within a single account natively. An account's balance for each asset is tracked independently. Sending USD/2 from one account does not affect its EUR/2 balance.

json
{
  "users:alice:wallet": {
    "USD/2": 10000,
    "EUR/2": 4500,
    "COIN": 200
  }
}

Moving between different assets requires an explicit conversion transaction. See Currency Conversion for strategies on funded and non-funded exchanges.

Do / Don't#

  • Do: Always specify precision consistently; if you use USD/2 in one transaction, use it everywhere for that currency.
  • Do: Use whole-unit asset names like COIN or JPY for integer-only assets like loyalty points, votes, or zero-decimal currencies.
  • Don't: Mix precisions for the same real-world currency (e.g. using both USD/2 and USD/3); they are treated as different assets.
  • Do: Divide the raw integer amount by 10^precision before displaying it to users (e.g. 10000 tagged USD/2 → divide by 100 → display as $100.00). Omit the precision suffix from the rendered asset label (USD, not USD/2).
  • Don't: Display the raw integer directly or simply strip the /2; that would render $10000 instead of $100.00.