EVM Minimum Gas Price Calculation

Could someone from the protocol side of things share the calculation they used to determine what the EVM’s minimum gas price should be (currently set to 470 nAVAX in coreth)?

Context

The first PR I could find addressing min gas price increased the value from 47e-9 nAVAX to 47 nAVAX but only provides a hand-wavy “rejecting too-low-fee transactions from being added to our remote txpool” explanation (without going into what “too-low-fee” means). A follow-up PR that adjusts this value to 470 nAVAX provides even less context (just saying “TWEAK”). An unmerged PR related to the Apricot upgrade adjusts the min gas price from 470 nAVAX to 100 nAVAX without any explanation (I concluded this 100 nAVAX value comes from an issue someone posted about singleton contracts).

The reason I’m reaching out is that I’m concerned that the magnitude and frequency of these changes (merged with limited context) could frustrate and drive away developers. Not to mention that the high min gas price (470 nAVAX or even 100 nAVAX) appears to be much higher than other next-gen EVM-enabled competitors (in some cases, as high as a 1500x premium…math shown below).

I’m assuming this gas premium is related to ongoing tuning (stemming from research on spam prevention in a leaderless deployment of the EVM) rather than some substantial overhead incurred by processing transactions using Avalanche consensus.

Looking forward to learning more about your thinking!

Gas Price Comparison

Other EVM-compatible blockchains (like Celo) have a much smaller min gas price. For example, this transaction uses a gas price of 0.55 gwei:

0.55 gwei taken out of context doesn’t mean anything as it depends on the price of the token (as you are well aware) being used to pay for gas. However, a comparison of gas price in dollar terms shows that this gas fee on Celo is about ~1500x cheaper than AVAX:

Celo Fee/Gas (0.55 gwei): $0.0000000008525 (0.00000000055 * $1.53)
AVAX Fee/Gas (470 gwei): $0.0000013442 (0.00000047 * $2.86)

AVAX Premium: 1576.77x (0.0000013442/0.0000000008525)

Prices as of 12/29/2020

Related Links

47e-9 nAVAX -> 47 nAVAX:

47 nAVAX -> 470 nAVAX:

[Not yet merged] 470 nAVAX -> 100 nAVAX:

Discussion about 100 nAVAX min gas price:

2 Likes

The original PR, “rejecting fee too low…”, added fees at parity with the X chain. I.e. sending a regular value transfer transaction on the C chain would cost the same as an X or P chain transaction.

We later decided to tweak this based on the logic that x chain transactions are cheaper to process and it was decided to try 10x, 470.

I’m not aware of the specific reasons for the PR reducing the fee or what its status is; I’ve been working on a different project.

I generally don’t put policy decisions in commit messages. Messages should explain what the technical changes are, not why policy decisions are made.

Ahhhhhh gotcha. Thanks for that clarification!

Did you guys do any sort of public write up on this analysis or is it as simple as C-Chain transactions are roughly ~10x more expensive to process?

Appreciate you taking the time to reply, regardless!

Is there a place where the team records these policy decisions and links them to PRs/commits or are they based on internal conversations? I was looking for release notes and through the PR descriptions but didn’t find any context there either.

No, I don’t think there is a public place for those discussions and decisions, at least not until Avalanche governance is in place.

In any case, the gas price comparison that is important is a comparison with Ethereum gas price. Team is aiming to have orders of magnitude cheaper gas than on Ethereum.

How was the X-chain fee determined?

It was basically ‘let’s make it cheap’. Currently, fee structure is fixed, but dynamic transaction fees are on the roadmap.

It’s cheap-ish but it’s not cheap cheap. Now if C-chain is set as a function of X-chain transfers, maybe it needs to be reevaluated.