# CoFHE Overview

## **Overview**

The Fhenix's Fully Homomorphic Encryption (FHE) CoProcessor - **CoFHE -** is a key component of the **Redact application**, enabling **confidential computations** on EVM-compatible blockchains. It allows **dApps to integrate encrypted data into their smart contracts**, ensuring **private transactions, confidential token minting, and secure data queries** while preserving the benefits of blockchain transparency.

By leveraging FHE, CoFHE enables computations on **encrypted data without decryption**, ensuring **data confidentiality throughout the entire transaction lifecycle**.

[Link](https://cofhe-docs.fhenix.zone/) to CoFHE Documents

### **Key Capabilities**

CoFHE enhances Redact by enabling:

* **Confidential Token Wrapping:** Converts ERC-20 tokens into **fhERC20** without revealing transaction details.
* **Confidential Transactions:** Redact users can send and receive assets **without exposing balances or transaction amounts**.
* **Permit-Based Decryption:** Users can selectively share encrypted data **without compromising security**.

## **How CoFHE Works**

CoFHE operates as an **off-chain computation layer** that processes **encrypted operations asynchronously** and returns verified encrypted results back to the blockchain. This ensures **scalability, security, and privacy** without compromising blockchain integrity.

#### **Transaction Flow**

1. **A user initiates an FHE operation** (e.g., sending confidential token or querying confidenital balances).
2. **The Task Manager Contract** (on-chain) processes the request and generates an encrypted handle.
3. **The Aggregator (off-chain) receives the request** and forwards it to the **fheOS Server** for computation.
4. **The fheOS Server executes the FHE operation**, ensuring the data remains encrypted.
5. **Results are verified and sent back on-chain**, maintaining confidentiality throughout the process.

## **CoFHE Architecture**

CoFHE consists of several components that work together to **secure and process encrypted transactions**:

1. **FHE.sol Library**
   1. A Solidity library that allows smart contracts to execute confidential operations.
   2. Imported directly into dApps to enable confidential token wrapping, minting, and transactions.
2. **Task Manager Contract**
   1. Acts as the entry point for dApps integrating with CoFHE.
   2. Handles requests for FHE computations and confidential transactions.
3. **Aggregator**
   1. Collects and processes FHE operation requests in a secure and structured manner.
   2. Sends requests to fheOS Server for execution.
4. **fheOS Server**
   1. The computation engine responsible for executing encrypted transactions.
   2. Ensures data remains encrypted throughout the entire process.
5. **Threshold Network (Decentralized Decryption)**
   1. Uses multi-party computation (MPC) to handle decryption requests securely.
   2. Ensures no single entity can access decrypted data, maintaining trustless confidentiality.

## **Security & Privacy Measures**

CoFHE implements **multiple security mechanisms** to ensure **data privacy and integrity**:

* **Fully Homomorphic Encryption (FHE):** Keeps data encrypted during computation.
* **Threshold Network Encryption:** Prevents unauthorized decryption.
* **Zero-Knowledge Proofs (ZKPoK):** Ensures computations are valid without revealing data.
* **Access Control Mechanism (ACL.sol):** Restricts who can decrypt and interact with encrypted data.
