ControlxFreak / XmasLootBox

Merry Christmas! Welcome to the 2022 Discord Christmas NFT Loot Box Advent Calendar!
1 stars 0 forks source link

Maybe increase the priority gas fee? #20

Closed ControlxFreak closed 1 year ago

ControlxFreak commented 1 year ago

Since this is fake money anyway... might as well make the tip massive so we can guarantee that our transaction will be included in the next block.

Would speed things up significantly.

Only problem is I don't know what value to make it and I don't know how to get the base gas from the previous blocks.

e.g.,

    'maxPriorityFeePerGas': w3.toWei(100, 'gwei'),
    'maxFeePerGas': w3.toWei(125, 'gwei')

but IDK if 25 gwei is enough for the base gas fee or if we have to estimate it or something.

ControlxFreak commented 1 year ago

After working through the math a bit...

On average it looks like executing the "mint4NFTs" function takes around 415k wei in gas.

Base fees have been ranging from 20 - 100 Gwei. Lets just estimate 50 Gwei which I think is reasonable on average (i.e., 50e9 wei) ref

image

image

Lets say that I have ~5 eth to burn over the course of this event.

I expect around ~200 transactions during the event.

That means I can afford: 5/200 eth/transaction or, 2.5e16 Wei/transaction.

The post London merge gas equation is:

gas = gas_spent * (base_fee + priority_tip)

Based on the above, we can afford a priority tip:

priority_tip = gas / gas_spent - base_fee

priority_tip = 2.5e16 / 415e3 - 50e9 = 10240963855 (i.e., 10 Gwei)

That means I can afford a priority_tip of around 10 Gwei/tx and after 200 transactions, I'd spent my full 5 eth (assuming every base_fee = 50Gwei, which sometimes will be more, but most times will be much less).

I don't know how it is on test net, but even during peak times this seems to be more than enough to guarantee a fast/instant spot in a block.

image

ControlxFreak commented 1 year ago

Lets up it to a priority of 10 Gwei with a max of 200Gwei. I think that will work just fine and be quicker than the default values.

ControlxFreak commented 1 year ago

Also - in order for that math to work, I'll need to collect 5 eth from faucets before the event 😨