Free 30-min Web3 Consultation
Book Now
Smart Contract Security Audits
Learn More
Custom DeFi Protocol Development
Explore
Full-Stack Web3 dApp Development
View Services
Free 30-min Web3 Consultation
Book Now
Smart Contract Security Audits
Learn More
Custom DeFi Protocol Development
Explore
Full-Stack Web3 dApp Development
View Services
Free 30-min Web3 Consultation
Book Now
Smart Contract Security Audits
Learn More
Custom DeFi Protocol Development
Explore
Full-Stack Web3 dApp Development
View Services
Free 30-min Web3 Consultation
Book Now
Smart Contract Security Audits
Learn More
Custom DeFi Protocol Development
Explore
Full-Stack Web3 dApp Development
View Services
LABS
Glossary

Call Data

Call data is the immutable, transaction-specific payload containing the encoded function signature and arguments sent to a smart contract on the Ethereum Virtual Machine (EVM).
Chainscore © 2026
definition
BLOCKCHAIN GLOSSARY

What is Call Data?

A precise technical definition of the data payload in an Ethereum transaction or smart contract call.

Call data is the encoded input data field of an Ethereum transaction, containing the instructions for a smart contract interaction, such as the function to call and its arguments. When a user or a contract initiates a transaction, the data field (often referred to as calldata) carries the low-level ABI-encoded information that specifies which contract function to execute and with what parameters. This payload is critical for all non-simple value transfers, as it is the primary mechanism for invoking smart contract logic on the Ethereum Virtual Machine (EVM).

The structure of call data is strictly defined by the Ethereum Application Binary Interface (ABI) specification. It typically begins with a 4-byte function selector—a hash of the function's signature—followed by the encoded arguments. For example, a call to a function transfer(address,uint256) would have its selector followed by the 32-byte address and 32-byte amount. This encoding is deterministic, allowing both the sender and the receiving contract to correctly interpret the instructions. Call data is read-only from the perspective of the executing contract; it is a non-modifiable input stored in a dedicated area of the EVM's memory.

Understanding call data is essential for gas optimization and security. As a non-zero byte in call data costs 16 gas and a zero byte costs 4 gas (post-EIP-2028), efficient encoding can reduce transaction costs. Furthermore, because it is the direct input to contract logic, malformed or malicious call data is a common attack vector, making proper validation and decoding a cornerstone of secure smart contract development. Tools like Ethers.js and web3.py provide libraries to correctly encode and decode this data for developers.

how-it-works
BLOCKCHAIN MECHANICS

How Call Data Works

An explanation of the technical mechanism for transmitting function calls and their arguments in an Ethereum Virtual Machine (EVM) transaction.

Call data is the encoded payload of an Ethereum transaction that specifies which smart contract function to execute and the arguments to pass to it. It is a hexadecimal string prefixed by a function selector—a 4-byte hash of the function's signature—followed by the ABI-encoded parameters. This data field is critical for all interactions that change state on the blockchain, as it is the primary input for the EVM to determine the execution path within a smart contract. For simple value transfers (e.g., sending ETH), the call data field is typically left empty.

The structure of call data is strictly defined by the Ethereum Application Binary Interface (ABI) specification. When a user initiates a transaction through a wallet, development libraries like ethers.js or web3.js handle the encoding. For example, a call to a function transfer(address to, uint256 amount) is encoded by first computing the selector from the function signature and then appending the 32-byte encoded values for the to address and the amount. This raw hexadecimal data is what gets signed by the sender's private key and broadcast to the network.

From a network perspective, call data is a major factor in determining gas costs. Since the Calldata operation (CALLDATALOAD, CALLDATACOPY) consumes gas and the data itself is stored permanently on-chain, larger call data payloads increase transaction fees. Notably, in post-London upgrade Ethereum, call data bytes are priced differently than other data, with a cost of 16 gas per zero-byte and 4 gas per non-zero byte, incentivizing efficient data packing. This makes the optimization of call data a consideration for developers designing gas-efficient smart contracts and applications.

Analyzing call data is fundamental for blockchain explorers, indexers, and security tools. By decoding the hexadecimal string using a contract's ABI, these services can present human-readable interpretations of transactions, showing the called function name and the decoded argument values. This transparency is key for auditing and understanding on-chain activity. Furthermore, protocols that utilize meta-transactions or account abstraction often place signed user instructions within call data, enabling complex relayed operations without the user needing ETH for gas.

