Skip to main content
Before sending a transaction, you can use the public client to estimate the gas fees. Some chains also support custom gas estimation methods. Here are examples of how to get a gas estimate using viem:

Setup

Estimate Gas Function