How zama-ai/fhevm works
FHEVM is a full-stack framework for confidential smart contracts: developers express privacy logic in Solidity, encrypted state and symbolic FHE operations remain on the host chain, and asynchronous encrypted computation is offloaded to the coprocessor. Gateway and host contracts coordinate the on-chain/off-chain boundary; KMS handles key management. The graph also shows host-listener event ingestion and its history/dependency internals. README statements support the product-level flow; source-index references support the listener links. Other unsampled subsystem interactions are omitted.
Main entry points: ingest.rs Host Listener · fhevm-engine FHE Coprocessor · host-contracts Host Contracts · library-solidity FHE Solidity
Components 16
Contract Layer
- FHE Solidity
library-solidity - Host Contracts
host-contracts - Gateway Contracts
gateway-contracts
FHE Compute
- FHE Coprocessor
coprocessor/fhevm-engine - TFHE Worker
coprocessor/fhevm-engine/tfhe-worker/src/tfhe_worker.rs - Operation Scheduler
coprocessor/fhevm-engine/scheduler/src/dfg/scheduler.rs
Chain Services
- Host Listener
coprocessor/fhevm-engine/host-listener/src/database/ingest.rs - Event Operand Parsing
coprocessor/fhevm-engine/host-listener/src/database/event_operands.rs - Dependency Chains
coprocessor/fhevm-engine/host-listener/src/database/dependence_chains.rs - History Verification
coprocessor/fhevm-engine/host-listener/src/database/history_verification.rs - Relayer
relayer/src/http/server.rs
Key Security
- KMS Connector
kms-connector/crates/kms-worker/src/core/kms_worker.rs
Developer Tools
- JavaScript SDK
sdk/js-sdk/src/core/types/coreFhevmClient.ts - Version Context
sdk/js-sdk/src/core/frozenContext/fhevmClientFrozenContext-p.ts
Other components
- dApp Developer
- Host Chain
Connections 16
- dApp Developer → FHE Solidity: writes contracts
README.md - FHE Solidity → Host Contracts: expresses FHE logic
README.md - Host Contracts → Host Chain: executes symbolically
README.md - Host Chain → FHE Coprocessor: offloads computation
README.md - FHE Coprocessor → TFHE Worker: performs FHE
- TFHE Worker → Operation Scheduler: schedules operations
- Host Contracts → Gateway Contracts: uses gateway
README.md - Gateway Contracts → FHE Coprocessor: bridges components
README.md - Host Chain → Host Listener: emits events
- Host Listener → Event Operand Parsing: parses operands
coprocessor/fhevm-engine/host-listener/src/database/ingest.rs - Host Listener → Dependency Chains: updates dependencies
coprocessor/fhevm-engine/host-listener/src/database/ingest.rs - Host Listener → History Verification: verifies finalized history
coprocessor/fhevm-engine/host-listener/src/database/ingest.rs - Host Chain → Relayer: sends transactions
- KMS Connector → FHE Coprocessor: manages keys
README.md - dApp Developer → JavaScript SDK: uses SDK
- JavaScript SDK → Version Context: resolves versions
sdk/js-sdk/src/core/frozenContext/fhevmClientFrozenContext-p.ts