As I myself struggled with this particular problem when I started this course and could not find any information regarding this in the repository. I thought I'd share this with you to save your time and to help you all in your journey.
Note:I would be working with Sepolia but this process can work for any testnet.
First off you are gonna need to sign up with Alchemy.
Refer to this link to create your new API Key via Alchemy and when doing so make sure to add Sepolia as Network.
Once all set, open up the .env file from the repo in VS Code and change your WEB3_INFURA_PROJECT_ID to:
Next set up a MetaMask account, we can use the account private key and some slick Brownie commands in order to add the account into the fold of our Brownie accounts object. To try it out:
Here, my-new-account is the unique id for referring to the new account. You can give your own id for the account. When we execute this command, Brownie will ask us to enter the private key of the account and also prompt us for a password for encrypting the account details.
Once you generate the new account, you can view it using the following command:
brownie accounts list
This will display all the local (ones that are stored in the system) accounts that we can access:
Brownie v1.16.4 - Python development framework for Ethereum
Found 2 accounts:
├─SampleAccount: 0x23d1B3E3dE8235e8b15EdD030E2D69959eE88835
└─my-new-account: 0xc4f02d6b1bE3804Dc8c4fDD6c2A890DbAFf60c62
At last, use the brownie networks add command with the node endpoint. For example, Ethereum mainnet:
brownie networks add Ethereum ID name="NETWORK_NAME" host= YOUR_CHAINSTACK_ENDPOINT chainid=NETWORK_ID
Where,
ID: Any name that you will use as the network tag to run a deployment. For example, chainstack-mainnet.
NETWORK_NAME: Any name that you want to identify the network by in the list of networks. For example, Mainnet (Chainstack).
YOUR_CHAINSTACK_ENDPOINT: Your node HTTPS or WSS endpoint protected either with the key or password
To verify if your network was added successfully you can run the following command:
brownie networks list
You should be able to see your network under the Ethereum header
The following networks are declared:
Ethereum
├─Mainnet (Infura): mainnet
├─Ropsten (Infura): ropsten
├─Rinkeby (Infura): rinkeby
├─Goerli (Infura): goerli
├─Kovan (Infura): kovan
└─Sepolia (Alchemy): sepolia
Ethereum Classic
├─Mainnet: etc
└─Kotti: kotti
Development
├─Ganache-CLI: development
└─Ganache-CLI (Mainnet Fork): mainnet-fork
Example to run the deployment script relevant with this repo:
brownie run scripts/simple_collectible/deploy_simple.py --network sepolia
I implemented the above stated steps and I was able to work with the Sepolia Testnet. These steps should be enough I suppose, if not down below you can find the shared information and more if you are still struggling to find a solution.
As I myself struggled with this particular problem when I started this course and could not find any information regarding this in the repository. I thought I'd share this with you to save your time and to help you all in your journey.
Note: I would be working with Sepolia but this process can work for any testnet.
First off you are gonna need to sign up with Alchemy.
Once all set, open up the .env file from the repo in VS Code and change your WEB3_INFURA_PROJECT_ID to:
Next set up a MetaMask account, we can use the account private key and some slick Brownie commands in order to add the account into the fold of our Brownie accounts object. To try it out:
Use the following command to add a new account:
Here, my-new-account is the unique id for referring to the new account. You can give your own id for the account. When we execute this command, Brownie will ask us to enter the private key of the account and also prompt us for a password for encrypting the account details.
Once you generate the new account, you can view it using the following command:
This will display all the local (ones that are stored in the system) accounts that we can access:
At last, use the brownie networks add command with the node endpoint. For example, Ethereum mainnet:
Where,
Exact command:
To verify if your network was added successfully you can run the following command:
You should be able to see your network under the Ethereum header
Example to run the deployment script relevant with this repo:
I implemented the above stated steps and I was able to work with the Sepolia Testnet. These steps should be enough I suppose, if not down below you can find the shared information and more if you are still struggling to find a solution.
References: --> https://chainstack.com/the-brownie-tutorial-series-part-2/#4-using-testnets --> https://docs.chainstack.com/docs/ethereum-tooling#metamask --> https://www.codeforests.com/2022/01/27/python-brownie-network-setup/