Comment on page
🐣

Getting Started

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.
For your main deployment (either after your code is ready or if you just want to develop there) you'll probably want to deploy to the public Devnet, which you can do by connecting to the devnet.

Hardhat - LocalFhenix

Prerequisites

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 LocalFhenix

Start the local dev environment in a separate tab using:
pnpm start:localfhenix
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 5432. 🎉

Faucet

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.
pnpm 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:
curl "http://localhost:6000/faucet?address=${ADDRESS}"
Note that the Devnet doesn't have a faucet API. Instead, you get tokens from a the faucet web page here.

Gitpod

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.
You can run an instance of LocalFhenix in Gitpod by clicking here (or directly from the hardhat-template repo)

Remix

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 -
import "fhevm/lib/TFHE.sol";
We also provide an example contract that can be loaded into Remix, using the "Load From Github"
To connect Remix to Fhenix devnet, you can use the injected provider option after adding to Metamask.
Remix can also be connected to Hardhat and LocalFhenix, though the scope of that is beyond what I feel like writing now
😄
.