Gas fees are the costs associated with initiating a transaction on a given blockchain, allowing network validators to perform the requested function. 

Gas fees can fluctuate due to network congestion, the type of transaction you request, and the priority placed on your request. You can accelerate a transaction by paying additional gas fees.  

Each blockchain has its own native asset required to pay these fees. When interacting with the blockchain, you’ll need to account for the amount of this native asset required for the requested transaction.

You can estimate transaction fees and contract execution with Circle’s Programmable Wallets APIs. 

Video Tutorial: Estimating Gas Fees for Transactions

Watch this video to learn about gas fees, also known as transaction fees. In the video, you will learn the importance of gas fees, understand how to estimate fees for a transfer transaction using an API and send USDC to other wallets using the estimates.

Programmable Wallets Gas Fee Configurations

When initiating a request via Circle’s Programmable Wallets APIs that require gas fees, you have two options for configuring your fee tolerance: fee levels and gas limits

Fee levels provide a simple way to configure your gas tolerance. Depending on your choice, the speed in which your transaction completes compared to the expected blockchain confirmation timing may vary. 

You can choose between three tolerance levels:

  1. low - a low-priority transaction, expected to take longer than the average amount of time to complete, with lower fees
  2. medium - a medium-priority transaction, expected to take the average amount of time to complete, with average fees
  3. high - a high-priority transaction, expected to take less than the average amount of time to complete, with higher fees

Gas limits allow for a more advanced configuration of your gas tolerance. Setting gas limit requires the following parameters, which are all designated in wei: 

  1. gasLimit - the base amount of gas required to process the requested transaction
  2. priorityFee - an additional “tip” that can be added to the validator to accelerate the requested transaction
  3. maxFee - maximum fee that can be used for the requested transaction, if the fee is greater, the transaction will be failed.