How is gasPrice determined in Frontier EVM?

I found the following settings in the Frontier/template/src/runtime/lib.rs

impl pallet_evm::Config for Runtime {
    type FeeCalculator = BaseFee;
    type GasWeightMapping = FixedGasWeightMapping;
    type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;
    type CallOrigin = EnsureAddressTruncated;
    type WithdrawOrigin = EnsureAddressTruncated;
    type AddressMapping = HashedAddressMapping<BlakeTwo256>;
    type Currency = Balances;
    type Event = Event;
    type PrecompilesType = FrontierPrecompiles<Self>;
    type PrecompilesValue = PrecompilesValue;
    type ChainId = EVMChainId;
    type BlockGasLimit = BlockGasLimit;
    type Runner = pallet_evm::runner::stack::Runner<Self>;
    type OnChargeTransaction = ();
    type FindAuthor = FindAuthorTruncated<Aura>;

impl pallet_base_fee::Config for Runtime {
    type Event = Event;
    type Threshold = BaseFeeThreshold;
    type DefaultBaseFeePerGas = DefaultBaseFeePerGas;
    type DefaultElasticity = DefaultElasticity;

Can I modifiy fn weight_to_gas(weight: Weight) to always return zero?

How can I set it up so there is no charge when certain accounts make certain Ethereum contract transactions?

1 Answer 1


Option 1: Make precompiles for all the EVM functions that need to be gasless. When Ethereum users call those precompile functions, they will see 0 ETH gas cost on their MetaMask.

Also, Moombean has a lot of precompiles written already like ERC20, staking, etc...

Option 2: Checkout ERC20-Permit developed by OpenZeppelin and Solmate for gasless token transfer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.