Comment on page
A description of the different ways to set up a development environment
There are a few different ways to set up an environment for development on Fhenix. All the tools you know from Solidity are mostly supported, though the addition of FHE means that a few custom tools are needed. Here we'll describe the different ways you can set up your development environment.
You can either choose a Local, Gitpod or Remix based environment.
LocalFhenix is a complete Fhenix devnet and ecosystem containerized with Docker. It simplifies the way contract developers test their contracts in a sandbox before they deploy them on a testnet or mainnet - similar to Ganache, or other local network environments.
LocalFhenix comes preconfigured with opinionated, sensible (hopefully) defaults for standard testing environments.
We also provide a hardhat template available that comes "batteries included", with everything you need to hit the ground running. The template is available here. You can create a new repository, or clone it locally:
git clone https://github.com/fhenixprotocol/hardhat-template
You'll also probably want to set an .env file with your mnemonics:
cp .env.example .env
Start the local dev environment in a separate tab using:
Note that you can run LocalFhenix without using the template directly as a docker image using the command
docker run -it -p 8545:8545 -p 6000:6000 \
--name localfhenix ghcr.io/fhenixprotocol/fhenix-devnet:0.1.6
In this example port 8545 will be exposed as the JSON-RPC port, and port 6000 is used for the built-in faucet
You've now officially created a local Fhenix devnet with chain-id
To start developing on LocalFhenix, we'll need to send some FHE to a new address. For this, we can use the built-in faucet.
The faucet sends 100 FHE every call. The pnpm command uses the mnemonics from your .env file. If you want to use a different address, you can directly call the faucet API:
If you're more of a cloud-based developer, you can skip all the installation steps and work directly with our Gitpod environment. This environment includes a LocalFhenix instance and all the tools you need to dive in.
To get up and running with Remix, all you need is to include the TFHE.sol solidity files to your project so the compiler knows what to do. You can do so by importing TFHE.sol from your contract directly -
We also provide an example contract that can be loaded into Remix, using the "Load From Github"
Remix can also be connected to Hardhat and LocalFhenix, though the scope of that is beyond what I feel like writing now