4. Deploying the contract
Last updated
Was this helpful?
Last updated
Was this helpful?
This guide walks you through deploying your Confidential ERC20 smart contract on the Sepolia test network.
Before proceeding, ensure you have:
A configured Hardhat project using the fhEVM Hardhat Template (see previous sections).
A crypto wallet installed (e.g., Metamask).
Some Sepolia ETH available for testing. If you don’t have enough ETH, use a Sepolia faucet to request free SepoliaETH for testing:
Generate a mnemonic seed for accounts using cast
:
(cast
is a Foundry function. If you don't have Foundry installed, run curl -L https://foundry.paradigm.xyz | bash
first):
Obtain a Sepolia RPC URL:
Sign up for a node provider such as Alchemy - https://www.alchemy.com/
or Infura - https://infura.io/
. Copy your Sepolia RPC URL.
Open the .env
file:
Past your mnemonic in the code:
MNEMONIC=<Your mnemonic generated>
Paste a Sepolia RPC URL:
SEPOLIA_RPC_URL=<Your node provider URL>
Verify generated accounts:
Open your wallet (e.g, MetaMask)
Import the first 2 accounts (e.g., Alice and Bob) into your wallet with their private keys.
Fund these 2 accounts with some Sepolia ETH.
In the deploy/
directory, there is a preconfigured deploy.ts
file that handles the deployment process. You can customize it or add your own scripts.
To deploy the contracts to Sepolia, run:
Once deployment is successful, you should see a console output that includes the contract address such as:
Congratulations! 🎉 You have deployed your first confidential ERC20 smart contract. Let's mint a few tokens and perform some encrypted transactions!
You can verify this contract on by searching for the deployed address.