What is Ethereum Transaction?
An Ethereum transaction is essentially a signed set of instructions from one account to another. One user makes a transaction in order to affect a change on the Ethereum network, such as the transfer of funds or a function within an app.
There are two types of accounts in the Ethereum network: Externally-Owned Account (EOA) and Contract Account. An Externally Owned Account is an individual user in the external world. And a contract account is owned by a contract code deployed on the network.
Transactions that change the state of the Ethereum network are disseminated to the whole network to notify nodes. Any node in the network can announce a request for a transaction to be carried out on the network; after this happens, a miner will execute the transaction and share the changed state with the rest of the network. Ethereum transactions require a fee which is known as the gas fee and must be mined to become a valid transaction.
Anatomy of a Transaction
An Ethereum transaction includes the following details:
- Sender: This is the account making a transaction. It is a 20-byte address representing the account initiating this transaction.
- Receiver: The recipient of this transaction. It is also a 20-byte address.
- Value: The amount of fund in Wei (1 ether = 10¹⁸ weis) to be transferred from “From” to “To”. If “To” is an EOA, it is simply a fund transfer. If “To” is a Contract Address, it is the number of funds passed to the deployed contract.
- Signature – the identifier of the sender. This is generated when the sender’s private key signs the transaction and confirms the sender has authorised this transaction
- Data – an optional field to include random data
- Gas Limit – the highest amount of gas units that can be consumed by the transaction.
- Max Priority Fee Per Gas – the highest amount of gas to be included as a tip to the miner.
- Max Fee Per Gas – the highest amount of gas willing to be paid for the transaction (this includes baseFeePerGas and maxPriorityFeePerGas)
- Gas: This represents the computation required to process the transaction by a miner. Users have to pay a fee for this computation.
Ethereum Transaction Lifecycle
Once a transaction is initiated, the following happens:
Cryptography generates a transaction hash which looks like this:
The transaction is then announced to the network and included in a pool with several other transactions. A miner then takes your transaction and include it in a block to verify the transaction and consider it “successful”. You may end up waiting for some moments in this stage if the network is busy and miners aren’t able to keep up.
Your transaction will receive “confirmations”. The higher the number of confirmations, the greater the certainty that the network processed and recognised the transaction.