TFHE Library

The TFHE functions can be used on encrypted data inside fhEVM. For instance, you could add 2 encrypted states together with TFHE.add(encryptedValue1, encryptedValue2).

To access all the TFHE functions, you can just import the library at the beginning of your solidity code:

pragma solidity ^0.8.20;

import "fhevm@v0.3.0/lib/TFHE.sol";

We recommend to use the same solidity version (for example v0.8.24) throughout your whole project, unless you are using Foundry that can work with multiple solidity versions. In Remix you might want to stick to v0.8.24.

Here's the list of operations:

And the list of comparisons:

The library has a limited support for operator overloading, so far only +, -, *, &, |, ^, -, ~ are supported for all encrypted types.

More information about the supported operations can be found on the Rust FHE library from Zama: TFHE-rs

Last updated