Comment on page

Setting Up

How to set up a development environment for Fhenix

Prerequisites

In this guide we'll be using git, make and docker, typescript and pnpm. Installing these is usually pretty straightforward, but here's some helpful instructions if you need them
Installing Prerequisites

MacOS

# install git and make
brew install git make
# Installing node through Homebrew
brew install node
npm install -g pnpm

Linux/WSL

# update package list
sudo apt update
# install git and make
sudo apt install git make
# Install a more recent version of node
curl -sL https://deb.nodesource.com/setup_16.x -o /tmp/nodesource_setup.sh
sudo bash /tmp/nodesource_setup.sh
sudo apt install nodejs
sudo npm install -g pnpm

Installation

Set up from Template Project

First, let's clone our template project. Go to our hardhat template repo and click "use this template". Choose your new project name and set up a repository.
Next, clone the repository or open a cloud-based workspace.
Now, we'll set up the .env file, that contains the mnemonics for the keys that we will use for testing and deployment.
cp .env.example .env
Careful: We provide example mnemonics that can be used for testing, but highly recommend changing them for usage outside LocalFhenix
Lastly, we'll also want to install all the dependencies for the environment using
pnpm install

LocalFhenix

For development we recommend using LocalFhenix as a testing tool (pretty please hardhat network support one day). LocalFhenix is a complete Fhenix devnet and ecosystem containerized with Docker. It is similar to Ganache, and we'll use it to test our code during development.
To start LocalFhenix, use the following command:
pnpm start:localfhenix
If you want to learn more about this tool, check out our LocalFhenix Documentation.
If you want more control over the docker image being executed, you can manually execute and customize the following command:
docker run -it -p 8545:8545 -p 6000:6000 -p 5000:5000 \
--name localfhenix ghcr.io/fhenixprotocol/fhenix-devnet:0.1.6

Alternative - 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 by clicking the gitpod button in the repository you cloned previously.
The Gitpod environment comes with everything pre-installed and set up, so you can jump right in!