Ethereum calldata is the read-only data attached to an Ethereum transaction. It is commonly used to tell a smart contract which function to execute and provide the input values needed for that function.
In simple terms, calldata is information sent along with a transaction to a smart contract.
For example, when you swap tokens on a decentralized exchange, your transaction contains calldata that tells the smart contract what operation to perform, which tokens to swap, and how much to swap.
Calldata is an important part of Ethereum because it allows users and applications to communicate with smart contracts.
How Does Ethereum Calldata Work?
When you interact with a smart contract, your transaction can contain several pieces of information, including:
- The recipient contract address
- The amount of ETH being sent
- Gas settings
- The transaction nonce
- Calldata
The calldata contains encoded information that the smart contract can interpret.
A simplified example might look like:
0xa9059cbb...
The first part of the encoded data generally identifies the smart contract function being called, while the remaining data contains the function’s arguments.
Ethereum uses ABI encoding (Application Binary Interface) to encode this information.
What Is Calldata Used For?
Calldata is primarily used to provide input to smart contracts.
Common examples include:
Sending Tokens
When you use an ERC-20 token’s transfer() function, calldata contains information such as:
- Recipient address
- Number of tokens to transfer
Swapping Tokens
When swapping tokens on a decentralized exchange, calldata can specify:
- Token you are selling
- Token you want to receive
- Amount
- Minimum acceptable amount
- Recipient
- Other transaction parameters
Calling Smart Contract Functions
Decentralized applications use calldata whenever they need to execute functions on smart contracts.
Is Ethereum Calldata Stored on the Blockchain?
Yes. Ethereum transaction calldata is included in the transaction data recorded on the blockchain.
This is one reason calldata is important for Ethereum’s storage and scaling costs.
Unlike Ethereum’s temporary blob data introduced through EIP-4844, traditional calldata becomes part of the permanent blockchain history.
That distinction is especially important when comparing Ethereum calldata vs. blob data.
Is Calldata Permanent?
Traditional Ethereum calldata is part of the historical transaction data and is therefore considered persistent blockchain data.
Ethereum nodes and other blockchain infrastructure can retain this historical information.
Blob data works differently. Blobs introduced through EIP-4844 are designed to be temporary.
Why Does Ethereum Charge for Calldata?
Calldata consumes resources.
More calldata means more data that Ethereum’s network must process, propagate, and historically retain.
Ethereum therefore charges gas for transaction data.
Generally:
More calldata → more gas required → higher transaction cost
This is particularly important for Layer 2 rollups that need to publish large quantities of transaction data to Ethereum.
How Much Does Ethereum Calldata Cost?
Ethereum calldata is priced according to the gas cost of the transaction data.
Historically, Ethereum has charged different gas amounts for zero and non-zero calldata bytes:
- Zero byte: 4 gas
- Non-zero byte: 16 gas
These values are associated with Ethereum’s calldata gas pricing rules and can change through protocol upgrades.
For users, the important concept is that larger calldata generally means higher gas consumption.
What Is Calldata in an Ethereum Transaction?
An Ethereum transaction can contain a data field.
For transactions interacting with smart contracts, this field commonly contains the encoded calldata.
For example:
To: 0xContractAddress
Value: 0 ETH
Data: 0x...
The Data portion contains the encoded function call and its arguments.
Calldata vs Ethereum Storage
Calldata and contract storage are very different.
| Feature | Calldata | Contract Storage |
|---|---|---|
| Purpose | Pass data to a contract | Store contract state |
| Read-only? | Yes | No |
| Permanently part of transaction history? | Yes | Yes |
| Used for function inputs? | Yes | Not primarily |
| Gas cost | Relatively low | Much more expensive |
| Can contract modify it? | No | Yes |
One important point is that calldata is not Ethereum smart contract storage.
It is input supplied to a transaction.
Calldata vs Memory
Ethereum smart contracts also use memory, but it serves a different purpose.
Calldata is external input supplied with a transaction.
Memory is temporary working space used while a smart contract executes.
For example:
User
↓
Transaction
↓
Calldata
↓
Smart Contract
↓
Memory / Storage
Calldata is read-only, while memory can be modified during execution.
Calldata vs Blob Data
This distinction has become particularly important since Ethereum’s Dencun upgrade.
| Feature | Calldata | Blob Data |
|---|---|---|
| Introduced | Original Ethereum transaction mechanism | EIP-4844 |
| Storage | Persistent blockchain history | Temporary |
| Primary use | Smart contract inputs and data | Layer 2 data availability |
| Cost | Higher for large datasets | Designed to be cheaper |
| Smart contracts can directly read it | Yes | No |
| Main scaling role | Limited | Important for rollups |
Calldata is permanent transaction data, while blob data is temporary data designed primarily for Layer 2 scaling.
Why Did Ethereum Introduce Blob Data?
Before EIP-4844, Layer 2 rollups commonly relied heavily on calldata to publish transaction data to Ethereum.
As Layer 2 adoption increased, this could become expensive.
EIP-4844 introduced blobs as a more cost-efficient way for rollups to make large amounts of data available.
This created a useful division:
Calldata → general transaction and smart contract input
Blobs → temporary data availability for rollups
Can You See Ethereum Calldata?
Yes.
Blockchain explorers such as Etherscan allow users to inspect the input data associated with transactions.
If you open a smart contract transaction, you can often find an Input Data or similar field containing the encoded calldata.
You can then decode it using ABI information to understand which function was called and what parameters were supplied.
Frequently Asked Questions
What is calldata in Ethereum?
Ethereum calldata is read-only data attached to a transaction and sent to a smart contract. It usually contains the function being called and the function’s input parameters.
Is calldata stored on Ethereum?
Yes. Calldata is included in Ethereum transaction data and forms part of the blockchain’s historical transaction record.
Is Ethereum calldata permanent?
Traditional calldata is persistent transaction history, unlike EIP-4844 blob data, which is designed to be temporary.
Does calldata cost gas?
Yes. Ethereum charges gas for transaction data, and larger calldata generally requires more gas.
Can smart contracts modify calldata?
No. Calldata is read-only. A smart contract can read the data supplied to it but cannot modify the original calldata.
What is the difference between calldata and blob data?
Calldata is persistent transaction data that smart contracts can read. Blob data is temporary data introduced by EIP-4844 primarily to provide cheaper data availability for Layer 2 rollups.
What is the difference between calldata and storage?
Calldata provides input to a smart contract, while storage holds the contract’s persistent state. Storage is significantly more expensive to modify than calldata.
Why is calldata important for Ethereum Layer 2?
Layer 2 rollups can publish transaction information to Ethereum using calldata. However, because calldata contributes to transaction costs and permanent blockchain history, EIP-4844 introduced blobs as a more scalable alternative for rollup data.
Bottom Line
Ethereum calldata is the read-only data included in a transaction that provides information to a smart contract. It is commonly used to specify which function should run and what parameters should be passed to that function.
The easiest way to remember it is:
Calldata is the information you send to a smart contract along with a transaction.
Understanding calldata is also important for understanding Ethereum gas fees, smart contract transactions, Layer 2 rollups, and the difference between calldata and blob data.