key-features
BLOCKCHAIN GLOSSARY

Key Features of Call Data

Call data is the primary mechanism for passing information to smart contracts on the Ethereum Virtual Machine (EVM). These cards detail its core technical characteristics and functions.

01

Function Selector Encoding

The first 4 bytes (8 hex characters) of call data specify the function selector, a unique identifier for the target function within the smart contract. It is derived by taking the Keccak-256 hash of the function's signature (e.g., transfer(address,uint256)) and taking the first 4 bytes. This allows the EVM to route the call to the correct contract logic.

  • Example: The selector for transfer(address,uint256) is 0xa9059cbb.
02

ABI-Encoded Arguments

Following the function selector, the remaining call data contains the ABI-encoded arguments for the function. The Ethereum ABI Specification defines a strict encoding format for all data types (addresses, integers, arrays, structs). Arguments are padded to 32-byte words and concatenated in order.

  • Example: Calling transfer(0xabc..., 100) encodes the address and the 256-bit integer into 64 bytes of data after the selector.
03

`msg.data` & Calldata Variables

Within a smart contract, the full, immutable call data is accessible via the global variable msg.data. Function parameters marked with the calldata data location are read-only pointers directly into this data, making it the most gas-efficient way to reference external input for reference types (arrays, structs). Modifying calldata is not permitted.

04

Gas Cost & Optimization

Call data is a major factor in transaction gas costs. Non-zero bytes in call data cost 16 gas, while zero bytes cost 4 gas (post-EIP-2028). This incentivizes efficient encoding, such as using smaller integer types and packing data. Techniques like function signature shortening and data compression are used to minimize calldata size in layer-2 rollups to reduce costs.

05

Use in Contract Interactions

Call data is the payload for all types of contract interactions: direct calls (CALL, STATICCALL), delegate calls (DELEGATECALL), and transaction construction. Wallets and libraries (like ethers.js and web3.py) automatically handle ABI encoding to generate correct call data from high-level function calls.

06

Distinction from `input` vs `data`

In Ethereum transaction objects and receipts, this field is named input. In RPC calls (e.g., eth_call) and internal EVM execution contexts, it is referred to as data or calldata. These terms are often used interchangeably to describe the same payload: the immutable input data sent to a contract's bytecode.

code-example
CALL DATA

Code Example & Encoding

This section details the technical representation and structure of transaction data, focusing on the `calldata` field as the primary mechanism for passing function calls and arguments in Ethereum.

In Ethereum, calldata is a read-only byte array that contains the data passed with a transaction, specifically the encoded function selector and arguments for a smart contract call. It is a critical component of the Ethereum Virtual Machine (EVM) execution environment, accessible via the CALLDATALOAD, CALLDATASIZE, and CALLDATACOPY opcodes. This data field is non-persistent and is a key factor in determining gas costs, as storing data in calldata is significantly cheaper than using contract storage or memory for certain operations.

The encoding of calldata follows the Contract ABI Specification. The first four bytes are the function selector, a hash (typically keccak256) of the function's signature (e.g., transfer(address,uint256)). The subsequent bytes are the arguments, encoded according to strict rules: fixed-length types like uint256 and address are padded to 32 bytes, while dynamic types like string or bytes include an offset pointer and length data. This deterministic encoding allows contracts and external tools to reliably decode transaction intent.

A practical example is a call to a token's transfer function. The function signature transfer(address,uint256) hashes to a selector like 0xa9059cbb. For arguments to=0x1234... and value=1e18, the encoded calldata would be: 0xa9059cbb + 000...01234 (32-byte padded address) + 000...00de0b6b3a7640000 (32-byte padded amount). This hexadecimal string is what appears in the input field of an Ethereum transaction. Developers commonly use libraries like ethers.js or web3.py to handle this encoding and decoding automatically.

Understanding calldata is essential for gas optimization. Using calldata for function parameters, especially with external functions, is cheaper than using memory because it avoids a copy operation. This is why you often see function signatures like function processData(bytes calldata data) external. Furthermore, protocols like EIP-4337 (Account Abstraction) and layer-2 scaling solutions heavily utilize calldata for posting transaction data on-chain, making its efficient use and cost structure a primary concern for developers.

gas-cost-considerations
CALL DATA

