Here is an example from What is an ABI and why is it needed to interact with contracts?
contract Foo {
function baz(uint32 x, bool y) returns (bool r) { r = x > 32 || y; }
}
If we wanted to call baz()
with the parameters 69
and true
, we would pass 68 bytes in total, which can be broken down into:
0xcdcd77c0: the Method ID. This is derived as the first 4 bytes of the
Keccak-256 hash of the ASCII form of the signature baz(uint32,bool).
0x0000000000000000000000000000000000000000000000000000000000000045:
the first parameter, a uint32 value 69 padded to 32 bytes. (69 is hex 0x45.)
0x0000000000000000000000000000000000000000000000000000000000000001:
the second parameter - boolean true, padded to 32 bytes
The 68 bytes is the calldata
: 0xcdcd77c000000000000000000000000000000000000000000000000000000000000000450000000000000000000000000000000000000000000000000000000000000001
.