Enclave is now The Interfold. Documentation is being updated.
Architecture Overview

This section provides a breakdown of the Interfold protocol architecture, focusing on the core components and workflows involved in executing E3 computations.

Core Components

1. Key Actors

Requesters

  • Initiate and define computation requests, including parameters and requirements
  • Retrieve and utilize final computation results
  • Can be applications, protocols, or other systems

Data Providers

  • Supply private inputs required for computation
  • Encrypt their inputs before submission
  • Can be end users, systems, or other applications

Ciphernodes

  • Provide distributed cryptographic services as staked network operators
  • Perform distributed key generation and threshold decryption
  • Form Ciphernode Committees (CiCos) for individual computations

2. Smart Contracts

Interfold Contract

  • Central coordinator of the E3 ecosystem
  • Manages computation requests and lifecycle
  • Coordinates Ciphernode selection and CiCo formation
  • Maintains input integrity via Merkle trees
  • Emits events for off-chain services

E3 Program (E3P) Contract

  • Defines computation logic for the E3
  • Validates program parameters
  • Verifies computation proofs
  • Interfaces with the Interfold contract
  • Ensures correct execution of the E3P
  • Validates and sanitizes input data
    • this might involve verifying a Zero-Knowledge Proof (ZKP) to ensure input integrity and authenticity
    • prevents malformed or malicious input injection that could compromise the computation

Decryption Verifier Contract

  • Validates Ciphernode decryption shares
  • Ensures correct result decryption
  • Verifies threshold signature schemes

Bonding Registry Contract

  • Manages operator license bonds (ENCL tokens) and ticket balances (ETK)
  • Handles operator registration and deregistration
  • Enforces minimum bond and ticket requirements for active status
  • Processes exit queues with configurable delay periods
  • Distributes rewards to committee members on successful E3 completion

Slashing Manager Contract

  • Processes slashing proposals against misbehaving operators
  • Supports two lanes: attestation-based (immediate) and evidence-based (with appeal window)
  • Manages appeals and governance resolution
  • Can expel committee members and trigger E3 failure if viability drops below threshold
  • Enforces ban policies for repeat offenders

E3 Refund Manager Contract

  • Calculates refund distributions when an E3 fails at any stage
  • Distributes refunds proportionally based on work completed (committee formation, DKG, decryption)
  • Manages escrow of slashed funds for redistribution
  • Ensures honest node operators receive compensation for completed work

3. Compute Infrastructure

Compute Provider (CP)

  • Runs the E3 Program over the published inputs
  • Reports computation results of the E3P to the Interfold contract

The Interfold supports multiple CPs with different trust, scalability, and cost tradeoffs.

Supported systems:

  1. Verifiable systems

  2. Oracle-based systems

    • zkTLS VMs (coming soon)
    • Committee-based oracles (coming soon)
    • Game theory-based oracles (coming soon)

Interaction Flow

The following steps outline how these components interact in a typical computation: E3 Flow

  1. Computation Request: A Requester submits a computation request with specific parameters.
  2. Node Selection: Ciphernodes are selected via sortition to form a Ciphernode Committee (CiCo).
  3. Key Generation: The CiCo generates and publishes a shared public key for encryption.
  4. Data Submission: Data Providers encrypt their inputs using the CiCo's shared public key and publish commitments to the encrypted inputs onchain.
  5. Computation Execution: The Compute Provider (CP) runs the E3 Program (E3P) over the published inputs.
  6. Decryption: The CiCo collectively decrypts the final result.
  7. Result Retrieval: The Requester retrieves and consumes the decrypted output of the E3P.

E3 Lifecycle Stages

Every E3 transitions through a well-defined state machine managed by the Enclave contract:

StageDescription
NoneDefault state; E3 does not yet exist
RequestedE3 submitted and committee selection initiated
CommitteeFinalizedSortition complete; selected nodes begin DKG
KeyPublishedCommittee public key published; inputs and computation accepted
CiphertextReadyEncrypted output published; awaiting decryption
CompletePlaintext output published and rewards distributed
FailedTimeout or fault detected; refund process initiated

Timeout deadlines are configured per-deployment via E3TimeoutConfig (DKG window, compute window, decryption window) on the Enclave contract. The committee formation window is managed separately by the CiphernodeRegistry. If any deadline passes without the expected action, the E3 can be marked as failed and the refund manager distributes funds to honest participants.

Current Sepolia timeout configuration:

WindowDuration
Committee Formation Window3,600s
DKG Window7,200s
Compute Window86,400s
Decryption Window3,600s

Failure Reasons

When an E3 fails, a specific reason is recorded:

  • CommitteeFormationTimeout / InsufficientCommitteeMembers
  • DKGTimeout / DKGInvalidShares
  • NoInputsReceived
  • ComputeTimeout / ComputeProviderExpired / ComputeProviderFailed
  • RequesterCancelled
  • DecryptionTimeout / DecryptionInvalidShares
  • VerificationFailed

Developer's Perspective

As a developer, you'll interact with:

  • Interfold smart contracts: To submit computation requests and retrieve results.
  • Compute Providers: To run your E3P using verifiable or oracle-based systems.
  • E3 Smart Contracts: To verify the inputs and computation result.