The best way to start writing smart contracts with fhEVM is to use our Hardhat template.
It allows you to start a fhEVM docker image and run your smart contract on it. Read the README for more information.
You can use Remix to interact with a blockchain using fhEVM. If you want to send an encrypted input, you need to encrypt it with fhevmjs CLI tool for example. It becomes more complex if you want to reencrypt a value directly in Remix.
To avoid this problem, we developed a version of Remix IDE with these two missing features:
Encryption of input
Generation of public key and signature for reencryption and decryption.
You can use it on https://remix.zama.ai.
First, read the usage section regarding Solidity version and EVM.
To import TFHE library, simply import it at the top of your contract.
import "fhevm/lib/TFHE.sol";
UPDATE: Remix doesn't take into consideration the package.json of fhevm to fetch dependencies. If you're using fhevm/abstracts/EIP712WithModifier.sol
, it will fetch the latest version of the @openzeppelin/contracts
package, which runs only on the Shanghai EVM (Solidity version ^0.8.20). Since fhEVM is not compatible with versions above 0.8.19, it will fail. To fix that, go to .deps/fhevm/abstracts/EIP712WithModifier.sol
and change the imports as follows:
Be sure to be on the correct network before deploying your contract
````
We provide a docker image to spin up a fhEVM node for local development.
Welcome to the documentation for fhEVM Solidity Library! This comprehensive guide provides developers with detailed information on the library's functions, parameters, and usage examples. Explore how to leverage TFHE's powerful capabilities for computing over encrypted data within Solidity smart contracts, enabling secure computations and encrypted data manipulation. Unlock a new level of privacy and confidentiality in your blockchain applications with fhEVM Solidity Library.
Our library TFHE requires Solidity version 0.8.19 specifically, as we rely on features exclusive to this version and do not currently provide support for versions beyond it.
Our library compiles seamlessly with the traditional Solidity compiler and is generally compatible with traditional Solidity tools. However, it's important to note that the execution is designed to function exclusively on a fhEVM. As a result, this library is not intended for deployment on a classic EVM, such as Goerli or Ganache.
To get started with fhEVM Solidity Library, you need to install it as a dependency in your JavaScript project. You can do this using npm (Node Package Manager) or Yarn. Open your terminal and navigate to your project's directory, then run one of the following commands:
This will download and install the fhEVM Solidity Library and its dependencies into your project.