- The user’s external node makes requests for information to the zkNode,
- The zkNode fetches this information from the internal database, and
- The zkNode relays it back to the requesting node.
Design approach
The design of the data streamer emulates the conventional L1 networks, where blocks are delivered to all nodes in the network via some peer-to-peer protocol, typically referred to as the gossip protocol. With this approach the zkNode does not serve processed data via the JSON-RPC API to downstream nodes, but just ”fast streams” L2 data (which includes; batch data, block header data and transactions data) using a protocol with a low overhead. Instead of using existing streaming protocols, such as MQTT from IoT, the Polygon zkEVM team has developed a new custom-ware protocol, tailor-made for the zkEVM. Developing their own protocol has the advantage of owning the code, and thus the team can alter it as required for the purpose of improving the zkEVM network. The data streamer is a service that does not process blocks but sends them raw as they are generated.Data streamer building blocks
We present a general abstraction of the data streamer. The basic architecture consists of a data source, data server, and data client, with an added option of a stream relay for better scalability.
Stream relay
For increased scalability, an intermediate node called stream relay is added to the architecture. And it is utilized as a “relayer” node between a stream server and a number of stream clients. Such a stream relay is a client to some stream server but acts as a server to connected stream clients. That is, each connected stream client sends messages to the stream relay according to the afore-mentioned client-server protocol. And, the stream relay in turn acts as a client to a stream server, to which the stream relay sends the messages received from stream clients, also in line with the client-server protocol. This design creates a highly scalable data streaming infrastructure.