Savings
GasHawk helps you save gas fees. But what does that actually mean?
Fee model
When a transaction following EIP-1559 is created, it includes a max_fee_per_gas
field. This corresponds to the blocks base_fee_per_gas
price, which varies with demand. The transaction cannot be included in any block where the block's base_fee_per_gas
is higher than the transaction's max_fee_per_gas
.
So, in order to allow inclusion of the transaction in one of the following blocks, Metamask suggests a max_fee_per_gas
setting that is higher than the last observed block's base_fee_per_gas
.
The current base fees can be observed here.
Calculation of savings
After a transaction has been sent through GasHawk and mined, GasHawk provides an estimation of the savings achieved. These are derived as follows:
fee_saved = fee_reference - fee_paid
where:
- fee_reference = (base_fee_reference + prio_fee) * gas_used
- base_fee_reference: base_fee_per_gas of the first block that has been mined after the transaction had been handed to GasHawk
- prio_fee: the miner tip, which GasHawk has no influence on
- fee_paid = (base_fee_paid + prio_fee) * gas_used
- base_fee_paid: base_fee_per_gas of the block that includes the transaction
With this in mind, let's define the relative savings as:
savings = fee_saved/fee_reference = 1 - fee_paid/fee_reference
The GasHawk Dasboard displays fee_reference as "Regular TX cost" and fee_paid
as "GasHawk TX cost". Savings are displayed as a percentage.
GasHawk performance
GasHawk will save on most transactions, but also cause some transactions to pay more fees than they would have without using GasHawk. The following graph shows a distribution of savings during a simulation run:
The data is cut off manually at -100% because the maximum loss that can occur in reality in capped (see 'Maximum loss' below).
Some insights from this analysis, most of which can be read from the graph as well:
- Roughly 10% of transactions will incur losses.
- The vast majority of transactions will save 25% or more.
- Only very few transactions save more than 75%.
- Maximum savings are > 80%.
- On average, transactions save 40% or more.
How losses occur
One subsystem of GasHawk predicts future fees. GasHawk bases its decisions on these predictions. If the prediction is off, GasHawk might find itself in a situation with rising fees that have already surpassed the fee_reference
. In this case, GasHawk will still send the transaction either at the least bad time or simply once the deadline occurred.
Maximum loss
When preparing and signing the transaction, metamask includes the max_fee_per_gas
field, and informs the user about "Max fee" (see screenshot below). This is the highest fee that can ever be paid when the transaction is mined. GasHawk can never change this. This means that GasHawk can never cause you to pay more than the fee you agreed to when signing the transaction with Metamask.
The included max_fee_per_gas
might be below current base fee once GasHawk forwards the transaction to the mempool. In this case, mining of the transaction will be delayed and the transaction will stay in the mempool. It will be mined once base_fee_per_gas is equal or below max_fee_per_gas again. Theoretically, the transaction can even be dropped from the mempool after a while. We have never seen this happen, though.