Skip to content

Search documentation

Search documentation pages, sections, and topics.

On this page

Money

Monetary amounts are strings, never JSON numbers, so precision is exact across fiat, crypto, and points — there is no float rounding anywhere on the wire.

The amount string format

The format is <currency_code>:<amount>:

  • Currency code — three or more uppercase letters (USD, JPY, BTC).
  • Amount — a positive decimal. Direction is never expressed with a sign; it comes from the entry's operation (CREDIT or DEBIT, see Transactions).
ExampleMeaning
USD:42.0142 dollars and 1 cent
JPY:1010 yen (no minor units)
BTC:0.00000001one satoshi

Exact precision, no rounding

Because amounts stay strings end to end, ledgers can hold USD cents, JPY whole units, and BTC satoshis in the same transaction without converting through a float. The server parses and validates each amount against the currency's scale; clients never round for display and then round-trip the display string back as truth.

Rules that keep amounts correct

Two rules keep amounts correct:

  • Currency must belong to the ledger. Each amount's currency is validated against the ledger's configured currencies; an unknown or mismatched currency is rejected with 400.
  • Respect the currency's precision. Use only as many decimal places as the currency supports (for example a 2-decimal currency like USD accepts USD:42.01, not USD:42.014).

Amounts always appear inside transaction entries. For how those entries pair up — debits, credits, and the rule that every transaction must balance — see Transactions.