# FHE Consensus

## Mind Network's Research Results:

* Academic Publication: Mind Network researched and developed to enable a new encrypted consensus through FHE (paper title: Enabling Encrypted Consensus through Fully HomomorphicEncryption in Proof of Intelligence Mechanisms). The research paper is under publication peer-review and can share upon request.
* FHE Consensus Node (FCN): [Repo](https://github.com/mind-network/mind-sdk-fcn-rust), [Crates](https://crates.io/crates/mind_sdk_fcn).<br>

## Mind Network's Research Details:

🔍 In **Mind Network**, FHE validators vote in Hubs and are known as Hub Independent Validators (SIV). This improved POS mechanism is termed POSIV (POS with Independent Validation). We've developed [SDKs](https://github.com/mind-network/Awesome-Mind-Network) in multiple languages to facilitate FHE Validation. SIVs encrypt their votes using a specified FHE Public Key and submit them to the FHE Validation Consensus. To participate in validation, SIVs must register, meet staking criteria, and opt-in to specific validation tasks. The end-to-end flow architecture are like bellow:

<figure><img src="/files/vXvo2EqbklInVpxZKRZP" alt=""><figcaption></figcaption></figure>

### 🔍 **Understanding POSIV**

In this section, we'll delve into reaching consensus for FHE validation work post private voting and upon receiving all encrypted votes. It comprises four main components: **POSIV\_Input**, **POSIV\_Output**, **POSIV\_Consensus**, and optionally, **POSIV\_Decryption**.

<figure><img src="/files/zt07ytXtrgUW71u4xG4E" alt=""><figcaption></figcaption></figure>

### **POSIV\_Input** 📥

POSIV\_Input gathers encrypted votes from each SIV and records them as immutable data for verification. Its size and voting windows are defined by the Hub. For instance, the Hub can decide to:

* Accept a fixed number of initial votes (e.g., `fixCountCriteria=100 SIVs`)
* Begin consensus after a fixed time period (e.g., `fixIntervalCriteria=1 minute`)
* Accept a fixed portion of opt-in SIVs (e.g., `fixPercentageCriteria=70% of Opt-in SIVs`)
* Or a combination of these criteria. Once criteria are met, POSIV\_Input stops receiving new private voting entries and triggers POSIV\_Consensus.<br>

### **POSIV\_Consensus** 🤝

**POSIV\_Consensus** activates after **POSIV\_Input** and conducts a determined FHE Computation, converting an array of FHE encrypted values into one. The FHE Activation Function (`fheActivationFunction`) is specified by Hub in the Task Definition, for example`fheMean`, `fheAverage`, `fheMajority`, `fheRank`, etc. **POSIV\_Consensus** is a Hub dedicated focus on FHE Validation Consensus and in permissionless mode to accept FCN (FHE Consensus Node). Each FCN can opt-in a particular task and run the `fheActivationFunction` and send the result to **POSIV\_Output**. Let us take **fheAverage** as an example. Each FCN will run **fheAverage** on all the stake by encrypted votes and send to **POSIV\_Output**.

<figure><img src="/files/7bZSyawFJnzCYvC4HXiP" alt=""><figcaption></figcaption></figure>

### **POSIV\_Output** 📊

Since `fheActivationFunction` is deterministic, each FCN should generate the same output with the same **POSIV\_Input**. Thus, **POSIV\_Output** conducts majority votes by checking if 2/3 FCNs respond to the same encrypted value, similar to classical POS consensus. It represents the output of FHE Consensus from all FCN responses.<br>

### **POSIV\_Decryption** 🔑

Some Hubs prefer complete control and conduct `fheDecrypt` by themselves or a trusted party, completing the consensus here. Others may use Mind for `fheDecrypt`, where POSIV\_Decryption comes into play. POSIV\_Decryption focuses on FHE Validation Decryption with FDNs (FHE Decryption Nodes). Each FDN decrypts a portion and aggregates to the final true result in POSIV\_Output. The decrypted result can be directly consumed by RPC or trigger calls to other smart contracts, or for example, to distribute rewards.

<figure><img src="/files/Fl3s7oLbUuT0lP6Sclw1" alt=""><figcaption></figcaption></figure>

<figure><img src="https://mindnetwork.sg.larksuite.com/space/api/box/stream/download/asynccode/?code=ODAwY2QzZDhmZDI4NDc0ZGI1MTM3NzBhNmZhYjkxYzFfb2tkVW5nNlVPNDc0U3lOZGRUeDhlWWRDZU94QUtXa0FfVG9rZW46VUhGUGJTUnE1b1dFRXR4bVk2QWw5RjcyZzNiXzE3NDE2NjE1MjY6MTc0MTY2NTEyNl9WNA" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mindnetwork.xyz/minddocs/research/fhe-research/fhe-consensus.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
