We do a little learning
We do a little learning

Subscribe to 0xhubman.eth

Subscribe to 0xhubman.eth

Account Abstraction - Part 2
Welcome back to part 2 of the Account Abstraction (AA)! Last post we covered the concept of AA, the benefits of AA, and the infrastructure needed to utilize SCAs in the manner proposed by ERC-4337. This week we'll take a look under the hood and discuss how ERC-4337's components actually interact with each other to make AA a reality. You'll remember that every transaction that occurs on Ethereum currently requires an EOA to initiate the transaction (by signing the transaction with a private ke...

Stablecoins
For this post, we'll be diving into one of the crypto industry's most popular use cases - stablecoins. As of November 2023, USDT and USDC, the two biggest stablecoins by market cap, have a combined market cap of ~$110 billion within the crypto industry's entire $1.48 trillion market cap. However, this rise in popularity of stablecoins has not come without its controversies. If you've spent any amount of time following or participating in the crypto industry, you've no doubt seen the barrage o...

Nostr
Tired of the Twitter/X drama? Don't know what the heck Mastodon is or how to use it? Do you like ostriches? Well then there is a protocol for you! In this post, we'll actually be veering off the blockchain-specific beaten path and delving into an exciting protocol that can best be described as crypto-adjacent - the Nostr protocol! Nostr (short for Notes and Other Stuff Transmitted by Relays) is an exciting protocol that aims to be a fully fleshed out decentralized social network and so much m...

Account Abstraction - Part 2
Welcome back to part 2 of the Account Abstraction (AA)! Last post we covered the concept of AA, the benefits of AA, and the infrastructure needed to utilize SCAs in the manner proposed by ERC-4337. This week we'll take a look under the hood and discuss how ERC-4337's components actually interact with each other to make AA a reality. You'll remember that every transaction that occurs on Ethereum currently requires an EOA to initiate the transaction (by signing the transaction with a private ke...

Stablecoins
For this post, we'll be diving into one of the crypto industry's most popular use cases - stablecoins. As of November 2023, USDT and USDC, the two biggest stablecoins by market cap, have a combined market cap of ~$110 billion within the crypto industry's entire $1.48 trillion market cap. However, this rise in popularity of stablecoins has not come without its controversies. If you've spent any amount of time following or participating in the crypto industry, you've no doubt seen the barrage o...

Nostr
Tired of the Twitter/X drama? Don't know what the heck Mastodon is or how to use it? Do you like ostriches? Well then there is a protocol for you! In this post, we'll actually be veering off the blockchain-specific beaten path and delving into an exciting protocol that can best be described as crypto-adjacent - the Nostr protocol! Nostr (short for Notes and Other Stuff Transmitted by Relays) is an exciting protocol that aims to be a fully fleshed out decentralized social network and so much m...
Share Dialog
Share Dialog
<100 subscribers
<100 subscribers


