docs/solidity-guides/getting-started/quick-start-tutorial/setup.md
In this section, you’ll learn how to set up a FHEVM Hardhat development environment using the FHEVM Hardhat template as a starting point for building and testing fully homomorphic encrypted smart contracts.
{% stepper %} {% step %}
Ensure that Node.js is installed on your machine.
v18.x, v20.x){% hint style="warning" %} Hardhat does not support odd-numbered Node.js versions. If you’re using one (e.g., v21.x, v23.x), Hardhat will display a persistent warning message and may behave unexpectedly. {% endhint %}
To verify your installation:
node -v
npm -v
{% endstep %}
{% step %}
{% hint style="info" %} See Github doc: Creating a repository from a template {% endhint %}
{% endstep %}
{% step %}
Now that your GitHub repository has been created, you can clone it to your local machine:
cd <your-preferred-location>
git clone <url-to-your-new-repo>
# Navigate to the root of your new FHEVM Hardhat project
cd <your-new-repo-name>
Next, let’s install your local Hardhat development environment. {% endstep %}
{% step %}
From the project root directory, run:
npm install
This will install all required dependencies defined in your package.json, setting up your local FHEVM Hardhat development environment. {% endstep %}
{% step %}
If you do plan to deploy to the Sepolia Ethereum Testnet, you'll need to set up the following Hardhat Configuration variables.
MNEMONIC
A mnemonic is a 12-word seed phrase used to generate your Ethereum wallet keys.
npx hardhat vars set MNEMONIC
INFURA_API_KEY
The INFURA project key allows you to connect to Ethereum testnets like Sepolia.
npx hardhat vars set INFURA_API_KEY
If you skip this step, Hardhat will fall back to these defaults:
MNEMONIC = "test test test test test test test test test test test junk"INFURA_API_KEY = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"{% hint style="warning" %} These defaults are not suitable for real deployments. {% endhint %}
{% hint style="warning" %}
If any of the requested Hardhat Configuration Variables is missing, you'll get an error message like this one:Error HH1201: Cannot find a value for the configuration variable 'MNEMONIC'. Use 'npx hardhat vars set MNEMONIC' to set it or 'npx hardhat var setup' to list all the configuration variables used by this project.
{% endhint %} {% endstep %} {% endstepper %}
Congratulations! You're all set to start building your confidential dApp.
If you're using Visual Studio Code, there are some extensions available to improve you your development experience:
esbenp.prettier-vscode,dbaeumer.vscode-eslintSolidity support (pick one only):
juanblanco.soliditynomicfoundation.hardhat-solidityIf you'd like to start from a clean slate, you can reset your FHEVM Hardhat project by removing all example code and generated files.
# Navigate to the root of your new FHEVM Hardhat project
cd <your-new-repo-name>
Then run:
rm -rf test/* contracts/* deploy ./fhevmTemp ./artifacts ./cache ./coverage ./types ./coverage.json ./dist