The London upgrade of August 2021 modernized Ethereum’s transaction process and fee mechanism by creating a quicker route for the addition of transactions to blocks. It lets users pay a mandatory fee for inclusion (called base fee).
What Are Transactions?
Ethereum transactions are to understand are cryptographically signed instructions that are initiated from one Ethereum account to another. Ethereum transactions change the state of the Ethereum network.
There are 2 types of accounts on the Ethereum blockchain: Externally Owned Accounts (EOA) which are controlled by private keys and can initiate transactions that involve the transfer of ETH, and Contract Accounts that are controlled by codes and can only perform transactions in response to initiation from an EOA.
The simplest types of Ethereum transactions are the ones between Externally-Owned Accounts.
For Ethereum transactions to be valid, they need to be signed by the sender’s private key, submitted to the nodes that propagate it to the rest of the network. The transaction is picked by miners, sorted out in the transaction pool, added to a block by a miner, and propagated again to the network.
A submitted transaction needs to have the following information to be considered by a node:
1). Recipient’s Address:
This is the receiving address.
This is provided by the sender with their private key. It confirms that the sender authorized the transaction.
This is the amount of ETH to be transferred. If it is a contract transaction where the instruction can be to vote for a candidate, the value is 0.
4). Gas Limit:
This is the maximum amount of gas price that can be consumed by the transaction. Some wallet providers set this limit automatically.
For simple transactions, the gas limit is 21,000 gas. For more complex transactions, the gas limit can go as high as 100,000 gas.
Gas limits are set to avoid the transaction fees from draining the ETH account.
5). Max Priority Fee Per Gas:
This is also called a tip. It is the optional fee the sender pays as a tip to the miner.
6). Max Fee Per Gas:
This is also called gas price. It is the maximum amount of gas a sender is willing to pay for a transaction, with tip and gas limit included.
It is calculated as gas limit × (base fee + tip).
The base fee is the mandatory and algorithmically determined fee a sender pays for the inclusion of a transaction into a block. It is calculated by the network based on the demand for block space.
This is the number of transactions that have been sent from an account.
Types Of Ethereum Transactions
1). Normal Transactions:
These are transfers between Externally-Owned Accounts. They require a signature from private keys.
2). Internal Transactions:
They are also called ‘messages.’ They are transactions triggered from an EOA to a smart contract. They are irreversible, traceable, and are performed off-chain without the use of a cryptographic signature.
3). Token Transactions:
These are transfers of ERC-721 tokens (NFTs).
Ethereum Transaction Life Cycle
1). Transaction is created:
An Ethereum transaction is created when a user sends assets from their wallet address to another wallet or contract address. The transaction is signed with the sender’s private key and submitted to the blockchain.
2). Node verification and transaction ID:
The node confirms that the transaction has a valid signature, that all required information (like to and from addresses, value, gas limit) are included, that the address balance covers the value, that the sender address is from an EOA and not a Contract account, and that the gas limit is below the block limit.
A transaction ID (also called transaction hash or tnx hash) is cryptographically assigned to the transaction. The transaction ID helps the user to track the status of the transaction on block explorers like Etherscan.
3). Transaction is added to the pool:
If the transaction passes the node checks, it is added to the node’s transaction pool. The node also broadcasts the transaction to other nodes which perform their checks and add it to their transaction pool.
A transaction pool (also called Mempool or txpool) is a data structure containing a set of transactions that have been verified by the node and are ready to be added to the next block.
Transactions in this pool are also called pending transactions.
Queued transactions are transactions that are waiting to become pending transactions. They are transactions that have a nonce that is not in sequence.
A nonce indicates the total number of transactions that an account has executed. Every time a transaction is initiated by an account, the nonce value is increased by 1 with the first transaction having a nonce of 0.
If an account has previously performed 2 transactions and for its third transaction the sender manually sets the nonce as 3 (instead of 2), the transaction will get a status of ‘queued’ while it waits for the account to initiate a transaction with nonce 2 before moving into the pending status.
A queued transaction will not be propagated to the network until the nonce is corrected.
In contrast, if the nonce of a transaction is lower than the sender’s transaction count (for instance, if the third transaction carries a nonce of 1), the transaction is not queued but discarded.
4). Transaction is added to a block:
Miners pick up the transaction and add it to a block. This stage determines how long the transaction would take.
If your gas fee is higher than the recommended gas fee and your transaction is taking longer than normal, chances are that the network traffic is congested. When traffic is congested, miners prioritize transactions with higher gas fees meaning that low gas fee transactions would be stuck in the pending status.
To fasten a pending transaction in network congestion, resubmit the transaction with the same nonce but a higher gas price. The new transaction overwrites your previous transaction and moves it up in the mempool. This increases the chances of getting it picked by miners.
If you resubmit the transaction with a different nonce value, the pool considers them as two different transactions.
5). Block confirmation number:
Block confirmation number is the number of blocks that have been processed after the block your transaction was included in. This helps wallet and exchanges platforms to confirm that the block with your transaction is valid.
Different platforms require different minimum block confirmation numbers. For instance, Binance requires a minimum of 12 block confirmation numbers. Meaning that 12 blocks have to be processed after the block with your transaction before the transferred asset would reflect in the receiver’s wallet.
Reasons For Failed Transactions
1). Insufficient balance in the sender’s account.
2). Higher transaction gas limit than block gas limit.
3). Wrong signature.
4). Out of gas:
This occurs when the gas limit set by the sender is lower than the required gas (computational cost) needed to perform the transaction.
When a transaction is marked as ‘failed’, the funds you attempted to send remain in your account but the gas fee is deducted. This is because while the miners couldn’t successfully send your transaction, some amount of computational cost was exerted while trying.
ERC-20 token transfer may fail if the token contract is locked or if the sending account has an insufficient token balance.
To minimize failed transactions, use the gas limit suggested by the wallet or exchange provider for each of your transactions.
If a transaction is marked as ‘reverted’, both the gas fee and the funds intending to be sent are reversed back to the sender’s account.
Can I Stop An Ethereum Transaction?
To cancel a pending transaction, send 0 ETH with a higher gas fee but the same nonce value as the transaction you want to cancel (the to and from address should also be the same).
This new transaction will replace the old transaction, and since the new transaction is sending 0 ETH, no ETH will be transferred.
A successful transaction cannot be reverted. This is because the Ethereum blockchain is built as immutable.
Other Terms In Ethereum Transactions
1). Gwei And Wei:
Gwei means giga-wei, it equals 1 billion wei.
Gwei is a small unit of ETH that is used to denote gas fees. 1gwei = 0.000000001 ETH. Instead of saying your gas fee is 0.000000001 ETH, you can say your gas cost 1 gwei.
Gwei is sometimes called Shannon, Nano Ether, or Nano.
2). Block Explorers:
Block explorers are the google of blockchains. They serve as portals to Ethereum data, providing this data in a searchable format.
Block explorers let users track blocks (including block heights), uncle blocks (blocks that are created when two miners solve the cryptographic puzzle at the same time. Only one of these blocks is validated by the node but both miners get a reward for work), gas, transaction history, account (including ETH balance), smart contracts, and tokens.
Block explorers also let users track the status of transactions: if it is successful, pending, reverted, or failed.
All of this information is provided in a table format. An example of an explorer is Etherscan.
3). Block Height:
Block height is a measure of the number of blocks that have been created on the blockchain before the block in question.
Every block has a distinct block height value. For instance, the first block on the blockchain (called genesis block) has a block height value of 0 because no block was created before it, the next block after the genesis block will have a block height value of 1.
Block height is an indication of the length of the blockchain.
Position is the number of transactions mined in a block.
Since Ethereum Virtual Machine (EVM) plays a major role in the Ethereum blockchain, it is important to have a programming language that is executable by this virtual machine.
EVM bytecode is a low-level programming language that is compiled from a high-level programming language (like Solidity).
High-level programming level (Solidity)
Bytecode (low-level programming level)
The smart contract code is written in a high-level programming language, to be executed by the EVM, the code is compiled to EVM bytecode (a low-level programming language) and deployed to the Ethereum blockchain.
Ethereum Transaction starts as an initiation from an Externally-owned account followed by verification by nodes, selection by miners, addition into a block, and a confirmation number.
Pending transactions can be modified by resubmitting the transaction with the same nonce value and a higher gas fee or canceled by sending 0 ETH with the same nonce value and a higher gas fee. If you are looking to learn even more about Ethereum transactions work you should check the Ethereum White paper.
Emmanuella Elenbalu is the Content Manager at Coinsem. She is passionate about cryptocurrency, investment, and learning new things.