Lesson 5: ValueError: Unable to expand environment variable in host setting: 'https://rinkeby.infura.io/v3/$WEB3_INFURA_PROJECT_ID' #1199
-
I was doing the Patrick Collins 16 hours tutorial link and I got this error when running brownie run scripts/deploy.py --network rinkeby: "[ValueError: Unable to expand environment variable in host setting: 'https://rinkeby.infura.io/v3/$WEB3_INFURA_PROJECT_ID']" I have been looking at a lot of threads about this but could not solve it. I`m on windows. Help is much apricated 🙂 My code: deploy.py
.env
brownie-config.yaml
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Things that might cause the problem:
Just for reference here are the code fragments you are using with correct formatting: export WEB3_INFURA_PROJECT_ID=n4n0b1t3n4n0b1t3n4n0b1t3n4n0b1t3
export WEB3_ALCHEMY_PROJECT_ID=n4n0b1t3n4n0b1t3n4n0b1t3n4n0b1t3
export PRIVATE_KEY=0xn4n0b1t3n4n0b1t3n4n0b1t3n4n0b1t3n4n0b1t3n4n0b1t3n4n0b1t3n4n0b1t3
### If you want to verify contracts on etherscan
export ETHERSCAN_TOKEN=N4N0B1T3N4N0B1T3N4N0B1T3N4N0B1T3 The config.yaml file dotenv: .env
wallets:
from_key: ${PRIVATE_KEY} 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()
print(stored_value)
transaction = simple_storage.store(15, {"from": account})
transaction.wait(1)
updated_stored_value = simple_storage.retrieve()
print(updated_stored_value)
def get_account():
if network.show_active() == "development":
return accounts[0]
else:
return accounts.add(config["wallets"]["from_key"])
def main():
deploy_simple_storage() |
Beta Was this translation helpful? Give feedback.
Things that might cause the problem:
example:
brownie run .\scripts\deploy.py --network rinkeby
Just for reference here are the code fragmen…