6

How would I track the token issuance of a parachain, using either the polkadot api or on-chain data? Does anyone have a simple example?

3 Answers 3

7

It is exposed in the state under balances.totalIssuance, so the following will work -

const total = await api.query.balances.totalIssuance();

console.log(total.toString());

For the parachain connect to the parachain wss endpoint, for the relay chain connect to the relay wss endpoint.

1

The total issuance of a Substrate chain is most commonly a storage item from the Balances pallet. Here's how you would find this value using Polkadot JS Apps:

  1. Go to the chain state for the chain you're querying.
  2. Select the balances pallet and the totalIssuance storage item.
  3. Hit the " + " button on the right and you'll see some u128 value appear.

For example, querying Polkadot's chain state:

enter image description here

0

subscribe and trace

const unsub = await api.query.balances.totalIssuance((total) => {
  console.log(`Total issuance changed to ${total}`);
});

Your Answer

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

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