Querying Currency Supply
BEGINNER⚓︎
Exchanges and market data aggregators need accurate supply figures to display market capitalization and token metrics.
The Symbol network exposes the maximum, total, and circulating supply of XYM, the native currency, through dedicated REST endpoints.
This tutorial shows how to query each value and derive additional metrics from them.
Prerequisites⚓︎
This tutorial uses the Symbol REST API without requiring an SDK. You only need a way to make HTTP requests.
Full Code⚓︎
The snippet uses the NODE_URL environment variable to set the Symbol API node.
If no value is provided, a default testnet node is used.
Default node is testnet
The default node points to testnet.
For production supply data, set NODE_URL to a mainnet node.
For a list of available mainnet nodes, see symbol.fyi/nodes.
Code Explanation⚓︎
Fetching Supply Values⚓︎
Each supply value is available through a dedicated endpoint:
/network/currency/supply/maxGET: the hard cap for XYM, as configured in the network properties./network/currency/supply/totalGET: the total amount of XYM minted to date. New XYM is minted gradually through inflation rewards with each new block./network/currency/supply/circulatingGET: the total supply minus the balances held by the nemesis account, treasury accounts, and the sink accounts that collect harvest, mosaic rental, and namespace rental fees.
All three endpoints return a plain-text number (not JSON), already expressed in whole units with decimal places
(e.g. 8999999999.000000), not in atomic units.
Circulating supply is node-dependent
The list of non-circulating accounts is configured by each node operator (in the node's rest.json file),
so different nodes could report different circulating supply values.
If you are integrating supply data, ensure you query a trusted node with the
default configuration.
Deriving Additional Metrics⚓︎
After fetching all three values, the code derives two additional metrics:
- Non-circulating: The difference between total and circulating supply.
- Unminted: The difference between maximum and total supply, representing the XYM that remains to be minted.
Output⚓︎
The following output shows a typical run querying the currency supply:
These values come from a testnet node and do not reflect mainnet supply figures.
The output shows the full breakdown of the XYM supply:
- Maximum supply (line 2): The hard cap for XYM.
- Total supply (line 3): Lower than the maximum, because not all XYM has been minted yet.
- Circulating supply (line 4): Lower still, because some minted XYM is held by non-circulating accounts.
- Non-circulating supply (line 5): The difference between total and circulating supply.
- Unminted supply (line 6): The remaining XYM that will be gradually minted through inflation rewards.
Conclusion⚓︎
This tutorial showed how to:
Next steps⚓︎
To check a specific account's XYM balance, see the Query Account Balance tutorial.