- The amount of ether required for a user to interact with the network.
- Crypto that's paid to nodes on the blockchain to process a transaction.
- Used to compensate miners for the energy required to verify a transaction providing a layer of security
- Gas is the term for the amount of ether (ETH) – the native cryptocurrency of Ethereum – required by the network for a user to interact with the network.
- Gas is the amount of crypto that's paid to nodes on the blockchain to process a transaction.
- These fees are used to compensate Ethereum miners for the energy required to verify a transaction and for providing a layer of security to the Ethereum network by making it too expensive for malicious users to spam the network.
Ethereum is not the only blockchain with gas fees, it’s just the most expensive.
Why does this exist? Well, there's a couple major limitations when it comes to running smart contracts:
- Every deployed transaction, smart contract, or execution of a smart contract, must be run on every single full node on the Ethereum blockchain to guarantee validity. This is wildly inefficient (though newer blockchains are streamlining this)!
- Because smart contracts are Turing complete, they can potentially execute forever, locking up every single node on the blockchain.
- The London Upgrade was implemented on August 5th, 2021, to make transacting on Ethereum more predictable for users by overhauling Ethereum's transaction-fee-mechanism.
- The high-level benefits introduced by this change include better transaction fee estimation, generally quicker transaction inclusion, and offsetting the ETH issuance by burning a percentage of transaction fees.
- Starting with the London network upgrade, every block has a base fee, the minimum price per unit of gas for inclusion in this block, calculated by the network based on demand for block space.
- As the base fee of the transaction fee is burnt, users are also expected to set a tip (priority fee) in their transactions. The tip compensates miners for executing and propagating user transactions in blocks and is expected to be set automatically by most wallets.
Gas units (limit) * (Base fee + Tip)
- "Gas limit": Refers to the maximum amount of gas (or energy) that you're willing to spend on a particular transaction
- Base fee: The minimum price per unit of gas for inclusion in this block, calculated by the network based on demand for block space.
- Tip: The tip compensates miners for executing and propagating user transactions in blocks and is expected to be set automatically by most wallets.
- For Ethereum, gas is measured in gwei (1 gwei = 0.000000001 ether). You can visit What Is Ethereum? for a recap on how Ethereum works.
Calculating the total transaction fee works as follows:
Gas units (limit) * (Base fee + Tip)
- Let's say Jordan has to pay Taylor 1 ETH. In the transaction, the gas limit is 21,000 units and the base fee is 100 gwei. Jordan includes a tip of 10 gwei.
- Using the formula above we can calculate this as
21,000 * (100 + 10) = 2,310,000 gweior 0.00231 ETH.
- When Jordan sends the money, 1.00231 ETH will be deducted from Jordan's account. Taylor will be credited 1.0000 ETH. Miner receives the tip of 0.00021 ETH. Base fee of 0.0021 ETH is burned.
- Additionally, Jordan can also set a max fee (
maxFeePerGas) for the transaction. The difference between the max fee and the actual fee is refunded to Jordan, i.e.
refund = max fee - (base fee + priority fee). Jordan can set a maximum amount to pay for the transaction to execute and not worry about overpaying "beyond" the base fee when the transaction is executed.
- Gas is higher if many people are trying to get their transactions in.
- Gas is higher if your transaction is complex (e.g., minting an NFT vs. sending crypto to another wallet).
The trade-off to paying less gas on Ethereum is longer transaction times. If you’re OK with that, here are 3 ways to pay less gas:
1. Wait for lower gas prices
Gas prices are usually lowest on the weekends between 9 PM and 1 AM PST when America is getting ready for bed and Europe is just waking up.
You can visit Etherscan’s gas tracker to check current and historical gas prices:
2. Set a max gas fee
On Metamask, you can set your gas fee to “Low” before confirming a transaction. If you want to save even more gas, click on Advanced Options. In this tab, you can set the max fee to slightly above the 7 day lowest historical gas price from Etherscan chart.
Setting a low max gas fee means that your transaction might take a full day to process. You can always check the transaction status in Metamask’s Activity tab or on Etherscan.
3. Cancel a transaction
You can cancel a pending transaction if you change your mind or want to wait for lower gas fees. The easiest way to do this is to tap “Cancel” in Metamask next to a transaction.
However, if this doesn’t work, you can cancel the transaction in an even more manual way:
- Enable Custom Nonce in advanced settings of your MetaMask wallet.
- Send 0 ETH to yourself with the same custom nonce number as your last transaction.
Yes, we know this feels like configuring a dial-up modem. Hopefully wallet UX improves soon!
- If you want to stay in the Ethereum ecosystem, consider a chain like Polygon. Polygon is a sidechain compatible with Ethereum that lets you buy, sell, and mint NFTs for less than $0.01 USD per transaction.
- To perform Polygon transactions, you need to bridge ETH to Polygon and get some MATIC (Polygon’s token that can be used to pay for gas). Here’s a step by step guide:
Step 1: Bridge ETH to Polygon on OpenSea
Bridging is just a fancy word for transferring some ETH from Ethereum mainnet to the Polygon sidechain. You can use OpenSea to bridge ETH to Polygon as follows:
- Make sure you have some ETH in your wallet.
- Visit OpenSea and tap on the wallet icon to connect your wallet.
- Tap on the wallet icon again, tap the … next to your ETH, and tap “Bridge to Polygon”
- In the pop-up, choose how much ETH you want to bridge and tap “Convert tokens”
- You’ll be prompted to sign the transaction in your wallet. Note that you’ll need to pay gas here.
- The bridging process usually takes 5-10 minutes. Once successful, you should see Polygon ETH show up in your wallet.
Step 2: Get some MATIC
You need some MATIC to pay for gas on Polygon.
- Make sure you bridged some ETH to Polygon WETH successfully.
- Visit Polygon wallet and tap Swap for gas token on the left nav
- Select 1 MATIC or a custom amount and tap Approve.
Step 3: Browse Polygon NFTs
Now that you have Polygon ETH and MATIC, you can visit OpenSea and filter for Polygon NFTs.
We expect that many NFT transactions will move to Ethereum L2 solutions (see What is Ethereum) and other L1 chains (e.g., Solana, Avalanche) in the near future due to lower gas fees and better bridging processes.
- Gas prices are only really a problem on Ethereum L1 vs. other L1 and L2 chains like Solana or Polygon.
- If your goal is to learn about web3, consider doing your transaction on another L1 or L2 chain to pay less gas. For example, you can buy NFTs on Solana from marketplaces such as Solanart, Magic Eden, and Solsea.