Gas Cost Considerations

Call data is a critical component of Ethereum transactions that directly impacts gas fees. Understanding its structure and cost drivers is essential for optimizing smart contract interactions.

01

What is Call Data?

Call data is the immutable, read-only input data field of an Ethereum transaction, used to pass arguments and function selectors to a smart contract. It is stored permanently on-chain and is a primary factor in transaction gas costs, as it consumes gas for every non-zero byte (16 gas) and zero byte (4 gas).

02

Cost Breakdown: Zero vs. Non-Zero Bytes

The EVM charges different amounts for data stored in call data:

  • Non-zero byte: Costs 16 gas.
  • Zero byte: Costs 4 gas. This pricing incentivizes data compression and the use of zero bytes (like padded arguments) to reduce costs. For example, an address (20 bytes) costs 320 gas, while a uint256 value of 0 costs only 4 gas per zero byte.
03

The Calldata vs. Memory Distinction

In Solidity, function parameters marked as calldata are read directly from the transaction input, avoiding a costly copy to memory. Using calldata for arrays and structs in external functions is a key optimization, as writing to memory consumes additional gas. Parameters for public and internal functions are always in memory.

04

Optimization Techniques

Developers optimize call data to minimize gas:

  • Argument Packing: Using smaller data types (uint8 vs uint256) and bit-packing multiple values into a single word.
  • Function Signature Choice: Selecting shorter, less common function names to reduce selector collision and data size.
  • EIP-1559 & Blobs: Post-London upgrade, call data is part of the base fee. With EIP-4844, large data batches can move to cheaper blob storage for L2s.
05

Impact on Layer 2 Scaling

Call data cost is a major bottleneck for Layer 2 rollups (Optimistic & ZK), as they batch transactions and post this data to Ethereum L1. High L1 call data costs directly increase L2 fees. Solutions like EIP-4844 (Proto-Danksharding) introduce blob-carrying transactions to provide a dedicated, low-cost data space for rollups, decoupling their cost from mainnet execution gas.

EVM DATA LOCATIONS

Call Data vs. Memory vs. Storage

A comparison of the three primary data storage locations in the Ethereum Virtual Machine (EVM), detailing their purpose, cost, mutability, and lifecycle.

FeatureCall DataMemoryStorage

Primary Purpose

Read-only function arguments

Temporary data during execution

Persistent state on-chain

Location

Transaction payload (external)

EVM runtime memory

World state (on-chain database)

Gas Cost (Read)

Lowest (calldataload)

Low (mload)

Highest (sload, ~2100 gas)

Gas Cost (Write)

Not writable

Low (mstore)

Very High (sstore, ~20,000 gas initial)

Persistence

Persists in transaction only

Cleared after function call

Persists between transactions

Mutability

Immutable (read-only)

Mutable within function scope

Mutable (state updates)

Data Scope

External function parameters

Local function variables

Contract state variables

Access Scope

Public/external functions

Current execution context

Entire contract lifetime

ecosystem-usage
CALL DATA

Ecosystem Usage & Best Practices

Call data is the encoded function signature and arguments sent with a transaction, enabling smart contract execution. This section details its practical applications and optimization strategies.

01

Gas Optimization & Cost Reduction

Call data is a primary driver of transaction gas costs on EVM chains. Optimizing it is critical for user experience and protocol efficiency.

  • Zero-Knowledge Rollups (ZK-Rollups): On L2s like zkSync and StarkNet, call data is compressed and posted to Ethereum L1 in batches, where its cost is the main L1 fee component.
  • Calldata vs. Storage: Reading from calldata is cheaper than reading from contract storage or memory, making it the preferred location for function input parameters.
  • Data Packing: Using smaller data types (e.g., uint128 instead of uint256) and bit-packing multiple values into a single word reduces byte size and gas.
02

Function Dispatch & The ABI

The first 4 bytes of call data are the function selector, a hash of the function signature that tells the EVM which contract function to execute.

  • ABI Encoding: The Ethereum Application Binary Interface (ABI) specifies how to encode the function arguments that follow the selector into a predictable byte array.
  • Dynamic vs. Static Types: Static types (like uint256, address) are encoded in-place. Dynamic types (like string, bytes, array) are encoded as an offset pointer followed by the data.
  • abi.encode vs abi.encodePacked: abi.encode is standard and pads data to 32-byte words. abi.encodePacked tightly packs data without padding, which is cheaper but can lead to hash collisions if not used carefully.
