404 page not found

Hi,

404 page not found

Why I am getting this error?

External Image

Try sending a full RPC request using your key, something similar to:

curl https://mainnet.infura.io/v3/[YOUR PROJECT ID] -X POST -H ā€œContent-Type: application/jsonā€ -d ā€˜{ā€œjsonrpcā€:ā€œ2.0ā€,ā€œmethodā€:ā€œeth_blockNumberā€,ā€œparamsā€:[],ā€œidā€:74}ā€™

More details can be found in the docs on our website.

2 Likes

Make sure there is no space between ā€œType:ā€ and ā€œapplicationā€ in ā€œContent-Type:application/jsonā€. It took me quite a while to make it work.

Hello, I cannot get this to work . Even pasting the URL with my project ID in Firefox gives me a 404 error:

curl https://mainnet.infura.io/v3/[MY PROJECT NAME] -X POST -H ā€œContent-Type:application/jsonā€ -d ā€˜{ā€œjsonrpcā€:ā€œ2.0ā€,ā€œmethodā€:ā€œeth_blockNumberā€,ā€œparamsā€:[],ā€œidā€:74}ā€™

what am I missing above ?

Hi @fovanessians, and welcome to the Infura community! Are you pasting in your project name or project id at the end of the URL? You will need to paste in the ID from your dashboard project settings page.

I got this to work with the following command:

curl -u :SECRET_ID -d ā€˜{ā€œjsonrpcā€:ā€œ2.0ā€,ā€œmethodā€:ā€œeth_blockNumberā€,ā€œparamsā€:[],ā€œidā€:1}ā€™ https://mainnet.infura.io/v3/PROJECT ID

1 Like

I also have a question. If I am deploying a .SOL contract in CMD or BASH, then what is the point of using Infura? What does Infura help me do if I write, compile, and deploy a contract in command prompt or BASH?

Thanks for sharing your fix, @fovanessians!

As far as the .SOL contract question, Infura basically makes it easier for you to develop and interact with your Smart Contract without having to run and maintain your own Ethereum node, which will speed up your dev workflow and make life easier on your machine.

Please am using my api link in react inside my .env file and it shows error 404.
I am only using it as a const in the js. How do i fix it without using curl?

could you please provide a sample on how you reference the environment variables in your code?