The gcEVM Architecture

Let's dig deeper into the architecture of the gcEVM, see the following diagram and the explanation below.

Garblers & Evaluators Communication via the GCManager

Memory Management for Circuits in gcEVM. Efficient memory management of garbled circuits (GCs) is crucial for ensuring high performance and scalability in gcEVM. The system leverages unique circuit identification, batching, and stateless generation to optimize circuit handling.

Circuit Identification. Each garbled circuit is uniquely identified by three attributes:

  1. Circuit Type Identifier: Specifies the computation type (e.g., addition, multiplication).

  2. Batch Number: Groups circuits of the same type into a batch for efficient handling.

  3. Circuit Number: Uniquely identifies a circuit within its batch.

Batching for Efficiency.

  • Purpose: Reduces communication and database access overhead. Allows bulk processing of circuits in a single operation.

  • Generation: Garbler generates circuits in batches for each type.

  • Retrieval: Evaluators request and consume batches from MongoDB, minimizing retrieval delays.

Stateless Circuit Generation.

The Garbler uses a deterministic seed to generate circuits, allowing them to be regenerated identically if lost or corrupted. This ensures fault tolerance without requiring the Garbler to maintain state information.

Online Phase Circuit Handling

  1. Memory Caching: Evaluators cache circuits in memory for quick access during computations.

  2. Depletion and Refill: When circuits in memory are depleted, Evaluators request new batches from the GCManager.

  3. Fault Recovery: If circuits are corrupted or lost, the Garbler regenerates them using the same seed.

Advantages

  • Efficiency: Memory caching reduces latency during computations.

  • Scalability: Stateless generation allows seamless scaling for larger workloads.

  • Fault Tolerance: Circuits can be reconstructed without data loss.

  • Uniqueness: The identification system ensures that each circuit is distinct and non-reusable.

Transaction data flow - Garbled Circuits supply chain and consumption gcEVM

The architecture involves an orchestration between the Garblers, the GCManager, and the Evaluators, ensuring that the preparation and execution of garbled circuits are optimized for security and efficiency.

Flow Overview

The process is initiated well before any actual transaction processing occurs, with the offline preparation of garbled circuits. This pre-emptive setup ensures that circuits are readily available for the Evaluators on demand, without waiting, minimizing latency and maximizing performance for confidential workloads.

Preparation of Garbled Circuits

Offline Circuit Preparation:

  • The Garblers are configured to generate garbled circuits in the offline phase, based on predefined capacities and requirements detailed in a common capacities initialization file. This file specifies:

  • N_BATCH_DB(bc_name): Number of batches in the database per blockchain (BC) name.

  • N_CIRCUITS_BATCH(bc_name): Number of circuits within each batch.

  • N_CIRCUITS_MEM(bc_name): Number of circuits to be held in memory by Evaluators.

  • A threshold (N_CIRCUITS_MEM(bc_name) - 1) is set to prompt the fetching of a new garbled circuit immediately after one is used, ensuring a seamless supply.

The Garblers Functionality:

  • The Garblers operate upon requests from the GCManager to produce more garbled circuits.

The GCManager

  • The GCManager acts as a coordinator between the Garblers and the Evaluators in the gcEVM architecture, managing the queue of circuit requests and maintaining a state of the blockchain’s MPC status. It does not pose any security or trust function in the architecture and its impact on availability is very limited (can be re-launched in case of a fault, and in the future it can be replicated, to achieve full availability)

Evaluators' Dynamics

  • The Evaluators continuously monitor their available garbled circuit inventory against the thresholds set and request new batches from the GCManager as needed.

  • They run multiple threads to manage garbled circuit evaluation and fetching, ensuring that the system remains responsive and up-to-date with the current state of circuit consumption.

Interaction with Executors:

  • When an Executor processes a transaction requiring secure computation, it activates the Evaluators through pre-compiled contracts.

  • Evaluators then retrieve the necessary fetch the required garbled circuits from their inventory, to execute the computation securely.

Recovery and Error Handling

  • The system is designed for robustness, with mechanisms in place for recovery and error handling across Garblers, GCManager, and the database.

  • In events of crashes or errors, a Garbler/Evaluator can re-launch from a retrieved 'good states', with critical data recoverable due to the persistent state management and offline preparation of circuits.

Summary

This flow of garbled circuit production and consumption in the gcEVM highlights the elegant integration of pre-computation, dynamic management, and secure execution within the chain environment. By pre-preparing garbled circuits and employing a robust management system, the gcEVM ensures that secure, privacy-preserving computations are executed efficiently, meeting the high-security demands of modern blockchain applications.

Last updated