Architecture¶
vfhe is one Python package, vfhe, assembled from the modules under
modules/. Each module is a Python package, vfhe.<module>, with the C it
needs beside it; every module’s C compiles into one extension per engine.
The modules¶
flowchart TD
classDef public stroke:#c2255c,stroke-width:3px
classDef planned stroke-dasharray: 5 5
APP(["Application"])
subgraph VFHESTK["Verifiable FHE"]
VFHE["vfhe<br/><i>the two stacks, assembled</i>"]
end
subgraph FHESTK["FHE stack"]
FHE["fhe<br/><i>CKKS, BFV, CGGI16, GP25</i>"]
MLWE["mlwe<br/><i>LWE, Module-LWE, MGSW</i>"]
end
subgraph SNARKSTK["SNARK stack"]
POLYCOM["polycom<br/><i>Basefold over foldable Reed-Solomon codes</i>"]
PIOP["piop<br/><i>sumcheck, GKR, Fiat-Shamir transcript</i>"]
CIRCUIT["circuit<br/><i>layered GKR circuits, polynomial export</i>"]
end
subgraph FOUND["Foundation"]
ARITH["arith<br/><i>RNS polynomials, NTT, number theory, MLE</i>"]
CRYPTO["crypto<br/><i>PRNG, BLAKE3, Merkle</i>"]
end
subgraph RUNTIME["Runtime"]
UTIL["util<br/><i>engine loading, kernels, io, info</i>"]
end
APP -.-> FHE
APP -.-> POLYCOM
APP -.-> PIOP
APP -.-> CIRCUIT
VFHE -.-> FHE
VFHE -.-> POLYCOM
FHE --> MLWE
FHE --> ARITH
MLWE --> ARITH
MLWE --> CRYPTO
POLYCOM --> PIOP
POLYCOM --> ARITH
POLYCOM --> CRYPTO
PIOP --> CIRCUIT
PIOP --> ARITH
PIOP --> CRYPTO
CIRCUIT --> ARITH
ARITH --> CRYPTO
FOUND --> UTIL
class CIRCUIT,PIOP,POLYCOM,FHE public
class VFHE planned
An arrow is an import: the module at its tail uses the one at its head. The
highlighted modules are where an application starts; arith’s rings and
polynomials appear in their APIs, so it is public as well. Every module
reaches C through util, drawn once, under the foundation. The dashed module
is the assembly still to come. This file holds the diagram’s source; GitHub
and the documentation site render it.
Module |
Concern |
C it owns |
Uses |
|---|---|---|---|
|
which engine loads, how Python reaches C ( |
|
|
|
randomness from entropy and from seeds, BLAKE3 hashing, the Merkle vector commitment |
|
|
|
RNS polynomial arithmetic over |
|
|
|
LWE, Module-LWE and MGSW over the |
|
|
|
the schemes: CKKS and BFV, CGGI16 and GP25 bootstrapping, CKKS linear transforms |
|
|
|
layered GKR arithmetic circuits and their export as the polynomials GKR reasons about; the |
|
|
|
polynomial interactive oracle proofs: sumcheck, GKR, the relations they prove, the Fiat-Shamir transcript |
|
|
|
polynomial commitments for |
|
|
|
the assembly of the two stacks into verifiable FHE; a README today |
Each module’s README.md describes its files.
The rules the layout keeps¶
Dependencies point down. A module imports the modules beneath it.
utilimports nothing of vfhe, and the foundation knows nothing of the stacks.One native library. Every module’s
c/srccompiles into one LTO’d extension per engine,_vfhe_native_<engine>, so kernels inline across module boundaries. A module declares the C it exposes to Python inpython/cdef/<name>.h, and Python calls it throughfrom vfhe.util.bindings import ffi, lib.Wire formats live in
proto/, one tree for every module, generated into_vfhe_proto. A schema is a contract between modules, reviewed as one surface.Vendored code lives in
external/: BLAKE3 and Unity.
What a new module’s parts are and where they go is in
DEVELOPMENT.md.