diff --git a/Gas_and_Fees_Barakah Alim.adoc b/Gas_and_Fees_Barakah Alim.adoc new file mode 100644 index 0000000..df8f10e --- /dev/null +++ b/Gas_and_Fees_Barakah Alim.adoc @@ -0,0 +1,38 @@ +1. What is Gas? Describe its purpose in Ethereum transactions. +Gas is the unit used to measure how much a computational effort it takes to perform an action on (Ethereum) blockchain network. +Gas is the fuel that powers Ethereum. It is a critical element in keeping Ethereum secure and processing transactions. Gas helps in many ways: + + +2. EIP-1559: Explain how it reformed gas fees (base fee, priority fee, burning mechanism). +Before EIP-1559, gas fees were a chaotic guessing game—users would overpay just to get their transactions mined quickly. EIP-1559 brought calm to the storm by introducing a **predictable, dual-fee model**: +Base fee a fee set by the network that has to be paid for a transaction +Priority fee: an optional tip to incentivise node operators to include your transaction +Max Fee:The max amount you're willing to pay (covers both base and tip), but you’ll only be charged what’s needed + +3. Slippage: Define it and how it relates to gas prices (e.g., in swaps or high-demand blocks). +Sippage is the price you are willing to pay as your gas fees. The amount that you are willing to pay as your fee for your Ethereum transaction. Slippage occurs when the gas price changes before a transaction is mined, causing higher costs + +Here’s how it ties into gas: + +* If your transaction is stuck behind others with higher gas prices, you might miss your ideal execution price—causing slippage. +* In DEXs (Decentralized Exchanges), slippage tolerance is often set to allow small price changes. If gas delays your transaction too long, prices can move beyond your set tolerance, causing the swap to fail or cost more. + + +Relation to Gas: + +Low gas fees → slower transaction confirmation → higher risk of slippage. +High gas fees → faster processing → lower slippage risk. +DEX users often set a "slippage tolerance" (e.g., 1%) to prevent excessive loss. If the price changes beyond this, the trade fails. + +Example: +Let’s say you want to swap ETH for USDC. You set: + +* Gas limit = 21000 +* Max fee = 100 gwei +* Base fee = 50 gwei +* Priority fee = 30 gwei +Actual fee used: +50 (base) + 30 (tip) = 80 gwei +Unused max: 20 gwei refunded + +If gas prices spike to 80 gwei mid-swap and your max is still 100, you’re good. But if it goes to 120 and you don’t increase it, the transaction could fail or be delayed—and boom, **slippage** hits.