> For the complete documentation index, see [llms.txt](https://docs.stealthtest.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stealthtest.com/stealthtest-guides/testing-with-brownie.md).

# Testing with Brownie

**Before you begin, please make sure to** [**create your StealthTest environment**](https://app.nameless.io/login) **and have access to the RPC URL and chain ID.**&#x20;

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](https://eth-brownie.readthedocs.io/en/stable/)

{% hint style="danger" %}
**We will never ask you for your private key, nor will it ever be required to create a StealthTest environment.**
{% endhint %}

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.
```

2. **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.

```
my-brownie-project % cd token
token % ls
LICENSE			contracts		scripts
README.md		interfaces		tests
brownie-config.yaml	reports
build			requirements.txt
```

3. **Compile your contracts**
   1. Contracts are located at `./contracts`
   2. `brownie compile`

```
token % brownie compile
Brownie v1.19.3 - Python development framework for Ethereum

Compiling contracts...
  Solc version: 0.6.12
  Optimizer: Enabled  Runs: 200
  EVM Version: Istanbul
Generating build data...
 - SafeMath
 - Token

Project has been compiled. Build artifacts saved at /Users/stealthtestuser/my-brownie-project/token/build/contracts
```

4. **Configure your project for StealthTest**
   1. Add StealthTest RPC URL and ChainID as a new network

```
brownie networks add Ethereum stealthtest-eth host=https://<namespace>.ethereum.nameless.io chainid=12345
```

5. **Deploy your contract to StealthTest**
   1. Run the following command:

<pre><code><strong>token % brownie run token.py --network stealthtest-eth
</strong>Brownie v1.19.3 - Python development framework for Ethereum

TokenProject is the active project.

Running 'scripts/token.py::main'...
Transaction sent: 0xa862fd95830279bb09d1599ee08433f9e66fc481e39fbfd3866ecfafc18f6a20
  Gas price: 40.0 gwei   Gas limit: 573532   Nonce: 5
  Token.constructor confirmed   Block: 110   Gas used: 521393 (90.91%)
  Token deployed at: 0xB5f03cAb4f294096940B7bb0097B034a05D0e1f5
</code></pre>

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