2

I am learning how to us brownie for NFTs and I don't know where to put my infura API Key. I see in the Github repo that the .env file looks like this:

export PRIVATE_KEY=asafdagadd
export WEB3_INFURA_PROJECT_ID=asdfsdf

But where does the API key go? Just the ID won't let me make API calls right?

1 Answer 1

2

Brownie actually has infura built in, so you only need the WEB3_INFURA_PROJECT_ID and brownie will sort all the URLs and such under the hood.

Test it out and see what happens!

3
  • It failed with this error "HTTPError: 403 Client Error: Forbidden for url: rinkeby.infura.io/v3/<myprojectId>" but that was what I predicted. My Infura API needs the Secret Key right? Otherwise it would be a big security vulnerability because anyone could make an API request to my Infura project if they knew the project ID right? Commented Oct 29, 2021 at 10:00
  • 1
    Oh nevermind it worked! From what I researched the problem was that Infura only lets you make API calls for 1 smart contract to each Infura project. I had already used the last project for another smart contract. I made a new Infura project and used the new project ID. Btw, I feel like that's a security vulnerability that I don't have to put my Infura secret in a post request to make API calls. Commented Oct 29, 2021 at 10:21
  • 1
    Potentially, you can alternatively always run your own ETH node if you prefer! Commented Nov 3, 2021 at 20:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.