0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Cross-Chain Swap Token Decimals Explained

0
Posted at

Before swapping across chains, check the amount in each token’s own units and compare the quoted value, not the raw numbers. A token’s decimals set how its smallest parts are displayed; they do not set its market price. The swap rate, fees, and rounding determine what arrives.

What do token decimals change in a cross-chain swap?

Decimals tell software how to turn a whole-number token balance into the amount people see. For a token with six decimals, 1,250,000 smallest units display as 1.25 tokens; with 18 decimals, the same raw number displays as 0.00000000000125.

Ethereum.org’s ERC-20 explanation describes decimals as display information: token balances are stored as whole numbers, then divided by 10 to the token’s decimal count. Bitcoin uses a different unit system: one BTC equals 100 million satoshis, as the Bitcoin Developer Guide explains. A cross-chain route must read each asset’s units correctly before it calculates the swap.

For example, say you swap 1.25 tokens with six decimals for a token with 18 decimals. If the quoted rate is 2 destination tokens per source token, the expected amount is about 2.5 destination tokens, represented internally as 2,500,000,000,000,000,000 smallest units before any fees or rounding. The raw numbers differ greatly, but that does not mean the value changed by that factor.

Use the displayed amount and quoted rate to judge the trade. A relay bridge service can route a cross-chain transfer and swap in one flow, which helps when you want the destination asset without manually arranging separate conversions.

How can you check the amount you will receive?

Read the quote in this order: source amount, destination token, estimated output, and minimum received. The minimum is the least amount the swap permits after price movement and other stated deductions; the exact labels vary by service.

A common mistake is comparing raw token units across chains, or assuming matching symbols mean matching assets. Fix it by checking the token identity and chain, then compare the human-readable amounts and their approximate value. If the displayed output seems off by a factor of 10, 100, or 1,000, recheck the decimal conversion before proceeding.

The route’s bridge router—software that selects how assets move between networks—may release an existing asset or use a representation issued on the destination chain. A liquidity provider, which supplies tokens for swaps, may also affect the quote. Decimal conversion happens at the units layer; the route’s available liquidity, exchange rate, fees, and slippage determine the economic result.

Rounding matters most when the destination token has few decimals. If an internal calculation produces 1.237 tokens but that token supports only two decimal places, the final amount cannot represent all three digits; the route’s rules decide how it rounds or rejects the amount. Check that the quoted minimum still meets your needs, especially for small swaps.

In general, judge the quote by the expected destination amount after fees, not by the number of digits or raw units. If the route uses a different asset than you expected, or its minimum received is too low, pause and choose a route whose output fits your intended use.

Questions to check before you swap

Do more decimals mean a token is worth more?

No. Decimals only describe how finely a token amount can be divided and displayed. A token with 18 decimals is not inherently more valuable than one with six. To compare value, use the quoted exchange rate and the amount you expect to receive after applicable fees.

Why did the received amount differ from the estimate?

The estimate can change if the exchange rate moves before execution, or if fees and rounding reduce the output. Compare the final amount with the quote’s minimum received. If it falls below that limit, the route should fail rather than complete at a worse amount, subject to that route’s rules.

When should I choose a different route?

Choose differently if the destination asset is not the one you need, the minimum received is too low, or the route cannot represent the amount at the destination token’s precision. If those conditions change your decision, compare routes before sending; a relay bridge may suit a combined transfer and swap, but the quote must still fit your needs.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?