The nitty-gritty of Ethereum and Solidity : EVM Calldata.

Alberto Molina
Coinmonks

--

The Calldata is one of the four data locations a solidity smart contract has (the others are : storage, memory and stack). It is the array of bytes that is passed in the “Data” field of an ethereum transaction.

Calldata Definition

An ethereum transaction contains a field called “Data” where senders (EOA or smart contracts) can add as many bytes as they want.

They can leave the field empty or literally add anything they want, the point of this field is to transfer information from the sender to the receiver, which is why the important thing is for the receiver to understand its content.

It is true that sometimes this field can be used simply to store information on the blockchain, since the transaction is immutable once added to a block, but it is not considered good practice…

In simple words, Calldata is the message contained within an ethereum transaction.

Calldata Layout

Solidity follows very strict rules when building and deconstructing the array of bytes in the data field (aka CallData).

Contract Creation Transaction

When an EOA sends a transaction to deploy a new smart contract onto the blockchain…

--

--