我正在做Patrick 16小时教程链接,我得到了这个错误。关于这件事,我一直在看很多线索,但没能解决。
我的代码:
deploy.py
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()
.env
export WEB3_INFURA_PROJECT_ID='xxxxxxxxxxxxxxxxxxxxxxx`
export PRIVATE_KEY='0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
brownie-config.yaml
dotenv: .env
wallets:
from_key: ${PRIVATE_KEY}
当我收到这个错误时,我正在运行"brownie脚本/Deploy.py-network“。
发布于 2022-04-19 14:56:44
使用适当的缩进配置brownie-config.yaml
,因为它们是缩进敏感的。详情如下:
dotenv: .env
wallets:
from_key: ${PRIVATE_KEY}
https://ethereum.stackexchange.com/questions/123106
复制相似问题