Prerequisites
This guide will walk you through installing all necessary dependencies from scratch, preparing you for developing and deploying fhEVM smart contracts using Hardhat.
To use Hardhat to build and deploy confidential smart contract, you need to have the following:
Node.js (v20 or later)
A package manager:
npm
,yarn
, orpnpm
Git for version control
Foundry for using the command
cast
If you already have these installed, skip ahead to 1. Setting Up Hardhat.
Step 1: Open your terminal
To run the installation commands, open a terminal:
Use your system's built-in terminal (e.g., Terminal on macOS, Command Prompt or PowerShell on Windows, or a Linux shell).
Alternatively, use the integrated terminal in a IDE such as Visual Studio Code (VS Code).
Step 2. Install Node.js and a package manager
Instead of installing Node.js directly, we recommend using Node Version Manager (nvm
), which allows you to manage multiple versions of Node.js:
Install Node.js using nvm. This installs the latest version of Node.js:
nvm install node
Install pnpm (optional but recommended for better speed and efficiency). After installing Node.js, you automatically have npm, so run:
npm install -g pnpm
Alternatively, you can continue using npm
or yarn
if you prefer.
Step 3. Install Git
Git is required for managing source code, cloning repositories, and handling version control. Install Git based on your operating system:
Linux: Use your distribution's package manager (e.g.,
sudo apt-get install git
on Ubuntu/Debian).Windows: Download Git for Windows.
macOS: Install via Homebrew with
brew install git
or download Git.
Step 4. Install Foundry
We will need the command cast
in our tutorial. This command is available with installing Foundry.
Install Foundry using the official installer:
curl -L https://foundry.paradigm.xyz | bash
Reload your terminal configuration:
source ~/.bashrc # Linux/WSL
# or
source ~/.zshrc # macOS/zsh
Run the Foundry installer:
foundryup
This will install all Foundry components, including cast
, forge
, anvil
, and chisel
.
To verify the installation, run:
cast --version
Next Steps
You now have all the necessary dependencies installed. Continue to 1. Setting Up Hardhat to begin creating and deploying your FHE smart contracts!
Last updated
Was this helpful?