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
, or pnpm
Git for version control
Foundry for using the command cast
If you already have these installed, skip ahead to 1. Setting Up Hardhat.
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).
VS code provide the official Hardhat extension for an enhanced development experience with Hardhat.
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:
Install pnpm (optional but recommended for better speed and efficiency). After installing Node.js, you automatically have npm, so run:
Alternatively, you can continue using npm
or yarn
if you prefer.
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.
We will need the command cast
in our tutorial. This command is available with installing Foundry.
Install Foundry using the official installer:
Reload your terminal configuration:
Run the Foundry installer:
This will install all Foundry components, including cast
, forge
, anvil
, and chisel
.
To verify the installation, run:
You now have all the necessary dependencies installed. Continue to 1. Setting Up Hardhat to begin creating and deploying your FHE smart contracts!