Token total supply
GET /api/chain/total-supplyThe circulating total supply of an ERC-20, read from the token contract itself rather than from an aggregator, so it is the number the chain holds at the block you asked for. Send GET /api/chain/total-supply with the required field contract and pay $0.001 per call over x402 or MPP (there is no free tier). It returns a JSON object with contract, network, totalSupply, decimals and totalSupplyFormatted.
Returns the raw uint256 and the same figure formatted with the token's own decimals. A contract that does not implement totalSupply answers 422 rather than a fabricated zero. EVM chains: ethereum, base, polygon, arbitrum, optimism.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
contract | string | yes | 0x ERC-20 token contract address Also accepted as contractAddress, token, address. |
network | string | no | ethereum | base | polygon | arbitrum | optimism (default base) |
Example request
curl -i "https://agent402.tools/api/chain/total-supply?contract=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913&network=base"
Without payment this returns HTTP 402 Payment Required with the exact price for chain-total-supply; any x402 v2 or MPP client pays it and retries.
Example response
{
"contract": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"network": "base",
"totalSupply": "4182993441205067",
"decimals": 6,
"totalSupplyFormatted": "4182993441.205067"
}
| Field | Type | Always present | In the example |
|---|---|---|---|
contract | string | yes | 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913 |
network | string | yes | base |
totalSupply | string | yes | 4182993441205067 |
decimals | number | yes | 6 |
totalSupplyFormatted | string | yes | 4182993441.205067 |
From an MCP client
catalog.call {
"slug": "chain-total-supply",
"params": {
"contract": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"network": "base"
}
}
The hosted connector at https://agent402.tools/mcp needs a payment for chain-total-supply; the stdio package pays it from a wallet or from AGENT402_CREDITS_KEY. Local install: npx -y agent402-mcp.
Errors and behavior
contractis required. An input the tool rejects returns an HTTP 4xx whose body carrieserror,tool,expected,requiredandexample, so the caller can correct it.- A paid call that ends in any status of 400 or above is not charged over x402, MPP or a prepaid credits key: settlement is cancelled when the tool fails. The exception is a Tempo push credential, a transfer the buyer sent before the call: it settles before the tool runs, so if the tool then fails the payment is recorded as a refund owed to the paying wallet.
- Wallet-only: this tool reaches the network or stored state, so it has no proof-of-work tier. A prepaid card-credits key issued earlier (
Authorization: Bearer a402_...) also pays it. - A
POSTwith a JSON body to /api/chain/total-supply is served as this GET, with the body as the input. - An
Idempotency-Keyheader makes a retried paid call replay the first 200 instead of charging again (an answer larger than 1 MB is not replayed).
Paid call (JavaScript agent)
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
client.setSpendControls?.(false); // keep your own spending ceiling in code
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/chain/total-supply?contract=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913&network=base");
Related tools
Token price by contract address
GET /api/coin-price-by-contractLive price, market cap, 24h volume and 24h change for ERC-20 / SPL / other chain tokens looked up by CONTRACT ADDRESS on…
NFT owner lookup (ERC-721 ownerOf)
GET /api/erc721-ownerWho owns this NFT? Calls ownerOf(tokenId) on any ERC-721 contract on Ethereum, Base, Polygon, Arbitrum, or Optimism. Com…
ERC-20 token metadata
POST /api/token-metadataResolve an ERC-20 contract address to its on-chain metadata: symbol, decimals, name, and logo URL where available. Use t…
Wallet balance (native + ERC-20)
POST /api/wallet-balanceLook up the native coin balance (ETH/MATIC) plus every ERC-20 holding for a wallet address on Ethereum, Base, Polygon, A…
Known-address label lookup
POST /api/address-labelLabel a known EVM address from a curated, committed dataset: major stablecoin + token contracts (the USDC and USDG contr…
Wallet token transfers (filtered)
POST /api/asset-transfersRecent token transfers for a wallet on Base, Ethereum and other EVM chains, newest first. Filtered transfer log for an E…