All Collections DeFi Wallet
ETH & ERC-20 Tokens
What is Nonce, Gas Price and Gas Limit?
What is Nonce, Gas Price and Gas Limit?

Brief description of Nonce, Gas Price and Gas Limit

Hrisi avatar
Written by Hrisi
Updated over a week ago

What is “Nonce”?

A nonce is the number of the transaction of the sender’s address. Every transaction from an address is numbered sequentially, beginning with 0 for the first transaction. For example, if the nonce of a transaction is 10, it is the 11th outgoing transaction sent from the sender’s address.

The nonce is essential to take note of especially if you perform multiple transactions using the same address. The Ethereum network works in a way that a transaction with a lower nonce will be processed first before any other, thus if you have a problem with an earlier transaction, the ensuing transaction will not be included in the blockchain until the one with the lower nonce is successfully included.

What is “Gas Price” & “Gas Limit”?

Your estimated network fee for transacting ETH/ERC20 tokens on the Ethereum Blockchain is basically calculated by multiplying the “Gas Price” with “Gas Limit”.

“Gas Price” is the amount of Gwei that the user is willing to spend on each unit of Gas. The unit of “Gas Price” is called Gwei and 1 Gwei is equivalent to 0.000000001 Ether.

The sender sets a limit and a gas price for each transaction. To independently calculate the total cost of a commission for a transaction in Ether, it is necessary to multiply the gas limit by its price. For example, if the gas limit is 21,000 units and the gas price is 100 Gwei, the total network fee paid is:

21,000 gas x 100 Gwei = 2,100,000 Gwei = 0.0021 ETH

The gas used for executing a contract is different from one contract to another. It is recommended to check the previous transactions from the contract address and to expect a little more while setting gas limits during a transaction involving a contract.

On the DeFi Wallet app, for your convenience, we have configured the gas limit based on the various smart contracts and buffered a little more in case of the “Out of Gas” failed transaction. For sending ERC20 tokens, the gas limit is usually around 200,000-250,000 units while a swap or deposit/withdrawal via DeFi Earn could take around 400,000-600,000 gas limit units - the more complex a smart contract is, the higher the gas limit is required to execute the smart contract transaction.

Did this answer your question?