Skip to main content

Optimize Your Transaction Fees

This section will help you to reduce the transaction fees on Mantle v2 Tectonic. Mantle v2 Tectonic introduces a new fee collection mechanism, including EIP-1559 and some native token optimizations, if you want to know more details about our fee collection mechanism, please refer to this document.

In Mantle v2 Tectonic, with the introduction of the EIP-1559 mechanism, users need to configure the network's basefee (the minimum basefee currently set 0.02 gwei) and priorityfee (recommend to set it to 0) configurations in order to optimize the transaction fees. We explain the different development components to optimize the user experience.

MetaMask

If you are a user of MetaMask for trading or contract deployment and interaction (e.g. using Remix), you can set up basefee and priorityfee in MetaMask to be able to send transactions at a lowest fee. Details can be found here.

Hardhat

If you are using Hardhat for contract deployment and interaction, you can use the default configuration in hardhat.config.ts or specify gasPrice as the network minimum basefee:

const config: HardhatUserConfig = {
solidity: '0.8.19', // solidity version
defaultNetwork: 'mantleSepolia', // chosen by default when network isn't specified while running Hardhat
networks: {
mantle: {
url: 'https://rpc.mantle.xyz', //mainnet
accounts: [process.env.ACCOUNT_PRIVATE_KEY ?? ''],
// Use the default configuration
},
mantleSepolia: {
url: 'https://rpc.sepolia.mantle.xyz', // Sepolia Testnet
accounts: [process.env.ACCOUNT_PRIVATE_KEY ?? ''],
gasPrice: 20000000, // specify the network's minimum basefee as the gas price
},
},
};

Foundry

If you are using Foundry for contract deployment and interaction, you need to set it up on the corresponding command line:

Contracts Deployment

warning

Currently, for users deploying contracts using forge create, we strongly recommend using the legacy transaction type.

When you use the forge script for contract deployment, there are different settings for different transaction types:

  • legacy transactions

    If you are using legacy type transactions, you need to set the -g to 4000000 for contract deployment using the following command, e.g.

    forge script --legacy script/Deploy.s.sol:DeploySiege --sig "run()" --rpc-url <mantle_rpc_url> --broadcast -g 4000000
  • EIP-1559 transactions

    If you are using EIP-1559 type transactions, you need to set the --with-gas-price parameter to the network minimum basefee, using the following command to deploy the contract, e.g.

    forge script script/Deploy.s.sol:DeploySiege --sig "run()" --with-gas-price 20000000 --rpc-url <mantle_rpc_url> --broadcast -g 4000000