Element offsets use the array element tuple as their base.
LET’S PICTURE IT
Inside a folder, a second index starts numbering from its own first entry.
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.
Follow the outer pointer
The top-level string[] offset points to an array length word. For two strings, that word contains two, followed by the element head area.
Mark the element base
The element tuple begins immediately after the array length. Offsets for its strings are measured from this element tuple start, not from the length word.
Calculate the inner offsets
For a and bb, two element head words take sixty-four bytes. Their inner offsets are 64 and 128 because the first string tail takes sixty-four bytes.
Resolve all the way to bytes
The outer tail starts at argument byte 32. The element base is byte 64, so the first string length is at byte 128 and its content starts at byte 160.
Trace a local example
types: string[]
values: [["a","bb"]]
no function selector prefix
word 0 · argument offset 0 bytes
0x0000000000000000000000000000000000000000000000000000000000000020
word 1 · argument offset 32 bytes
0x0000000000000000000000000000000000000000000000000000000000000002
word 2 · argument offset 64 bytes
0x0000000000000000000000000000000000000000000000000000000000000040
word 3 · argument offset 96 bytes
0x0000000000000000000000000000000000000000000000000000000000000080
word 4 · argument offset 128 bytes
0x0000000000000000000000000000000000000000000000000000000000000001
word 5 · argument offset 160 bytes
0x6100000000000000000000000000000000000000000000000000000000000000
word 6 · argument offset 192 bytes
0x0000000000000000000000000000000000000000000000000000000000000002
word 7 · argument offset 224 bytes
0x6262000000000000000000000000000000000000000000000000000000000000
Outer offset 32; count 2; inner offsets 64 and 128.