MCPcopy Index your code
hub / github.com/emilianobonassi/zkFHE

github.com/emilianobonassi/zkFHE @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
3 symbols 3 edges 4 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

zkFHE

Verifiable and confidential computation based on ZKP and FHE, powered by risc0 zkVM.

A PoC to demonstrate an approach for private computation on a public environment w/o give up data availability (since data can stay encrypted).

FHE provides confidentiality, ZKP provides the proof that the algorithm run following the rules.

How it works

It's based on a tweaked version of Cupcake, a library for the (additive version of) Fan-Vercauteren homomorphic encryption scheme. Tweaked so it can run in the risc0 zkVM (i.e. single thread, custom getrandom).

It runs the following protocol

  1. (Host) Create public and secret key
  2. (Host) Encrypt two numbers with the secret key
  3. (Host) Pass the public key and the two encrypted numbers to the guest vm
  4. (Guest) Fetch the encrypted data and init the FHE framework
  5. (Guest) Perform the (encrypted) sum on the encrypted data using the public key
  6. (Guest) Send back the encrypted sum to the host
  7. (Host) Decrypt the sum with secret key

TL;DR host has the guarantee the guest run the algorithm (ZKP) and that the guest did not access to the unecrypted data (FHE).

How to run

First, install Rust if you don't already have it, then

cargo run --release

If you see 107 (19+88) at the end of the run, it worked.

PS: proof generation takes a lot (2hrs)

Core symbols most depended-on inside this repo

main
called by 0
host/src/main.rs
main
called by 0
methods/build.rs
main
called by 0
methods/guest/src/bin/method_name.rs

Shape

Function 3

Languages

Rust100%

Modules by API surface

methods/guest/src/bin/method_name.rs1 symbols
methods/build.rs1 symbols
host/src/main.rs1 symbols

For agents

$ claude mcp add zkFHE \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact