The Configuration File¶
Every project has a file brownie-config.yaml
that holds all the configuration settings. The defaut configuration is as follows.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | # Brownie configuration file
# https://eth-brownie.readthedocs.io/en/stable/config.html
network:
default: development # the default network that brownie connects to
settings:
gas_limit: "auto"
gas_price: "auto"
persist: true
reverting_tx_gas_limit: false # if false, reverting tx's will raise without broadcasting
networks:
# any settings given here will replace the defaults
development:
host: http://127.0.0.1
gas_price: 0
persist: false
reverting_tx_gas_limit: 6721975
test_rpc:
cmd: ganache-cli
port: 8545
gas_limit: 6721975
accounts: 10
evm_version: istanbul
mnemonic: brownie
# set your Infura API token to the environment variable WEB3_INFURA_PROJECT_ID
mainnet:
host: https://mainnet.infura.io/v3/$WEB3_INFURA_PROJECT_ID
goerli:
host: https://goerli.infura.io/v3/$WEB3_INFURA_PROJECT_ID
kovan:
host: https://kovan.infura.io/v3/$WEB3_INFURA_PROJECT_ID
rinkeby:
host: https://rinkeby.infura.io/v3/$WEB3_INFURA_PROJECT_ID
ropsten:
host: https://ropsten.infura.io/v3/$WEB3_INFURA_PROJECT_ID
classic:
host: https://www.ethercluster.com/etc
kotti:
host: https://www.ethercluster.com/kotti
pytest:
# these settings replace the defaults when running pytest
gas_limit: 6721975
default_contract_owner: false
reverting_tx_gas_limit: 6721975
revert_traceback: false
compiler:
evm_version: null
minify_source: false
solc:
version: null
optimize: true
runs: 200
colors:
key:
value: bright blue
callable: bright cyan
module: bright blue
contract: bright magenta
contract_method: bright magenta
string: bright magenta
dull: dark white
error: bright red
success: bright green
pending: bright yellow
|
When using the Brownie console or writing scripts, you can view and edit configuration settings through the config
dict. Any changes made in this way are temporary and will be reset when you exit Brownie or reset the network.
Note
If you are experiencing errors or warnings related to the configuration file, delete it and then run brownie init
from the root folder of your project. This will create a clean copy of the config file.
Settings¶
The following settings are available:
-
network
¶ Defines the available networks and how Brownie interacts with them.
default
: The default network that brownie connects to when loaded. If a different network is required, you can override this setting with the--network
flag in the command line.
-
network.
settings
¶ Default settings for every network. The following properties can be set:
gas_price
: The default gas price for all transactions. If set toauto
the gas price will be determined usingweb3.eth.gasPrice
.gas_limit
: The default gas limit for all transactions. If set toauto
the gas limit will be determined usingweb3.eth.estimateGas
.persist
: IfTrue
, Brownie will remember information about deployed contracts in between sessions. This is enabled by default for all non-local networks.reverting_tx_gas_limit
: The gas limit to use when a transaction would revert. If set tofalse
, transactions that would revert will instead raise aVirtualMachineError
.
-
network.
networks
¶ Settings specific to individual networks. All values outlined above in
settings
are also valid here and will override the defaults.Additionally, you must include a host setting in order to connect to that network:
host
: The address of the RPC API you wish to connect to. You can include environment variables, they will be expanded when attempting connect. The default settings use Infura and look for the project ID token asWEB3_INFURA_PROJECT_ID
.
-
networks.
test_rpc
¶ An optional dictionary outlining settings for how the local RPC client is loaded. If not included, Brownie will not attempt to launch or attach to the process. See The Local RPC Client for more details.
test-rpc
properties include:cmd
: The command-line argument used to load the client. You can add any extra flags here as needed.port
: Port the client should listen on.gas_limit
: Block gas limit.accounts
: The number of funded accounts inweb3.eth.accounts
.evm_version
: The EVM version to compile for. Ifnull
the most recent one is used. Possible values arebyzantium
,constantinople
,petersburg
andistanbul
.mnemonic
: Local accounts are derived from this mnemonic. If set tonull
, you will have different local accounts each time Brownie is run.account_keys_path
: Optional path to save generated accounts and private keys as a JSON object
-
compiler
¶ Compiler settings. See compiler settings for more information.
evm_version
: The EVM version to compile for. Ifnull
the most recent one is used. Possible values arebyzantium
,constantinople
,petersburg
,istanbul
,atlantis
andagharta
.minify_source
: Iftrue
, contract source is minified before compiling.
-
compiler.
solc
¶ Settings specific to the Solidity compiler.
version
: The version of solc to use. Should be given as a string in the format0.x.x
. If set tonull
, the version is set based on the contract pragma. Brownie supports solc versions>=0.4.22
.optimize
: Set totrue
if you wish to enable compiler optimization.runs
: The number of times the optimizer should run.
-
pytest
¶ Properties that only affect Brownie’s configuration when running tests. See test configuration settings for more information.
gas_limit
: Replaces the default network gas limit.default_contract_owner
: Iffalse
, deployed contracts will not remember the account that they were created by and you will have to supply afrom
kwarg for every contract transaction.reverting_tx_gas_limit
: Replaces the default network setting for the gas limit on a tx that will revert.revert_traceback
: iftrue
, unhandledVirtualMachineError
exceptions will include a full traceback for the reverted transaction.
-
colors
¶ Defines the colors associated with specific data types when using Brownie. Setting a value as an empty string will use the terminal’s default color.