Estimate gas fees

Transaction fees (or "gas fees") can vary significantly depending on network activity, so having a reliable estimation method is crucial for a smooth user experiences.

circle-exclamation

What does it mean for Chiliz Chain developers?

Just like with any blockchain, you must pay gas for every transaction on Chiliz Chain.

The key is to balance cost-effectiveness with timely confirmations to avoid failing or delayed transactions. Keeping your gas estimates up to date helps prevent both overpaying and underpaying.

How to do it natively

If you want to keep it vanilla, you can rely on a cURLarrow-up-right request to a Chiliz Chain RPC server. See here: How to get the current gas price.

How to do it through an explorer API

Both Chiliscanarrow-up-right and Chiliz Block Explorerarrow-up-right offer APIs allowing you to get the current gas price for Chiliz Chain.

circle-exclamation

Using Chiliscan's API

The Chiliscan API provides the avg-gas-price method for that purpose:

... which will return a JSON string with the current value.

Using Chiliz Block Explorer's API

The Chiliz Block Explorer API has the stats endpoint which provides that information:

The endpoint returns which includes gas price information. For example:

You'll want to use this section (prices are in Gwei):

circle-info
  • average balances a moderate cost with reliable inclusion in the next few blocks.

  • fast pays the highest premium to incentivize validators to prioritize your transaction immediately, ensuring the quickest possible confirmation for urgent needs.

  • slow offers the lowest fee but carries the risk of your transaction remaining pending if network congestion increases.

How to do it using Blocknative?

Blocknativearrow-up-right builds infrastructure to monitor and manage the complexity of transacting on public blockchain networks.

Blocknative’s Gas APIarrow-up-right offers a reliable, real-time approach to retrieving gas prices.

Step 1: Get a key

To use Blocknative's Gas API in your project, you will need an API Key.

You will need to join the Gas Network firstarrow-up-right, which will give you access to your own API key.

Step 2: Implement the call to the Gas API

Once you have an API key, you can request fee estimation for Chiliz.

circle-info

Remember that the chain ID for Chiliz Chain Mainnet is 88888.

The simplest way is to call on the API via a REST request. For instance, via command line:

Learn more in the Blocknative documentationarrow-up-right.

Last updated

Was this helpful?