When working with Brownie and private key environment variables, you'll need to make sure a few things are set.
- In your
.env
file, you have your PRIVATE_KEY
variable set correctly. If using a .env
file, it should look something like:
export PRIVATE_KEY='0xasdfasdfasdfasdfasdfasdfasdfas'
If you exported your private key from metamask, you'll want to append a 0x
to the start of your key.
- You'll want to make sure your
brownie-config.yaml
is set to include a .env
file, if that's what you're using to set your environment variable.
In your brownie-config.yaml
:
dotenv: .env
- Then finally, you'll want your environment variable set correctly in your
brownie-config.yaml
, something like:
wallets:
from_key: ${PRIVATE_KEY}
Where you are using the appropriate $ and bracket syntax.