Docs

Updates to the deployment flow: supporting every EVM

Yash Kumar

We have updated our contract deployment process to effectively handle gas-price related issues on certain chains. This removes the need for special handling, and streamlines the deployment flow on more such EVM compatible chains.

Thirdweb supports contract deployment on all EVM compatible chains, as highlighted in this article. However, the process was not so smooth on some chains that have non-standard gas price configurations.

As mentioned in the article, whenever a chain presents with non-standard or extremely high / low values of base fee, which differ from the standard base fee used in keyless transaction for infra deployments, we need to add an exception for that chain and save the custom gas price for that chain.

The latest update removes the need for any custom handling or configuration for chains with non-standard gas price. Instead, we have categorized gas prices into bins. Each bin represents a gas price, and corresponds to a unique address for create2 factory.

This is how it works:

  • Check if the common create2 factory (pre EIP-155) is deployed on a chain
  • If not, check all gas prices in the bins list to find if a create2 factory was deployed with that configuration and return address
  • If no create2 factory found, fetch the gas price for that chain, round it up to the nearest gas bin, and use this rounded-up gas price to construct the create2 factory deployment transaction

In this way, the gas price required for create2 factory's deployment falls into one of the gas price bins, and doesn't need to be hardcoded or custom configured. The solution also takes into account the performance aspects by minimising the number of rpc calls required to check for existing deployments and gas prices.

This truly enables deployment on every EVM, while taking into account minor differences across chains.

Go ahead and deploy contracts on any chain of your choice here.