Stream file
Next is an explanation of the stream file structure. The stream file is created in a binary format instead of a text file. It has a header page and one or more
Next is an explanation of the stream file structure.
The stream file is created in a binary format instead of a text file.
It has a header page and one or more data pages. The header page is first and has a fixed size of 4096 bytes. The data pages follow immediately after the header page, and the size of each data page is 1 MB.
Data pages contain entries.
If an entry does not fit in the remaining page space, it gets stored in the next page. This means the unused space in the previous data page gets filled with some padding.

Header page
Let's zoom into how the page looks like.
The consists of the following data; , , , , , and .
-
The starts with an array of 16 bytes, called .
The identify the application to which the data in the stream file belongs.
In the Polygon zkEVM case, the is the ASCII-encoding of these sixteen (16) characters: .
-
After the comes the , which indicates whether the current page is a page or a page.
The for the entry is , but it is for the entry and for a padding.

-
Included in the page is the , which has the same meaning as seen in the Server-source protocol: It indicates the application, or in particular, the stream source node to which the stream server should connect.
As mentioned in the above line of code, means the stream source node is the zkEVM Sequencer.
-
The is then followed by the , which is the total number of bytes used in the stream file.
-
After the is the , which is the total number of entries used in the file.
Data pages
A data page contains entries and some padding.
Since this is a page, and not a page, the entries are preceded by , while the padding is preceded by .
The is followed by the of the data entry, then the of the entry. That is, whether it is a bookmark or an event entry.
A bookmark is indicated by , while each event's is its position among a sequence of events. That is, each -th event is of .
The next value after the is the entry number, denoted by . The next values in a data page are .
After the last entry in a data page, is the and some padding for any unused space.

Last updated on
Server-source library
Interaction between the stream source and each stream server is enabled by the library, which is a Go library with six main functions for modifying or adding en
How rollbacks work
Recall that the server-source protocol begins with calling the $ exttt ( )$, corresponding to which a message is sent to the stream server, preparing to recei