Today I bought an NFT piece of art from my brother – a generative EnsÅ. I minted #198. It’s cool.
Being my first high priced Ether (ETH) smart contract, I was surprised by the fees. I’m used to blockchain transactions that are inexpensive. Anything over a couple dollars annoys me. Paying $25 – $100 as a transaction fee seemed ridiculous. Regardless, I needed to dig in to see what’s going on. That’s when I fell down a deep DeFi rabbit hole, and came out understanding how gas prices and gas fees work on the Ethereum network. It’s actually pretty simple.
I usually just focused on the Gas price since I was just moving coins around on the blockchain and the limit was pre-set at the minimum gwei. The sub-units of ETH are named to honor the people who contributed to Ethereum’s development (not what I would do, but OK). 1 gwei is 0.000000001 ETH – pretty small.
If you want to execute a smart contract, like buying an NFT for example, it takes more computing power than simply moving coins. Miners validating and executing the blockchain have to do more effort so it costs more. That’s where the gas limit comes in.
The easiest analogy I can think of is driving your car somewhere. Let’s say I live in North Carolina and want to drive to Chicago. It’s about 800 miles. My vehicle gets 31 MPG on the highway, so that’s about 26 gallons of gas needed.
For ETH transactions the Gas limit is similar to how many gallons of gas it takes to get the job done. In this example, 26 gallons to get me to Chicago.
Since these are blockchain executions, you don’t want to change the gas limit. That would be like me filling 25 gallons of gas and thinking I’ll get to Chicago. I won’t.
The gas price is pretty self explanatory now. It is how much each unit (gallon in my analogy) costs. I need 26 gallons and I’m in a hurry. I’ll pay whatever it costs at the nearest gas station all along my trip. This would be like paying a ‘Fast’ price. You can check the current ETH gas prices here to see what I mean about speed. If I wasn’t in a hurry, and because I’m cheap when able, I’d hunt around for a good deal on gas and pay a ‘slow’ price. It would be slower. It would take longer to get to Chicago. Now if I was pulling a Cannonball run to Chicago I could have people set up along the way to fill my vehicle with the absolute minimum amount of time lost. This would be like the ‘instant’ price. It costs more, and it’s very fast!
In the end the price for the transaction is how much power you need to get it done which is the Gas limit (gallons of gas) multiplied by the cost of the power which is Gas price (cost per gallon).
What I did was wait until the price of Gas fell. That allowed me to buy the NFT for about $25 in Gas fees instead of nearly $100.