deploying on rinkeby network in brownie
JayD-123 opened this issue · 3 comments
every time I try to deploy this script i get a lot of text and then a ' none type' error below. My code is located below the error, I am new to coding and have no experience with it so any help would be greatly appricated! I am running on windows 10
PS C:\Users\PC001\demos\brownie_simple_storage> brownie run scripts/deploy.py --network rinkeby
INFO: Could not find files for the given pattern(s).
Brownie v1.19.0 - Python development framework for Ethereum
BrownieSimpleStorageProject is the active project.
Running 'scripts\deploy.py::main'...
File "C:\Users\PC001\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\_cli\run.py", line 51, in main
return_value, frame = run(
File "C:\Users\PC001\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\project\scripts.py", line 110, in run
return_value = f_locals[method_name](*args, **kwargs)
File ".\scripts\deploy.py", line 30, in main
deploy_simple_storage()
File ".\scripts\deploy.py", line 5, in deploy_simple_storage
account = get_account()
File ".\scripts\deploy.py", line 26, in get_account
return accounts.add(config["wallets"]["from_key"])
TypeError: 'NoneType' object is not subscriptable
Code:
from brownie import accounts, config, SimpleStorage, network
def deploy_simple_storage():
account = get_account()
# print(account)
# account = accounts.load("freecodecamp-account")
# print(account)
# account = accounts.add(config["wallets"]["from_key"])
# print(account)
simple_storage = SimpleStorage.deploy({"from": account})
# Transct
# Call
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()
What's your brownie-config.yaml look like? You need this:
wallets:
from_key: ${PRIVATE_KEY}
@PatrickAlphaC my .yaml looks like this
dotenv: .env
wallets:
from_key: ${PRIVATE_KEY}
Could it be a problem with my .env file?
my .env file is here:
export PRIVATE_KEY = 0x506678ab0efddacfdb1f6033d3bba62fba48f3ebbbd6f95d6ff75c89971961b8
export WEB3_INFURA_PROJECT_ID = 33b4503cedbe43c18cfe3ea62f871d14
the private key only contains test eth
Hi! I'm a security researcher @trufflesecurity. I found a valid API key leaked in a comment in this Issue. I highly recommend rotating the API key immediately (not just deleting the comment). Here's a blog post I wrote on remediating these types of vulnerabilities: https://trufflesecurity.com/blog/remediate-leaked-api-keys-with-key-rotation.If you can't find the leaked API key, you can use the following TruffleHog command to automatically scan for it:
trufflehog github --repo https://github.com/<your_username>/<your_reponame> --issue-comments --only-verified
If it's not clear where/what the security issue is, please let me know. I'd be happy to help. Please note that the API key might be in the past edit of a comment.(cc @JayD-123)
Based