Introduction to Transactions
Transactions are cryptographically signed instructions initiated from an account on the Ethereum network. They serve as the primary mechanism for updating Ethereum's state, with the simplest form being a transfer of ETH between two accounts.
Prerequisites
To fully grasp this guide, we recommend familiarizing yourself with:
What Constitutes an Ethereum Transaction?
An Ethereum transaction represents an action initiated by an externally owned account (controlled by humans rather than smart contracts). For instance, when Bob sends Alice 1 ETH, the transaction:
- Debits Bob's account by 1 ETH
- Credits Alice's account by 1 ETH
- Results in a state change across the network
Key Components of a Transaction
Every transaction contains these critical elements:
from- Sender's address (must be an external account)to- Recipient address (can be an external account or smart contract)signature- Cryptographic proof of sender authorizationnonce- Sequential counter tracking transaction ordervalue- Amount of ETH transferred (denominated in Wei)input data- Optional field for arbitrary informationgasLimit- Maximum computational units allocatedmaxPriorityFeePerGas- Validator tip (priority fee)maxPriorityFeePerGas- Maximum fee per gas unit
👉 Learn more about gas optimization strategies
Transaction Types
Ethereum supports several transaction formats:
1. Regular Transfers
- Basic ETH transfers between accounts
- Requires 21,000 gas units
Example structure:
{ "from": "0xEA674fdDe714fd979de3EdF0F56AA9716B898ec8", "to": "0xac03bb73b6a9e108530aff4df5077c2b3d481e5a", "value": "10000000000", "gasLimit": "21000", "maxFeePerGas": "300", "maxPriorityFeePerGas": "10" }
2. Contract Deployment
- Contains no
toaddress - Uses
input datafor contract code - Requires higher gas limits
3. Contract Execution
- Interacts with deployed smart contracts
- Targets contract address in
tofield - Includes call data in
inputfield
The Data Field Demystified
Smart contract interactions encode function calls in the data field:
- First 4 bytes: Function selector hash
- Remaining bytes: ABI-encoded parameters
Example breakdown:
0xa9059cbb - transfer(address,uint256)
0000000000000000000000004f6742badb049791cd9a37ea913f2bac38d01279 - Recipient
000000000000000000000000000000000000000000000000000000003b0559f4 - Amount (990206452)Transaction Lifecycle
- Creation: Cryptographic hash generation
- Broadcast: Propagation to network nodes
- Pool Inclusion: Added to mempool
- Validation: Miner selection and block inclusion
- Finalization: State confirmation through block finality
Gas Mechanics Explained
Every transaction consumes computational resources measured in gas:
- Simple transfer: 21,000 gas
- Complex operations: Higher gas requirements
- Unused gas is refunded
👉 Advanced gas fee management techniques
Typed Transaction Envelopes (EIP-2718)
Modern Ethereum supports multiple transaction formats:
| Type | Name | Introduced By | Key Features |
|---|---|---|---|
| 0x0 | Legacy | Original | Pre-EIP-1559 |
| 0x1 | Access List | EIP-2930 | Access lists |
| 0x2 | EIP-1559 | London Upgrade | Dynamic fees, base fee |
FAQ Section
What happens if my transaction runs out of gas?
The operation reverts, but you still pay for consumed computation.
How long does a transaction take to process?
Typically 15-30 seconds, but varies with network congestion.
Can I cancel a pending transaction?
Yes, by sending a replacement with higher fees.
Why do gas fees fluctuate?
Demand for block space varies based on network activity.
What's the difference between gas limit and gas price?
Limit: Maximum units you allow. Price: Cost per unit.
How are smart contract calls different from transfers?
They require more gas and can modify blockchain state.
Conclusion
Mastering Ethereum transactions involves understanding:
- Cryptographic signing
- Gas economics
- Data encoding
- Network propagation
- State changes
For developers, this knowledge is fundamental to building effective dApps and managing on-chain operations efficiently.