03

Security Considerations & Validation

Improper handling of call data is a common source of vulnerabilities. Contracts must validate all incoming data.

  • Input Validation: Always check bounds, array lengths, and sender permissions before processing calldata arguments. Use require() statements liberally.
  • Reentrancy Guards: Even view and pure functions that read calldata can be part of a reentrancy attack path if they influence state-changing functions.
  • calldata Location for External Functions: Parameters of external functions should be declared as calldata (not memory) to avoid an unnecessary copy, saving gas and enhancing security by working directly with immutable transaction data.
04

Advanced Patterns: Calldata Delegation

Advanced patterns use raw call data for flexible and gas-efficient contract interactions.

  • Multicall: Contracts like Uniswap V3's Multicall allow bundling multiple function calls into a single transaction by passing an array of bytes calldata calls, reducing overhead for users.
  • Delegatecall & Proxies: Upgradeable proxy patterns use delegatecall, which executes code from a logic contract in the context of the proxy, using the proxy's storage. The original msg.data (call data) is passed through, enabling transparent function routing.
  • Gas Station Networks (GSN): Relayers can submit meta-transactions where the user's signature is included in the calldata, allowing for gasless transactions.
05

Tooling & Inspection

Developers use specific tools to decode, simulate, and analyze call data.

  • Block Explorers: Etherscan decodes call data into human-readable function calls and arguments for verified contracts.
  • Local Decoding: Libraries like ethers.js (Interface.decodeFunctionData) and web3.py allow programmatic decoding of call data using a contract's ABI.
  • Debugging: When a transaction reverts, tools like Tenderly and the Hardhat console can trace execution and show the exact state when the call data was processed, which is crucial for diagnosing failures.
06

EIP-1559 & Calldata Cost Dynamics

EIP-1559 changed the fee market, making call data costs more predictable but also introducing a per-byte cost floor.

  • Base Fee vs. Priority Fee: The total fee is Base Fee + Priority Fee. The Base Fee is burned and adjusts per block based on network congestion.
  • Intrinsic Calldata Cost: Ethereum imposes a cost of 16 gas per non-zero byte and 4 gas per zero byte of call data. This makes data compression and using zero bytes advantageous.
  • Blob Transactions (EIP-4844): Introduces blob-carrying transactions that attach large data blobs (e.g., for rollups) at a much lower cost than call data, fundamentally changing the data availability landscape for L2s.
BLOCKCHAIN FUNDAMENTALS

Technical Deep Dive

A detailed exploration of call data, the mechanism for transmitting transaction parameters and contract function calls on the Ethereum Virtual Machine (EVM).

Call data is a read-only, non-persistent data area in the Ethereum Virtual Machine (EVM) that contains the arguments passed to a smart contract function during a transaction or message call. It is the primary mechanism for sending arbitrary data to a smart contract, such as function selectors and encoded parameters. Every transaction includes a data field (often called input), and this payload is loaded into the EVM's call data region when execution begins. The contract's code uses instructions like CALLDATALOAD, CALLDATASIZE, and CALLDATACOPY to read and decode this information. Unlike contract storage, call data is not persistent on-chain between transactions but is a critical part of the transaction's execution context, directly impacting gas costs.

CALL DATA

Frequently Asked Questions

Call data is a fundamental component of Ethereum transactions, containing the instructions for smart contract interactions. These questions address its purpose, cost, and optimization.

Call data is a field in an Ethereum transaction that contains the encoded instructions for interacting with a smart contract. When you send a transaction to a contract address, the call data specifies which function to call and what arguments to pass, using the Ethereum ABI encoding standard. For simple Ether transfers to an Externally Owned Account (EOA), this field is typically empty. It is a critical component for executing any non-trivial on-chain logic, as it is the primary input data processed by the Ethereum Virtual Machine (EVM). The data is stored on-chain and is a key factor in determining the transaction's gas cost, particularly after the EIP-1559 and subsequent network upgrades.

ENQUIRY

Get In Touch
today.

Our experts will offer a free quote and a 30min call to discuss your project.

NDA Protected
24h Response
Directly to Engineering Team
10+
Protocols Shipped
$20M+
TVL Overall
NDA Protected direct pipeline