Data Streaming Contracts

Overview of Data Stream Contracts Flow

1. Deployment and Configuration:

  • StreamDataSpotterFactory: Responsible for deploying new StreamDataSpotter contracts for different data sources. It sets initial configurations via the MasterStreamDataSpotter.

2. Data Collection and Processing:

  • StreamDataSpotter Contracts: Handle data collection and processing from designated sources to achieve consensus on data validity.

3. Aggregation and Finalization:

  • MasterStreamDataSpotter: Central role in aggregating data from all StreamDataSpotters using a Merkle tree to ensure data integrity. The consensus process culminates globally within the ProcessingLib contract where data is validated and written back to the MasterStreamDataSpotter for secure, network-wide information aggregation.

4. Consensus and Reward Management:

  • The system validates data through consensus, rewarding contributors accordingly.

Detailed Contract Descriptions

StreamDataSpotter:

Transmitter Agents push votes and data into the StreamDataSpotter contract. Each protocol can deploy its own StreamDataSpotter through the StreamDataSpotterFactory, which ensures modularity and customization.

StreamDataSpotterFactory

  • Purpose: Deploys and manages StreamDataSpotter contracts.

  • Functionality:

    • Creates StreamDataSpotter contracts for different data sources.

    • Configures consensus parameters and essential settings for each StreamDataSpotter.

StreamDataSpotter

  • Purpose: Manages data from a specific source.

  • Functionality:

    • Collects votes from Transmitter Agents.

    • Processes votes to achieve consensus.

    • Forwards finalized data to the MasterStreamDataSpotter for global consensus.

Parameters and Process

  • Parameters: Set minimum finalization interval and required percentage of Transmitter votes. These can be updated but changes apply only from the next round.

  • Finalization: When votes meet criteria, the protocol executor initiates finalization via the StreamDataProcessingLib contract.

This system ensures a streamlined, secure, and efficient voting and finalization process for integrated protocols.

Stream Data Processing Library:

The contract performs the following tasks:

  1. Vote Collection: Gathers all votes from Transmitter Agents for the current round.

  2. Vote Validation: Identifies votes within an accepted deviation range, if applicable, to ensure validity.

  3. Calculation: Performs necessary calculations to determine the final value, which may include aggregation and mathematical operations.

Reward Mechanism:

  • Votes used in the final value are marked as rewardable.

  • Participants who provided these votes receive their stake back plus a reward through a keeper staking system.

This contract ensures a fair, accurate finalization process by validating votes, computing the final value, and rewarding contributors.

MasterStreamDataSpotter:

The MasterStreamDataSpotter contract manages the finalization process:

  1. Final Value Recording: Records the final value and emits a DataFinalized event to signal completion.

  2. Event Handling: Protocol Transmitter Agents fetch the DataFinalized event and execute a "push" operation to distribute the value to blockchains.

Responsibilities:

  • Data Aggregation: Aggregates and validates data from various StreamDataSpotter contracts.

  • Consensus Verification: Verifies and finalizes data that has reached consensus.

  • System Updates: Updates system parameters based on finalized data.

  • Merkle Tree Maintenance: Maintains the Merkle tree to ensure data integrity and facilitate verification.

This contract ensures the accurate and reliable propagation of the final value and maintains the integrity of the data processing system.

Last updated