StealthTest
StealthTest Site
  • 👋Welcome to StealthTest
  • Features & Fundamentals
    • 🚰Faucet
    • 🗃️Logs
      • 📖Advanced Block Explorer
    • 💰Test Wallets
    • 🫂Teams & User Roles
      • 🎟️How to Create a Team
    • 🏢Smart Contract Repository
  • StealthTest API
    • 👨‍💻StealthTest API Reference Overview
    • 📖API Reference
      • Get Environments
      • Get Environment
      • Create Environment
      • Delete Environment
      • Get Wallet Information
      • Fund Wallet
    • 🎛️API Management
  • StealthTest Guides
    • 🧬Connecting to StealthTest Networks
      • 🦊Metamask
      • 3️⃣Thirdweb
      • 🪙Coinbase Wallet
    • ⚗️Test Wallet Import
      • 🦊Metamask Wallet Import
    • ⚡Testing with Remix
    • 🍬Testing with Truffle
    • 👷‍♂️Testing with Hardhat
    • 🍨Testing with Brownie
    • 🌲Testing with Web3.js + Cypress
Powered by GitBook
LogoLogo
On this page

Was this helpful?

  1. StealthTest Guides

Testing with Hardhat

A step-by-step guide for creating a Hardhat project and deploying it to your private StealthTest environment.

PreviousTesting with TruffleNextTesting with Brownie

Last updated 1 year ago

Was this helpful?

Before you begin, please make sure to 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:

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.

  1. Create a new Hardhat project.

    1. npm init -y

    2. npm install --save-dev hardhat

    3. npx hardhat

    4. You will be provided with a default project containing: a smart contract, tests, and a deploy script.

  2. Compile your contracts

    1. Contracts are located at ./contracts

    2. npx hardhat compile

  3. Configure your Hardhat project for StealthTest

    1. Within your hardhat.config.js

    2. Add an object called networks

    3. Inside that object, create an entry for stealthtest

    4. Add the url, chainId, and a list of accounts private keys you would like to use.

      1. 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 but please never share your private key with us or anyone you don't know.

    5. As an option, you can add stealthtest as your defaultNetwork so it will always be used.

require("@nomicfoundation/hardhat-toolbox");

/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
  solidity: "0.8.18",
  defaultNetwork: "stealthtest",
  networks: {
    stealthtest: {
      url: "https://5937ec2d-1c79-41b8-a5d1-c288e0e2efc7.ethereum.staging-42.nameless.io",
      chainId: 148073,
      accounts: ["0xf5d82a795ec5c5751161334378841e7a765182a047ee071bdfb1184f67b78d76"],
    },
  },
};
  1. Deploy your contracts

    1. npx hardhat run scripts/deploy.js

    2. stealthtest is your defaultNetwork, so your deployment(s) will be sent there

Example hardhat.config.js

And that's it! You're now testing in private using StealthTest!

🧠
💪
👷‍♂️
create your StealthTest environment
Hardhat documentation
Faucet
Here is what you will see when creating your project
Page cover image