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
# Brownie configuration file
# https://eth-brownie.readthedocs.io/en/latest/config.html
network:
    default: development # the default network that brownie connects to
    settings:
        gas_limit: false
        gas_price: false
        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
            persist: false
            reverting_tx_gas_limit: 6721975
            test_rpc:
                cmd: ganache-cli
                port: 8545
                gas_limit: 6721975
                accounts: 10
                evm_version: petersburg
                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
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:
    solc:
        version: null
        evm_version: null
        optimize: true
        runs: 200
        minify_source: false
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 left as false the gas price will be determined using web3.eth.gasPrice.
  • gas_limit: The default gas limit for all transactions. If left as false the gas limit will be determined using web3.eth.estimateGas.
  • persist: If True, 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 to false, transactions that would revert will instead raise a VirtualMachineError.
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 as WEB3_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 in web3.eth.accounts.
  • evm_version: The EVM version to compile for. If null the most recent one is used. Possible values are byzantium, constantinople and petersburg.
  • mnemonic: Local accounts are derived from this mnemonic. If set to null, you will have different local accounts each time Brownie is run.
compiler

Compiler settings. See compiler settings for more information.

compiler.solc

Settings specific to the Solidity compiler. At present this is the only compiler supported by Brownie.

  • version: The version of solc to use. Should be given as a string in the format 0.x.x. If set to null, the version is set based on the contract pragma. Brownie supports solc versions >=0.4.22.
  • evm_version: The EVM version to compile for. If null the most recent one is used. Possible values are byzantium, constantinople and petersburg.
  • optimize: Set to true if you wish to enable compiler optimization.
  • runs: The number of times the optimizer should run.
  • minify_source: If true, contract source is minified before compiling.
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: If false, deployed contracts will not remember the account that they were created by and you will have to supply a from 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: if true, unhandled VirtualMachineError 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.