Data Streaming Contracts

Here is the overall flow of the Data Stream contracts :

  • Deployment and Configuration: StreamDataSpotterFactory is responsible for the deployment of StreamDataSpotter contracts for new data sources and sets up their initial configurations through the MasterStreamDataSpotter.

  • Data Collection and Processing: Individual StreamDataSpotter contracts are tasked with gathering and processing data from their respective sources, aiming to reach a consensus on the data's validity among participants.

  • Aggregation and Finalization: The MasterStreamDataSpotter plays a pivotal role in gathering and finalizing data from all StreamDataSpotters, employing a Merkle tree to guarantee the data's integrity and culminating the consensus process globally. This crucial data finalization process occurs within the ProcessingLib contract, where the data undergoes rigorous validation and integrity checks. Once finalized, this data is then written to the MasterStreamDataSpotter, ensuring a secure and accurate aggregation of information across the network.

  • Consensus and Reward Management: The system as a whole emphasizes consensus for validating data, rewarding those who contribute to achieving this consensus.

Let’s check the contracts in detail.

Stream Data Spotter

In our system, Transmitter Agents play a crucial role by pushing votes along with data into the StreamDataSpotter contract. This contract is created through a streamDataFactory contract, allowing each integrated protocol to deploy their own StreamDataSpotter contract. This approach follows a modular structure, ensuring flexibility and customization.

Once the StreamDataSpotter contract is deployed via the Factory, it sets important parameters such as the minimum interval for finalization and the required percentage of keeper votes relative to the total. These parameters are essential for the proper functioning of the voting process. These parameters might be changed at any time by protocol, but all changes will be applied only from the next round.

When the accumulated votes from Transmitter Agents meet the specified criteria, the protocol executor takes action by initiating a transaction for vote finalization. This transaction is executed within the StreamDataProcessingLib contract, which handles the finalization process.

Overall, this system ensures a streamlined and secure process for voting and finalization, providing transparency and efficiency for integrated protocols.

  • StreamDataSpotterFactory

    • Purpose: Acts as a factory for creating individual StreamDataSpotter contracts tailored to specific data sources.

    • Functionality: It dynamically deploys StreamDataSpotter contracts for new data sources and oversees their management. This includes registering spotters and configuring consensus parameters and other essential settings for each deployed spotter.

  • StreamDataSpotter

    • Purpose: Each StreamDataSpotter contract is dedicated to managing data from a particular source.

    • Functionality: These contracts collect votes from participants (like stakers or transmitters) on the data they manage, process this data to achieve consensus, and then forward the finalized data to the MasterStreamDataSpotter for further processing and global consensus achievement.

Stream Data Processing Library

In our system, the finalization process is managed by a specialized contract. This contract is responsible for gathering all the votes from Transmitter Agents for the current round and determining the true value based on these votes.

Once all the votes are collected, the finalization contract then identifies the votes that fall within an accepted deviation range, if such a range exists. This ensures that only valid and reliable votes are considered in the final calculations.

If necessary, the finalization contract performs the required calculations to determine the final value. This may involve aggregating the votes, applying mathematical operations, or any other necessary steps to arrive at the result.

It's important to note that the votes that contribute to forming the final value are marked as rewardable. This means that participants who provided these votes are eligible to receive rewards. In our system, we use a keeper staking system where these participants receive their stake back along with an allocated reward.

Overall, this specialized contract ensures a fair and accurate finalization process by considering valid votes, performing necessary calculations, and rewarding participants who contributed to the final value.

MasterStreamDataSpotter

In our system, the finalization process is managed by a specialized contract called the MasterStreamDataSpotter contract. This contract plays a crucial role in recording the final value and signaling the completion of the finalization process through the emission of a DataFinalized event.

Once the final value is recorded, Protocol Transmitter Agents fetch this event and can execute an operation, commonly referred to as a "push", to distribute the value to the awaiting blockchains. This ensures that the calculated value is propagated and made available to the relevant parties

It aggregates and validates data received from various StreamDataSpotters, managing the keys for voting on data. This contract is also responsible for verifying and finalizing data that has reached consensus, updating system parameters based on this data, and maintaining the Merkle tree to ensure data integrity and facilitate verification.

Last updated