👷♂️Testing with Hardhat
A step-by-step guide for creating a Hardhat project and deploying it to your private StealthTest environment.
Before you begin, please make sure to create your StealthTest environment and have access to the RPC URL and chain ID.
This document is intended to act as a quick start integration guide for new Hardhat projects. If you already have an established Hardhat project, skip to step 3.
For more information on Hardhat please access the documentation here: Hardhat documentation
We will never ask you for your private key, nor will it ever be required at any step in the process of creating a StealthTest environment.
Create a new Hardhat project.
npm init -y
npm install --save-dev hardhat
npx hardhat
You will be provided with a default project containing: a smart contract, tests, and a deploy script.
Compile your contracts
Contracts are located at
./contracts
npx hardhat compile
Configure your Hardhat project for StealthTest
Within your
hardhat.config.js
Add an object called
networks
Inside that object, create an entry for
stealthtest
Add the
url
,chainId
, and a list ofaccounts
private keys you would like to use.Note: Each StealthTest environment comes with 5 pre-funded wallets, but please never use these on mainnet. You may also quickly fund your own wallet with our Faucet but please never share your private key with us or anyone you don't know.
As an option, you can add
stealthtest
as yourdefaultNetwork
so it will always be used.
🧠 Example hardhat.config.js
Deploy your contracts
npx hardhat run scripts/deploy.js
stealthtest
is yourdefaultNetwork
, so your deployment(s) will be sent there
And that's it! You're now testing in private using StealthTest! 💪
Last updated