diff --git a/Gas_and_Fees_Obiajulu MAIN b/Gas_and_Fees_Obiajulu MAIN new file mode 100644 index 0000000..44ad006 --- /dev/null +++ b/Gas_and_Fees_Obiajulu MAIN @@ -0,0 +1,87 @@ +1. What is Gas in Ethereum? + +Gas is the unit that measures the computational work required to perform actions on the Ethereum blockchain. I think of gas as the fuel needed to power operations — whether; transferring ETH, interacting with smart contracts, or minting an NFT. +Every operation has a gas cost — and the more complex the task, the more gas is needed. +So in essence, + +> Gas = Computational effort needed +> Gas Fee = Gas used × Gas Price + +Now, for gas price. This is basically how much you're willing to pay per unit of gas, usually measured in gwei (1 gwei = 0.000000001 ETH). This is similar to saying, “I’m willing to pay ₦XX per litre of fuel.” even though I really don't bother about this, I just wait till Asian time and pay the fees. That was then though. +Higher gas prices mean your transaction will be processed faster, as miners/validators prioritize transactions with higher tips, I mean, even I would. + +-------------- + +2. What Did EIP-1559 Change? +Before EIP-1559 (introduced in August 2021 via the London Hard Fork), users would manually set their gas price, competing with others in a chaotic bidding war. Goodol days... This often caused overpaying or stuck transactions. This wasn't always funny whenever it happened though. +After-EIP-1559, there weren two Key Changes: + +i. Base Fee (Burned) + A mandatory minimum fee was now automatically calculated by the network based on demand and this fee is then burned (permanently removed from circulation), reducing ETH supply. Pretty deflationary if you ask me. + +ii. Priority Fee (Tip) + With this change, users now only add a small tip to incentivize miners/validators. Think of it as saying: “Here’s something extra if you process my request faster.” or better still, "take this one hold your side" + +The final result of this implementation was that, fees are more predictable, and ethereum now has a deflationary pressure due to burned base fees. + +Now check out this dope analogy to drive home my point... + +Imagine Ethereum is Lagos and making a transaction is like sending a delivery via bolt from mainland to island. + +* Gas Limit = How far or how hard the bolt driver will work (e.g., distance, weight of the delivery and time spent in hold up). + +* Gas Price = How much you're willing to pay per litre of fuel, or how much you’ll tip the bolt driver to drive James bond and get there fast. + +* Gas Fee = Total payment for the bolt ride (based on how far + how busy the road is). + +Now, before the EIP-1559 (pure chaos): +You had to haggle with the bolt guy yourself in the middle of Ojuelegba traffic. No set pricing. You're literally dragging with the bolt man. If you offered too little, he'll literally drive off, or accept another booking sharp sharp. + +But after EIP-1559 (where structure and order comes in): +Now there's a minimum price board set by LASTMA (like the network) that these bolt guys cannot exceed. That price is also burned (used up, not pocketed by bolt drivers). However, you can still give your bolt guy a small change (priority fee) to go faster, if nah your guy oooo, but you no longer overpay or get ignored randomly if there are too many customers and you don't have anything extra to give the bolt guy. + + +----------------- + +3. What is Slippage in DeFi? +Slippage is the difference between the expected price of a trade and the actual price you get when the trade executes. Usually a pain most times. +Now, this happens due to one of these three reasons: + +* Low liquidity + +* High volatility + +* Delayed transaction confirmation (especially in congested blocks) + +In DeFi, when you're swapping tokens — e.g., ETH for USDC on Uniswap — the price you see when you click “Swap”* might not be what you get when the transaction actually gets mined. More often than not, its lower. Like why can't slippage just make me something extra. +Anyways, the reason is because the market moved (due to other trades, price swings, or delays in processing your transaction). + +How Slippage Relates to Gas Prices; + +i. High Gas Fees = Slower Confirmations (if your gas tip is low) +If for instance, you were trying to save money and set a low priority fee, your transaction might sit in the mempool longer. And during that time, other traders (esp. bots and whales) will definitely front-run you, causing price changes before your swap goes through → leading to higher slippage. + +ii. Low Gas = Increased Vulnerability to MEV Bots +Sandwich attacks (where bots front-run and back-run your swap) can cause forced slippage. I mean you don't plan for a bunch of flash bots sneaking immediately past your transactions to buy and sell instantly, forcing you to buy higher or sell lower. These bots thrive in congested blocks where traders under-price their gas. + +iii. High Slippage Tolerance = Dangerous for Retail Users; +If you set a slippage tolerance of 10% trying to “just get it over with, I mean who doesn't”, you’re pretty much telling the smart contract: “As long as I get something back, even if it’s a bad deal, go ahead.” +So in high-demand blocks (e.g., during an airdrop claim, meme coin launch, degen trading or narrative pumps), gas and slippage go hand-in-hand, either you pay higher gas to get priority (lowering slippage risk) big boy style, or you cheap out on gas and risk price movement ruining your trade, brokie style. + + +Now here's another dope analogy for this; + +Imagine you enter Balogun Market, to change like 2 meter to dollar. The Aboki man now tells you it's ₦1,510/1$ right now. + +But, you now decide to go to the bank to withdraw the money and then add that of your friend that always does things at the last minute and end up delaying you for another 4 hours. By the time you return the aboki man now tells you that the rate has added #10 and is now #1,520/1$ + +> That ₦10 difference per dollar = Slippage. You got a worse rate because you didn’t act fast enough. + +Now, let’s say like 50 people are also trying to buy dollar at that same time (like a token launch on Ethereum), and everyone is shouting their own price you know everywhere just good for the aboki man. If you refuse to “settle” the guy you know, arrange small matter for him so he'll run yours sharp sharp, others will jump the queue asap. +By the time it reaches your turn, the rate might have gone up even more → worse slippage, or dollar would have finished. + +The "settlement" you give = Gas Tip (Priority Fee) remember from question 1 + +The changing rate due to market demand = Slippage + +The delay caused by stingy settlement = Congestion + MEV danger diff --git a/README.md b/README.md index 8111b5f..797d1f5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -### **Assignment: Gas and Fees + [Your Name]** +### **Assignment: Gas and Fees + Obiajulu** #### **Objective:** 1. Explain your understanding of **Gas and Fees** in Ethereum, including how **EIP-1559** changed the fee structure.