# What is chain decimal?

I saw token decimal has different value like 12, 10, 6 in different substrate chain, What exactly it means and what is the use of it?

This is the number of decimals on your main token. Compare with fiat currencies a euro has a decimal value of `2` and a cup of coffee is 0.99 Euro, while in Japan a Japanese yen (for all practical use) has a decimal value of `0` and a cup of coffee is 120 yen.

On a chain all currencies are a huge integer number, but since that is confusing for humans, these integers are treated as a fix point decimal number system instead.

Calling the RPC `system.properties` will reveal this information for any chain. For instance polkadot as 10

``````system.properties: ChainProperties
{
isEthereum: false
ss58Format: 0
tokenDecimals: [
10
]
tokenSymbol: [
DOT
]
}
``````

So `1 DOT` is represented internally by `10^10`

When encoding operations on the chain values are given in the internal u128 integer format, any tool communication with the chain should do this conversion for the user.

• on what basics should we define fix point decimal number for chain? Is it random value or it has some meaning? @Simon Dec 4, 2023 at 13:12
• @Ganesh11 - there's an unfortunate terminology problem here where it pays to be precise. The fixed point number can mean two things. First, when doing any kind of arithmetic, remember it is a binary number - therefore you have the typical problems of representing fractions that you think of as decimal fractions in binary - that is, all the problems that surface with multiples of `0.1`. So when you do use the bits to the right of the implied "binary point" separating whole from fractional: be careful. The other use is that all numbers representing amounts of your token are ... Dec 4, 2023 at 18:50
• ... represented as a whole number of the smallest unit of that token. In the example in this answer, the precision is ten decimal digits to the right of the decimal point, so an amount of 1 token is actually represented as `10_000_000_000`. On a chain such as Ethereum, using Uniswap contracts for examples, fractions there - used for computing liquidity equations for example - are represented as a `128.128` fixed point binary number - which would mean you take your 1 token = `10_000_000_000` "units" (whatever you call them) and multiply that by `2¹²⁸`. Dec 4, 2023 at 18:55
• If you're asking how you define your fixed point (i.e., number of decimal digits) for your token - that depends on your use case moderated by the fact that the entire expected treasury amount must fit on the left side of the implied point, and the smallest units you expect to use plus some more digits for arithmetic precision when multiplying by a fraction, or dividing need to fit on the right side. Look around for existing examples, and make an educated guess as to what you need. Dec 4, 2023 at 18:58