Connecting to the Network
First, make sure that Brownie is able to connect to your private network. You will have to add a custom network to Brownie's network settings. Here is an example command that declares a live network with the name "private" at 127.0.0.1
, port 8545:
brownie networks add live private host=https://127.0.0.1:8545 chainid=1337
You can use brownie networks --help
for more information on possible settings.
Deploying your Contract
The simplest way to deploy is via a deployment script. Here is an example deployment script for a basic ERC20, taken from the documentation:
from brownie import *
def main():
accounts[0].deploy(Token, "Test Token", "TEST", 18, "1000 ether")
Save your deployment script within the scripts/
folder of your project.
To run the script on your local network, use the --network
flag. For example, to run a deployment script named deployment.py
on a network named "private":
brownie run deployment --network private