Have you ever tried to submit a transaction on Ethereum mainnet and wondered "why is the gas so expensive"? If so, you've come to the right place. This post's focus is all on 'Gas' as it relates to blockchain transactions and how gas fees are calculated under the hood.
In its most basic form, gas is a unit of account that measure the computational effort required to perform specified actions on a blockchain. Gas is needed to perform transactions, regardless of the blockchain's consensus mechanism (i.e., Proof of Work, Proof of Stake, etc) or throughput ability. So as the name implies, gas used for blockchain transactions is similar in nature to how gasoline is used to power a car.
Gas is normally (but not always) denominated and paid for in a blockchain's native token, such as BTC for Bitcoin, ETH for Ethereum, MATIC for Polygon, AVAX for Avalanche, FTM for Fantom, etc. For the purposes of this post, we'll focus on Ethereum gas fees. To calculate gas fees for a transaction on Ethereum mainnet, there are specific inputs used for the calculation: gas units (limit), gas price (gwei), gwei converter, and the price of Ether. Below are additional details on each input.
Gas Units (Limit) - Typically, certain functions on the Ethereum blockchain require a certain amount of 'gas units'. For example, to transfer ETH between two wallet addresses, that typically requires 21,000 gas units. 21,000 is the limit for how many gas units could be used for this transaction.
Gas Price (Gwei) - Gas price is the amount of gwei you pay per gas unit. For reference, gwei is to Ethereum, as satoshis are to Bitcoin, as cents are to dollars. So if the gas limit is 21,000 to transfer ETH and the gas price is 60 gwei, you would perform the following calculation: 21,000 * 60 = 1,260,000 gwei
Gwei Converter - this input converts the amount of gwei you pay per transaction into the equivalent amount of Ether that will be deducted from your wallet. The gwei converter is equal to 0.000000001 ETH. So continuing the calculation: 1,260,000 * 0.000000001 = 0.00126 ETH. So you gas fee in terms of ETH is 0.00126 ETH.
Price of Ether (USD) - This step is optional, but it converts your gas fee into USD terms. Say the price of Ether is $1800 USD, so to finalize our calculation : 0.00126 * 1800 = 2.268 USD.
In summation, It would will cost a user $2.268 (0.00126 ETH) to transfer ETH between 2 wallet addresses with the assumptions above. In reality, these inputs are constantly changing and most wallet browser extensions and mobile applications calculate these costs in near real-time as new blocks are validated on Ethereum and the inputs change. In addition, when interacting with smart contracts, gas fees are typically much more expensive since the smart contract is executing multiple functions within a single transaction and requires many more gas units (sometimes as high as multiple 1,000,000s of gas units).
Digging deeper for a moment, this is just how you calculate gas fees on Ethereum mainnet (L1). If you remember an earlier blog post , L2 rollups on Ethereum such as Optimism and Arbitrum have gained immense popularity due to sharing the security of Ethereum but having lower gas fees (relative to Ethereum mainnet). To calculate gas fees on L2s, you would take the above inputs and perform the calculation for both L1 (this is called the data security fee) and L2 (this is called the execution fee) and add them together. The calculations for determining the execution fee on L2s are constantly changing as new updates are deployed to these networks, but typically the execution fee is substantially cheaper than the data security fee.
If you would like to fall further down this rabbit hole, below are a few resources to continue your descent.
Extra Credit: Etherscan Transaction feed - click on any transaction and see if you can identify the relevant inputs and back into the gas fee paid by the user!
Until next time!
Have you ever tried to submit a transaction on Ethereum mainnet and wondered "why is the gas so expensive"? If so, you've come to the right place. This post's focus is all on 'Gas' as it relates to blockchain transactions and how gas fees are calculated under the hood.
In its most basic form, gas is a unit of account that measure the computational effort required to perform specified actions on a blockchain. Gas is needed to perform transactions, regardless of the blockchain's consensus mechanism (i.e., Proof of Work, Proof of Stake, etc) or throughput ability. So as the name implies, gas used for blockchain transactions is similar in nature to how gasoline is used to power a car.
Gas is normally (but not always) denominated and paid for in a blockchain's native token, such as BTC for Bitcoin, ETH for Ethereum, MATIC for Polygon, AVAX for Avalanche, FTM for Fantom, etc. For the purposes of this post, we'll focus on Ethereum gas fees. To calculate gas fees for a transaction on Ethereum mainnet, there are specific inputs used for the calculation: gas units (limit), gas price (gwei), gwei converter, and the price of Ether. Below are additional details on each input.
Gas Units (Limit) - Typically, certain functions on the Ethereum blockchain require a certain amount of 'gas units'. For example, to transfer ETH between two wallet addresses, that typically requires 21,000 gas units. 21,000 is the limit for how many gas units could be used for this transaction.
Gas Price (Gwei) - Gas price is the amount of gwei you pay per gas unit. For reference, gwei is to Ethereum, as satoshis are to Bitcoin, as cents are to dollars. So if the gas limit is 21,000 to transfer ETH and the gas price is 60 gwei, you would perform the following calculation: 21,000 * 60 = 1,260,000 gwei
Gwei Converter - this input converts the amount of gwei you pay per transaction into the equivalent amount of Ether that will be deducted from your wallet. The gwei converter is equal to 0.000000001 ETH. So continuing the calculation: 1,260,000 * 0.000000001 = 0.00126 ETH. So you gas fee in terms of ETH is 0.00126 ETH.
Price of Ether (USD) - This step is optional, but it converts your gas fee into USD terms. Say the price of Ether is $1800 USD, so to finalize our calculation : 0.00126 * 1800 = 2.268 USD.
In summation, It would will cost a user $2.268 (0.00126 ETH) to transfer ETH between 2 wallet addresses with the assumptions above. In reality, these inputs are constantly changing and most wallet browser extensions and mobile applications calculate these costs in near real-time as new blocks are validated on Ethereum and the inputs change. In addition, when interacting with smart contracts, gas fees are typically much more expensive since the smart contract is executing multiple functions within a single transaction and requires many more gas units (sometimes as high as multiple 1,000,000s of gas units).
Digging deeper for a moment, this is just how you calculate gas fees on Ethereum mainnet (L1). If you remember an earlier blog post , L2 rollups on Ethereum such as Optimism and Arbitrum have gained immense popularity due to sharing the security of Ethereum but having lower gas fees (relative to Ethereum mainnet). To calculate gas fees on L2s, you would take the above inputs and perform the calculation for both L1 (this is called the data security fee) and L2 (this is called the execution fee) and add them together. The calculations for determining the execution fee on L2s are constantly changing as new updates are deployed to these networks, but typically the execution fee is substantially cheaper than the data security fee.
If you would like to fall further down this rabbit hole, below are a few resources to continue your descent.
Extra Credit: Etherscan Transaction feed - click on any transaction and see if you can identify the relevant inputs and back into the gas fee paid by the user!
Until next time!
No activity yet