If you want to get the most out of the Web3 revolution, it’s vital to understand a little about crypto transaction fees. Also known as gas fees on some blockchains, setting the correct amount can help ensure speedy transaction confirmation and avoid overpaying to use a network.
This tutorial is all about crypto transaction fees. You’ll learn the relationship between gas fees and transaction settlement times, how different networks calculate fees, and why it’s sometimes expensive to use certain blockchains. We also include step-by-step guidance on setting gas fees for the more than 20 networks supported by the OKX Wallet. Let’s go!
What are crypto transaction fees?
Crypto transaction fees are additional payments made when you transfer digital assets from one wallet to another or interact with a smart contract on a network like Ethereum or OKC. The miner or validator that includes your transaction in a block receives all the fees in the block they add to the chain.
Without the correct fee, you'll wait a long time for the network to confirm your transaction. This is because most blockchains limit the amount of data they can fit in each block. When each miner or validator processes a block, they select the transactions that include fees that result in the most profit.
If there's a backlog of transactions paying a higher fee than yours, miners and validators will fill their blocks with other transactions, leaving yours waiting. On such occasions, you can wait for a lull in network activity or rebroadcast the transaction with a higher fee (most wallets support bumping fees in their user interface). If network congestion remains high, your transaction will eventually revert to your wallet, but this can take several hours or even days.
Cryptocurrency transaction fees are important because they:
Incentivize miners and validators to operate the hardware required to process crypto transactions.
Reduce network spam by financially disincentivizing it.
Determine the priority of transactions waiting to be confirmed (on most networks).
Can play an important role in monetary policy through burning circulating supply (see this in-depth article on Ethereum’s EIP-1559 upgrade for more information).
Are transaction fees calculated differently on different chains?
Transaction fees are calculated differently on different blockchains. With Bitcoin, transactions are simple, and fees are calculated according to current network congestion only.
With Ethereum, transactions can be much more complex. For example, minting an NFT is a more computationally intensive transaction than a simple ETH transfer between wallets. In this dedicated in-depth article, you can learn more about how the Ethereum network calculates gas fees and the issues high transaction fees can cause.
Both Bitcoin and Ethereum (and many other blockchain networks) use this auction-style fee model — the highest bidders win space for their transaction in the next block. This requires some guesswork on the user’s behalf, as they can never be exactly sure how congested the network will be when it receives their transaction.
Some networks take a different approach. Solana, for example, uses deterministic transaction fees to remove the guesswork from the process. The network itself sets the required fee using the number of digital signatures included in previous blocks and the number of signatures required for the transaction in question.
Solana is currently adding a local fee market for transactions in response to excessive network spam limiting genuine user transactions, particularly during market volatility. Under the proposed model, if a single application experiences a transaction volume surge, users can raise the fee paid to increase the likelihood of fast transaction confirmation. However, unlike Ethereum, the higher fee requirement will be isolated to those DApps experiencing high demand.
Prohibitive transaction fees are one of the biggest hurdles to cryptocurrencies’ mainstream adoption. As such, many smaller networks have also experimented with other methods of calculating fees.
Why do crypto transaction fees fluctuate, and what determines them?
Although there are subtle differences in how different chains calculate fees, more often than not, the network’s block limit, block time, and current transaction volume determine how much you will pay and how quickly a network confirms a transaction.
As mentioned, most blockchains follow the fee auction model introduced by Bitcoin. When there aren't enough waiting transactions to fill a block, the fee required to have a transaction confirmed is very low because even adding a low fee transaction makes more economic sense than not including it at all. When activity rises, and there are too many transactions to fill a block, the average transaction fee increases, and it becomes more expensive to use a network.
Block size and block time are crucial parameters. A network with large blocks can process more transactions per second than one with smaller blocks. Therefore, it takes many more transactions to create the backlogs that put upward pressure on transaction fees. The same applies to faster block times.
While lower transaction fees are obviously great for users with less available capital, it’s essential to consider how larger blocks and faster block times impact network decentralization. Processing and storing larger blocks requires more expensive computer hardware to run miners, validators, and full nodes. This immediately prices some would-be operators out, resulting in a smaller validator set and a more centralized network.
An excellent example is Bitcoin SV, which eventually aims to support terabyte blocks but has just 22 nodes operating (as of June 2022). Bitcoin, by contrast, has 4 MB blocks and more than 15,000 reachable nodes.
How do I set transaction fees in OKX Wallet and other crypto wallets?
OKX Wallet makes it easy to set transaction fees across each of the 22 public networks it supports. Currently, OKX Wallet can connect to the following blockchains:
Bitcoin
Ethereum
OKX Chain
BSC
Polygon
Avalanche
Fantom
Arbitrum
Litecoin
Bitcoin Cash
Tron
Ethereum Classic
Bitcoin SV
Zcash
ICON
DASH
DFK Chain
ARK
Nebulas
Solana
Optimism
Setting transaction fees is primarily the same, regardless of the network. Here’s how to do it.
Setting a crypto transaction fee with OKX Wallet
Before getting started, you'll need to set up and fund your OKX Wallet with crypto. If you need help, check these guides on creating an OKX Wallet and funding an OKX Wallet. This guide focuses on the OKX app experience. However, the process is similar for the OKX Wallet Web3 browser extension and similar products, such as MetaMask.
For this demonstration, we’ll do a simple OKC-based token swap transaction on the OKX decentralized exchange. However, the process is almost identical when buying an NFT from the NFT Marketplace, transferring tokens to our exchange or any other wallet, or interacting with smart contracts regardless of the network on which they’re deployed.
First, tap Wallet at the top of the OKX app home screen.
Then, tap Trade from the bottom menu.
Choose the network on which you want to perform your swap with the highlighted menu. We’re using the OKC network, but the fee-setting process will be the same regardless of your selection.
Enter your swap details. First, choose the assets being swapped and enter an amount. Then, tap Swap.
On the next screen, check the details and tap Confirm swap.
You’ll then see the details of your transaction, including your address, the contract being interacted with, and transaction amounts. You’ll also see the network on which you are transacting and the estimated network fee.
By default, the network fee will be set to “Average,” meaning that your transaction should be committed to a block within the next few blocks.
To edit your transaction fee, tap Network fee.
If your transaction is urgent, you can opt to pay a little more to increase the likelihood of an even faster settlement time. Alternatively, you can select a lower fee if your transaction isn't time-sensitive. With a lower fee, there's less incentive for miners or validators to include your transaction promptly. Therefore, you might wait a little longer for it to be fully confirmed.
Tap Slow, Average or Fast to set your transaction fee. There's also the option to customize your fee. We’ll cover this in more detail at the end of this tutorial.
Tap Confirm, and on the next screen, enter your password and tap Confirm again.
You’ll receive two notifications at the top of the screen. The first will confirm that you've submitted your transaction. The second will appear when your transaction has been completed.
Depending on the network used, its current traffic, and the size of the transaction fee included, it might take a little while for your transaction to confirm.
Setting a custom fee in OKX Wallet
More-advanced users might benefit from setting custom transaction fees for certain transactions. If the network is experiencing high traffic and you know there's about to be a further surge — perhaps coinciding with a hyped NFT drop, for example — you might choose to increase your transaction fee beyond OKX Wallet’s default “Fast” setting.
Less-experienced users should generally avoid using custom transaction fee settings. Submitting a transaction with an enormous gas price or incorrect gas limit can result in drastically overpaying for fees or the transaction failing.
To set a custom transaction fee in OKX Wallet, tap Customize from the transaction fee menu.
A window will open in which you can enter your custom parameters. “Gas Price” refers to the amount you're willing to pay per unit of gas required to complete your transaction. “Gas Limit” refers to the number of gas units you are including as your transaction fee. “Gwei” is 1 billion of the smallest units of several cryptocurrencies, including ETH. It's common to denominate gas fees in gwei.
The “Gas Limit” field will fill automatically with the number of gas units required for the contract interaction you are making. There's little reason for a non-developer or highly experienced user ever to edit the gas limit.
Raising the gas price will increase your chances of having your transaction included quickly. Adding a custom gas price can be particularly useful when a network is experiencing high demand and you absolutely need your transaction confirmed immediately.
For example, if you had taken a loan using a DeFi application and your collateral suddenly devalues, you might urgently need to supply more to avoid liquidation. Increasing the gas price offered makes it more profitable for validators and miners to process your transaction and, therefore, speeds it up.
Enter your custom parameters in the relevant fields and tap Save.
Your custom transaction fee will appear on the “Contract Interaction” screen. Tap Confirm, enter your password, and tap Confirm again. You’ll receive notifications informing you that your transaction has been submitted and later confirmed.
Understand gas fees and step up your Web3 game
At first, gas fees might seem confusing, but once you understand their role in incentivizing miners and transaction validators, they make a lot more sense.
Typically, each validator must wait a long time between opportunities to add a block to the chain. When they do, they usually receive a block reward of the blockchain’s newly minted native coins and all fees included with every transaction they add. Therefore, they attempt to maximize their gains by including only those with the highest fees.
When a network is experiencing high transaction volume, people increase their fees to ensure their transaction is confirmed quickly. This puts upward pressure on the average fee and, eventually, results in all users paying more to use the network. Users who submitted a low-fee transaction might have to wait a long time before their transaction confirms or reverts, or resubmit it with a higher fee.
By understanding transaction fees, you can ensure your transaction doesn’t get stuck like this and feel more confident when taking advantage of the many opportunities Web3 presents. Game on!
© 2024 OKX. This article may be reproduced or distributed in its entirety, or excerpts of 100 words or less of this article may be used, provided such use is non-commercial. Any reproduction or distribution of the entire article must also prominently state: “This article is © 2024 OKX and is used with permission.” Permitted excerpts must cite to the name of the article and include attribution, for example “Article Name, [author name if applicable], © 2024 OKX.” No derivative works or other uses of this article are permitted.