I followed the answer to a similar question posted on here by adding dotenv: .env to the top of my brownie-config.yaml file but still having the same issue.

This is my code in the brownie-config.yaml file:

dotenv: .env

  from_key: ${PRIVATE_KEY}

This is the code from my deploy.py code:

from brownie import accounts, config, SimpleStorage, network

def deploy_simple_storage():
    account = get_account()
    simple_storage = SimpleStorage.deploy({"from": account})
    stored_value = simple_storage.retrieve()
    transaction = simple_storage.store(15, {"from": account})
    updated_stored_value = simple_storage.retrieve()

def get_account():
    if network.show_active() == "development":
        return accounts[0]
        return accounts.add(config["wallets"]["from_key"])

def main():

This is my terminal output:

BrownieSimpleStorageProject is the active project.

Running 'scripts/deploy.py::main'...
  File "brownie/_cli/run.py", line 50, in main
    return_value, frame = run(
  File "brownie/project/scripts.py", line 103, in run
    return_value = f_locals[method_name](*args, **kwargs)
  File "./scripts/deploy.py", line 22, in main
  File "./scripts/deploy.py", line 4, in deploy_simple_storage
    account = get_account()
  File "./scripts/deploy.py", line 18, in get_account
    return accounts.add(config["wallets"]["from_key"])
KeyError: 'wallets'

Any ideas on how to solve this?

Tree:enter image description here

  • What's your tree look like? Perhaps your folders are in the wrong place. Commented Nov 5, 2021 at 0:36
  • Added a screenshot of my tree to the post.
    – Basho
    Commented Nov 5, 2021 at 7:47
  • Problem solved!
    – Basho
    Commented Nov 5, 2021 at 19:38

1 Answer 1


Your brownie-config.yaml is in the wrong folder. Move it down to the root folder.

In this example, move it from tests to brownie_simple_storage

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.