docs/protocol/d_re_ecrypt_compute.md
This section introduces the core cryptographic operations in the FHEVM system, covering how data is encrypted, processed, and decrypted — while ensuring complete confidentiality through Fully Homomorphic Encryption (FHE).
The architecture enforces end-to-end encryption, coordinating key flows across the frontend, smart contracts, coprocessors, and a secure Key Management System (KMS) operated via threshold MPC.
Encryption is the starting point for any interaction with the FHEVM system, ensuring that data is protected before it is transmitted or processed.
You can read about the implementation details in our encryption guide.
Encrypted computations are performed using the evaluation key on the coprocessor.
There are two kinds of decryption supported in the FHEVM system:
User Decryption is the mechanism that allows users or applications to request private access to decrypted data — without exposing the plaintext on-chain. Instead of simply decrypting, the KMS securely decrypts the result with the user’s public key, allowing the user to decrypt it client-side only.
This guarantees:
User decryption is initiated on the client side using the @zama-ai/relayer-sdk library. Here’s the general workflow:
balanceOf) on the smart contract to get the handle of the ciphertext to be decrypted.You can read our user decryption guide explaining how to use it.
The flow of information across the FHEVM components during these operations highlights how the system ensures privacy while maintaining usability:
| Operation | ||
|---|---|---|
| Encryption | Public Key | Frontend encrypts data → ciphertext sent to blockchain or coprocessor |
| Computation | Evaluation Key | Coprocessor executes operations from smart contract events → updated ciphertexts |
| Decryption | Private Key | Smart contract requests plaintext → Gateway forwards to KMS → result returned on-chain |
| User decryption | Private and Target Keys | User requests result → KMS decrypts and encrypts with user’s public key → frontend decrypts locally |
This architecture ensures that sensitive data remains encrypted throughout its lifecycle, with decryption only occurring in controlled, secure environments. By separating key roles and processing responsibilities, FHEVM provides a scalable and robust framework for private smart contracts.