0

I am using brownie to deploy the mart contract. But the brownie configuration file details is not accessing in deployment.py

brownie-config.yaml

project_structure:
    build: build
    contracts: contracts
    interfaces: interfaces
    reports: reports
    scripts: scripts
    tests: tests

dotenv: .env

wallets:
  from_key: ${PRIVATE_KEY}

networks:
    default: development
    development:
        gas_limit: max
        gas_buffer: 1
        gas_price: 70
        max_fee: null
        priority_fee: 60
        reverting_tx_gas_limit: max
        default_contract_owner: true
        cmd_settings: null

.env

export PRIVATE_KEY=0x<PRIVATE KEY> 

deployment.py

from brownie import project, Contract, accounts, config
import brownie

myproject = project.load('/home/ubuntu/Desktop/my_contract_local')
account = accounts.add(config["wallets"]["from_key"])
print(account)

This give me the following error

KeyError: 'wallets'

Update

I am executing this file using $ python deployment.py and not using $ brownie run deployment.py

1
  • You need to use "brownie run /path/deployment.py it isn't supposed to work without it. But also note that the issue here seems to be directly related with the way you adding a new account.
    – Sky
    Nov 8, 2022 at 13:57

1 Answer 1

0

Have you wrapped your private key in ' (single quotes) in the .env file like this?

export PRIVATE_KEY='a714b2b7xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
1
  • I tried with and without single quotes
    – imhans4305
    Nov 8, 2022 at 12:55

Your Answer

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

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