fhEVM

fhEVM is an EVM with TFHE (Torus Fully Homomorphic Encryption) added at a pre-compile level. Homomorphic operations are exposed with a precompiled contract through static addresses and allow computations to happen on both encrypted and non-encrypted data. The main advantage of TFHE is its focus on optimization and efficiency. By utilizing mathematical structures from the torus and incorporating bootstrapping, TFHE aims to reduce the impact of noise growth and improve the performance of homomorphic computations.

One of the key advantages of fhEVM is that it empowers developers to leverage the robust and well-maintained Ethereum and Solidity toolsets, including popular tools like Remix, Hardhat, and Metamask. As a result, developers can construct their application logic within a familiar environment, and the Solidity programming language. The seamless integration with existing toolsets is a result of the fhEVM precompiled contracts being invoked through Yul inline assembly, while FHE functionalities are implemented as conventional Solidity functions or overloaded operators.

fhEVM introduces encrypted integer data types (e.g. ebool, euint8, euint16, and euint32), TFHE operations ranging from arithmetic (e.g. TFHE.sub, TFHE.mul) to bitwise shifts (TFHE.shr, TFHE.xor, TFHE.and), and TFHE comparisons (e.g. TFHE.eq, TFHE.gt, TFHE.lt) that can be performed on top of encrypted values. The gas price for TFHE operations is configured at the contract level, providing greater flexibility compared to setting it at the bytecode level.

Encryption and decryption processes are executed utilizing a global network key, distributed among validators. This distribution ensures that no individual entity can decrypt the blockchain state independently - a consensus must be reached collectively. The network key is generated through an initial setup phase orchestrated by the founding validators, employing a threshold protocol to enhance security.

Last updated