Page cover

🍨Testing with Brownie

A step-by-step guide for creating a Brownie 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 Brownie projects. If you already have an established Brownie project, skip to step 3.

For more information on Hardhat please access the documentation here: Brownie documentation

  1. Install Brownie.

    1. python3 -m pip install --user pipx

    2. python3 -m pipx ensurepath

    3. pipx install eth-brownie

    4. Run the command brownie to ensure the installation was successful.

user % brownie
Brownie v1.19.3 - Python development framework for Ethereum

Usage:  brownie <command> [<args>...] [options <args>]

Commands:
  init               Initialize a new brownie project
  bake               Initialize from a brownie-mix template
  pm                 Install and manage external packages
  compile            Compile the contract source files
  console            Load the console
  test               Run test cases in the tests/ folder
  run                Run a script in the scripts/ folder
  accounts           Manage local accounts
  networks           Manage network settings
  gui                Load the GUI to view opcodes and test coverage
  analyze            Find security vulnerabilities using the MythX API

Options:
  --help -h          Display this message
  --version          Show version and exit

Type 'brownie <command> --help' for specific options and more information about
each command.
  1. Create a new Brownie project.

    1. Create a new directory for your project: mkdir my-brownie-project

    2. Initialize your new project, we'll start from an ERC-20 template by running brownie bake-token

    3. You'll now have a folder called token, navigate there to compile your contracts.

  1. Compile your contracts

    1. Contracts are located at ./contracts

    2. brownie compile

  1. Configure your project for StealthTest

    1. Add StealthTest RPC URL and ChainID as a new network

  1. Deploy your contract to StealthTest

    1. Run the following command:

And that's it! You're now testing in private using StealthTest! πŸ’ͺ

Last updated

Was this helpful?