An empty attachment has a location and a zero-item declaration.
SEE IT FOR YOURSELF
Follow a dynamic string from head to tailStep 1 / 4
This example encodes one string parameter with value hello. A dynamic argument uses an offset in its head, even when it is the only argument.
This example encodes one string parameter with value hello. A dynamic argument uses an offset in its head, even when it is the only argument.At argument byte 32, the string tail begins with length five. This counts the UTF-8 payload bytes and excludes all padding.At argument byte 64, read 68 65 6c 6c 6f for hello. Twenty-seven following zero bytes fill the final content word.The encoding uses ninety-six argument bytes: one offset word, one length word and one padded content word. A normal function call adds a four-byte selector before these bytes.
Animated local teaching model. No wallet, RPC or live blockchain data. Some labels and hashes are abbreviated for readability.
Keep the pointer
An empty string is still a string. A single top-level string argument therefore retains its offset word pointing to the tail at byte 32.
Write zero length
The empty tail has a zero length word and no payload bytes. It does not need a content padding word because zero content bytes are already a multiple of thirty-two.
Handle an empty array similarly
A dynamic array with no elements contains its zero count and no element encodings. Its top-level parameter still needs the offset into that array body.
Separate empty from absent
An empty value is not a missing parameter or a failed call. The ABI schema determines how many parameters exist and how each empty value is represented.
Trace a local example
types: string,uint256[]
values: ["",[]]
no function selector prefix
word 0 · argument offset 0 bytes
0x0000000000000000000000000000000000000000000000000000000000000040
word 1 · argument offset 32 bytes
0x0000000000000000000000000000000000000000000000000000000000000060
word 2 · argument offset 64 bytes
0x0000000000000000000000000000000000000000000000000000000000000000
word 3 · argument offset 96 bytes
0x0000000000000000000000000000000000000000000000000000000000000000
Two pointers each lead to a zero length word; neither tail has a content word.