Skip to content

Gas Fees Pricing for EVM Gateway Node Operators

Jan Bernatik edited this page May 2, 2025 · 3 revisions

Configuration

As of v1.0.5 release, EVM Gateway Node Operators can use the --gas-price CLI flag, to set the minimum acceptable gas price for EVM transactions coming through the eth_sendRawTransaction endpoint.

The configured gas price for each EVM Gateway node, can be retrieved through the relevant JSON-RPC endpoint:

curl -s -XPOST 'https://testnet.evm.nodes.onflow.org' -H "Content-Type: application/json" --data-raw '{"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":7}'

which returns:

{
  "jsonrpc": "2.0",
  "id": 7,
  "result": "0x5f5e100"
}

For transactions that do not meet this minimum gas price, the EVM GW node will return an error such as:

the minimum accepted gas price for transactions is: 100000000

and it will reject the transaction.

The relevant condition for this logic can be found here: https://github.com/onflow/flow-evm-gateway/blob/v1.0.5/services/requester/requester.go#L233-L235

EVM Transaction Types

Let us explain how this --gas-price CLI flag applies to the various EVM tx types.

Legacy transactions

For legacy transactions (where Txn type: 0), users simply specify only the GasPrice tx payload field when signing a tx. Usually this is done automatically by the wallet.

One such example can be found here: https://evm.flowscan.io/tx/0xdff38d783472e79e8ce969da1bf3e302ca2217536ab35c72007e3902351d5ac9 .

We have:

Gas price = 0.000000000105 FLOW (0.105 Gwei)
Gas usage = 694,467
Transaction fee = Gas price * gas usage = 0.000000000105 * 694,467 = 0.000072919035 FLOW

Dynamic fee transactions

For dynamic fee transactions (where Txn type: 2) things get a bit more complicated, because Flow EVM, as a chain/network, does not fully support EIP-1559.

The baseFee is always set to 0, see more: https://github.com/onflow/flow-go/blob/b06c18e6c33e6d6ebb346fe67889df7168a5f1a4/fvm/evm/emulator/config.go#L105-L106 .

This was mainly done to allow EVM transactions from the Cadence API (either EVM.run or COA interactions), to execute even with a 0 gas price, to allow subsidizing tx fees. However, the Flow account submitting the outter Cadence transaction, would pay for both Flow fees & EVM fees.

That being said, to enable the 3rd party tools & wallets of the Ethereum ecosystem, we worked around that, to allow dynamic fee transactions.

One such example can be found here: https://evm.flowscan.io/tx/0x2ffde77752873c484954e45645d84a701b64a3ae4384740e50bde55a1e8470d5 .

We have:

Base = 0.000000001
Max = 0.100000001
Max priority = 0.1

Where Base is actually picked up from the latest EVM block:

curl -s -XPOST 'https://testnet.evm.nodes.onflow.org' -H "Content-Type: application/json" --data-raw '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x2b1ec78",false],"id":7}'

Which returns:

{
  "jsonrpc": "2.0",
  "id": 7,
  "result": {
    "number": "0x2b1ec78",
    "hash": "0xafcc8b3fe140bcd4ee149057daa979f22e24b47fa59db407d3c9fdc73d4cbb7a",
    "parentHash": "0x181bc68d19a54927e7f0e72cf197bf0d392aea06b78a51731d2860fed98ffa02",
    "nonce": "0x0100000000000000",
    "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
    "logsBloom": "0x...",
    "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "stateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "miner": "0x0000000000000000000000030000000000000000",
    "difficulty": "0x0",
    "totalDifficulty": "0x0",
    "extraData": "0x",
    "size": "0xc6",
    "gasLimit": "0x7270e00",
    "gasUsed": "0x0",
    "timestamp": "0x681499c4",
    "transactions": [],
    "uncles": [],
    "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "baseFeePerGas": "0x1"
  }
}

The "baseFeePerGas": "0x1" key/value pair, basically is a signal to 3rd-party tools / wallets, that the chain supports EIP-1559 transactions.

This value is currently hard-coded on EVM GW level, and not configurable. Maybe we should add a CLI flag to allow node operators to toggle it on & off.

The Max field is the max amount of gas fees the user is willing to pay, including the baseFee. The Max priority field is the tip offered by the user, so that miners will be more incentivized to include their tx in the next block.

Wallets will usually make use of the eth_maxPriorityFeePerGas JSON-RPC endpoint, to decide on the value to use for the Max priority. The EVM GW uses the configured --gas-price CLI flag, for the return value of this endpoint:

curl -s -XPOST 'https://testnet.evm.nodes.onflow.org' -H "Content-Type: application/json" --data-raw '{"jsonrpc":"2.0","method":"eth_maxPriorityFeePerGas","params":[],"id":7}'

Which returns:

{
  "jsonrpc": "2.0",
  "id": 7,
  "result": "0x5f5e100"
}

The same exact value as for the eth_gasPrice JSON-RPC endpoint, as we showed above, in the Configuration section.

To calculate the effective gas price out the Max & Max priority values, the formula is:

price = Min(GasTipCap, GasFeeCap) when baseFee = 0

GasTipCap is the Max priority value and GasFeeCap is the Max value (as shown in flowscan). That is why flowscan shows:

Gas price = 0.0000000001 FLOW (0.1 Gwei)

for the example above, because that is the minimum value between Max & Max priority.

Context: The BaseFeePerGas on EVM GW, was hard-coded to 1, to solve the following issue:

Clone this wiki locally