Finding Missing Native Currency Symbol from Substrate Blockchain Framework

Finding missing Native Currency Symbol from Substrate Framework

Substrate framework let you build your own blockchain and there are many tutorials, blogs and articles for the same. But one thing you won’t find is easy to have your own currency symbol for the new chain you have created.

When you create a blockchain that uses balances pallet and try to visualise it on PolkadotJS App, you will see the amount in pre-seeded accounts but the units are unspecified. But for more prominent chains you can see DOT ( PolkaDoT ), ACA( Acala ) and so on. So how substrate achieve this ?

For some reason you won’t find much about this on internet. Also, you need to differentiate between Asset pallet and Balances pallet. Balances pallet should be used for you native coin powering the chain i.e ETH, BTC and others. Asset pallet should be used to create token similar to ERC20 tokens on Ethereum.

Steps to Add Currency symbol to native token of substrate chain.

  1. Locate file. Mostly under node/src/
  2. Go to function where you want to change this config i.e local_testnet_config, development_config and others.
  3. Update the code as below:

Added: let mut props: Properties = Properties::new();let value = json!(“XAS”); // Currency symbol
props.insert(“tokenSymbol”.to_string(), value);Updated:
Pass Some(props) for the property field in from_genesis function.

That’s it. Go PolkadotJS app and connect it your chain. Outcome will be something similar to below:

XAS- Our Currency symbol for Native Token

Connect me on LinkedIn if you have ideas and can build on substrate chains.

1 Like