Token decimals
Also called: Base units, Smallest unit
How many decimal places a token uses; on-chain amounts are whole numbers of the smallest unit, so 1 USDT with 6 decimals is 1,000,000 units.
Blockchains don't store fractions. A token defines a number of decimals, and every amount is a whole number of its smallest unit. 25.50 USDT with 6 decimals is 25500000. ETH has 18 decimals (its smallest unit is the wei); BTC has 8 (the satoshi).
Decimals differ even for the same coin on different networks. USDT has 6 decimals on Ethereum and Tron, but 18 on BNB Chain. Code that assumes one value will send the wrong amount, sometimes by a factor of a trillion.
Handling amounts safely
- Keep amounts as whole numbers of base units, or as exact decimal strings. Never as floating-point numbers, which can't represent many decimals exactly.
- Look up decimals per token, per network.
- Convert only at the edges: when showing amounts to people and when reading their input.
On Valtu
API amounts are whole numbers of the smallest unit. assets.toBaseUnits and fromBaseUnits in the wallet kit, and to_base_units and from_base_units in the Python SDK, convert exactly and refuse floats. Each coin page shows its decimals.
Related terms
Keep reading.
More in networks and tokens: Confirmations · Finality · Chain reorganization · Mempool · Block explorer · Testnet · EVM · Layer 2 · Smart contract · TRC-20 · Stablecoin · USDC · Wrapped token. The whole glossary.
Put it into practice.
Every workspace starts on testnets with free test coins: same dashboard, same API. Go live when your team is ready.