Many Substrate pallets extrinsics take a Balance type, for example balances->transfer or bounties->create.

The Polkadot/substrate Development UI somehow detects that it is a Token related field and adjusts the UI accordingly, for example by adding the token symbol in the box, handling decimals, etc.

I was wondering if the polkadot UI is using type information to infer that the Compact parameter is actually a Token value, or how is that happening.

I am creating a extrinsinc that takes a #[pallet::compact] value: BalanceOf<T> but the UI is not treating it the same way.

How is that implemented?

1 Answer 1


For a running chain the interface system.properties: ChainProperties is provided, it is defined in the chain config and compiled into runtime. For polkadot it returns:

  ss58Format: 0
  tokenDecimals: [
  tokenSymbol: [

On nodle we have defined it in chain_spec.rs in genesis block as:

    let mut properties = sc_chain_spec::Properties::new();
    properties.insert("tokenSymbol".into(), "NODL".into());
    properties.insert("tokenDecimals".into(), 11.into());
    properties.insert("ss58Format".into(), 42.into());

For the second part of your question, when you create a pallet in runtime source you need to configure the pallet in an impl block. In our chain we have a constant defined:

pub type Balance = u128;

and reused in all pallets related to currencies.

  • I am building based on substrate template, all these settings are working. For example, the balances pallet works, token is setup OK, etc. The question is more related to why UI can detect in some extrinsics that the u128 is a token value and in other extrinsic it does not, when both are typed BalanceOf<T>
    – rvalle
    Nov 8, 2023 at 14:23

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.