skip to Main Content

I’ve been trying to use the JsonRpcProvider but it’s displaying an error message.
here is the code.

const INFURA_ID = "0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5";
const provider = new ethers.providers.JsonRpcProvider(
  `https://mainnet.infura.io/v3/${INFURA_ID}`
);

I was expecting it to fetch details of from etherscan

2

Answers


  1. The value "0x952…e5" doesn’t appear to be an Infura ID; instead, it looks more like a blockchain address. Make sure you are using the appropriate Infura project ID.

    Login or Signup to reply.
  2. Try,

    const provider = new ethers.providers.InfuraProvider("homestead", projectId);
    

    Anyway "0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5" seems like an address. You may copy the id again pn your dashboard.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search