What is calldata?
- Author
- CRYPTO PORT Editorial
- Published
- Updated
- Reading time
- 4 min
In short
Calldata is the input data attached to a transaction and handed to a contract. It encodes which function to call and with what arguments, and what you write stays on the chain permanently. Because it is charged per byte, it was long the main cost driver for rollups.
Key points
- The input data attached to a transaction for a contract
- Encodes the function being called and its arguments
- What it contains stays on the chain permanently
- Charged per byte, with zero bytes costing less
Definition
A read-only region of input data included in a transaction and passed to a contract, holding the encoded function selector and arguments.
When you send a token, the recipient address and amount are encoded into the transaction's calldata. Open a transaction on a block explorer and the long hex string beginning with 0x is exactly that: four bytes identifying the function, followed by the arguments.
Pricing is per byte, and zero bytes are cheaper than non-zero ones. That price difference is why encoders avoid wasteful zero padding and why packing choices matter. The same call can cost noticeably different gas depending on how the data is laid out.
Before EIP-4844, rollups posted their transaction data as calldata. Since calldata lives in the region every node keeps forever and is priced in the same market as execution gas, rollup fees tracked layer 1 congestion directly.
Watch out for
- · Anything written to calldata is public and cannot be removed later
- · Approval and transfer arguments live in calldata, so read them before signing
- · Identical operations can cost different gas depending on encoding, so estimates can drift