Table of Contents:
- Overview
- System Architecture
- Key Mechanisms
- Security Considerations
- Limitations & Future Enhancements
- Related Documentation
SEDA is a decentralized network that provides programmable oracle infrastructure, enabling secure and reliable access to off-chain data for blockchain applications. The SEDA EVM Contracts serve as the destination-chain component of SEDA's cross-chain oracle system, ensuring seamless data integration with blockchain networks.
The SEDA protocol's EVM implementation revolves around two main smart contracts that handle data requests and verification. These contracts act as a bridge between destination blockchains and the SEDA network. The core functions include:
- Request Handling & Management: Processing and tracking data requests.
- Result Verification & Processing: Ensuring the authenticity and integrity of data.
- Validator Set Tracking & Consensus Verification: Managing validators who sign off on data.
- Fee Distribution System: Allocating rewards to participants.
For a more detailed view, refer to the Detailed Architecture Diagram.
SedaCoreV1
is the primary contract for user interaction, managing the full lifecycle of data requests. It is responsible for:
- Creating and tracking data requests.
- Processing submitted results.
- Collecting and distributing fees.
- Managing request timeouts.
- Maintaining pending requests.
Secp256k1ProverV1
ensures the validity of results from the SEDA network by verifying validator signatures using the Elliptic Curve Digital Signature Algorithm (ECDSA) based on the secp256k1
curve. Its core responsibilities include:
- Maintaining the active validator set.
- Verifying validator signatures on result batches.
- Validating result inclusion proofs.
- Enforcing sequential batch processing.
- Ensuring consensus threshold requirements are met.
To enhance modularity and maintainability, several supporting components provide essential functionality:
- RequestHandlerBase: Standardizes request handling and tracking.
- ResultHandlerBase: Manages the processing and verification of results.
- ProverBase: Implements core logic for validator consensus verification.
- SedaDataTypes: Defines data structures and utility functions.
These components reduce code duplication and promote a consistent architecture.
The lifecycle of a data request follows a structured sequence:
-
Request Submission
- User submits request via
SedaCoreV1::postRequest
- Request details and fees are stored
- Request ID is added to pending requests
- User submits request via
-
Off-chain Processing
- SEDA network processes the request
- Results are batched for efficient submission
- Batches are signed by SEDA chain validators
-
Batch Submission
- Signed batch is submitted via
Secp256k1ProverV1::postBatch
- Batch contains results root and validator signatures
- Requires 66.67% validator consensus for acceptance
- Signed batch is submitted via
-
Result Verification
- Results submitted via
SedaCoreV1::postResult
Secp256k1ProverV1::verifyResultProof
validates inclusion- Successful verification triggers fee distribution
- Results submitted via
-
Request Completion
- Request removed from pending state
- Fees distributed according to rules
- Events emitted for tracking
The protocol employs a three-tier fee model to incentivize network participants:
-
Request Fee
- Split based on gas usage if a valid payback address is provided
- Formula:
submitterFee = (gasUsed * requestFee) / gasLimit
- Remainder refunded to requester
- Full refund if no valid payback address
-
Result Fee
- Paid entirely to result submitter (
msg.sender
) - Rewards timely result submission
- Paid entirely to result submitter (
-
Batch Fee
- Paid to batch sender if a valid address is returned by prover
- Refunded to requester if no valid batch sender
Additional Features:
- Fee increases possible via
increaseFees
- Timeout-based withdrawals for stale requests
- Exact ETH matching required for all fee operations
SEDA EVM Contracts employ a two-layer verification approach to ensure security:
- Verifies
secp256k1
signatures against the known validator set. - Ensures sufficient voting power is reached.
- Prevents replay attacks via sequential batch enforcement.
- Uses Merkle Tree Proofs to validate data integrity.
- Ensures submitted results are part of a verified batch.
- Guarantees correctness across different chains.
The contracts are designed with security, upgradability, and efficiency in mind. Key architectural decisions include:
- UUPS Proxy Pattern: Allows controlled contract upgrades.
- ERC-7201 Compliant Storage Layout: Ensures storage consistency.
- Request Timeout Mechanism: Protects funds from being locked in stale requests.
- Sequential Batch Processing: Mitigates replay attacks.
- Consensus Threshold Alignment: Maintains consistency with the SEDA network.
To ensure correct integration and usage, the following constraints apply:
- Validator set updates must be sequential (gaps are supported).
- Result timestamps must be greater than request timestamps.
- Batch heights must increase monotonically.
- Request IDs must be unique on each destination chain.
- Fee distribution only occurs upon successful result submission.
For additional information and detailed documentation about the SEDA protocol:
- SEDA Documentation Portal - Complete protocol documentation and guides