1

Every time when I start my parachain, I see Bob, Charlie, Dave,... etc and each of them has 1.1529 MUNIT on Polkadot.js.org's Accounts -> Accounts -> My Account page. But how does Polkadot.js.org know my parachain's decimal places?

What does the M mean? like 1 Million with 6 zeros?

After sending 100000000000000000 with 17 zeros as the value from one account to another, finally that shows up on that above Accounts page as 0.1MUNIT. Assume M means 6 zeros, then 12 = 18 - 6... The Accounts page shows balance with 12 decimal places... where did that come from?

After some digging, I found those inside the chain_spec.rs

pub fn development_config() ...
    properties.insert("tokenDecimals".into(), 12.into());

pub fn local_testnet_config() ...
    properties.insert("tokenDecimals".into(), 12.into());

So the 12 dp must come from there... right? That is how Polkadot.js.org set its decimal places in the Accounts page. Right?

https://polkadot.js.org/apps/?rpc=ws%3A%2F%2Flocalhost%3A8844#

1 Answer 1

2

Yes the tokenDecimals can be hardcoded in the chain_spec.rs file (like you have shown) or they can be configured in the chain spec of the chain. For example, in Polkadot's chain spec you will see the following:

"properties": {
    "ss58Format": 0,
    "tokenDecimals": 10,
    "tokenSymbol": "DOT"
  },

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.