native token of my chain has 12 decimals,now i have integrated EVM functionality into my chain, is there any way by which i can change evm decimals from 18 to 12 as i don't want to change my native token decimals???
2 Answers
You should, and I recommend changing your native token decimals. Otherwise, you need a converter.
Then, I have a question.
Why do you need EVM? This will break almost every existing thing (such as smart contract). EVM's goal is to mock Ethereum and re-use the existing infrastructures. And the third-party developers will be so confused while developing base on your chain.
Darwinia has been running for over 2 years. Finally, we give up on maintaining this. We change the decimal to 18. So, that's my suggestion.
-
Xavier thanks for your response , we want EVM functionality in our chain, and its been more than 1 yr our chain is live so we want to add EVM functionality. we want a solution for token decimals as our native token has 12 decimals.can you tell me something about converter. Jan 13 at 7:51
-
1
In order to change the decimals of your native token you have to modify your chain_spec.rs file.
Import in the node/Cargo.toml
sc-chain-spec
[dependencies.sc-chain-spec]
branch = 'master'
git = "https://github.com/paritytech/substrate"
And in the function development_config() or local_testnet_config() add your properties:
let mut properties = sc_chain_spec::Properties::new();
properties.insert("tokenDecimals".into(), 12.into());
And finally add in properties: of the from_genesis call:
// Properties
Some(properties),
See an example in the Parachain Template Node