Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I cannot work with Smart Contract using Node.js

I’ve been trying to link a smart contract with ethers.js in my project.

const Provider= new ethers.providers.JsonRpcProvider(
  `https://goerli.infura.io/v3/`
);

const TokenContract = new ethers.Contract(
TokenAddress,
abiSource.token.abi,
Provider
);`

I tried to run this but couldn’t get the balance of the token contract.
Extracted RPC link from the Metamask.
Who can help me with this problem?
Thanks in advance.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

It seems like you didn’t use Infura georli api key.

const Provider= new ethers.providers.JsonRpcProvider(
  `https://goerli.infura.io/v3/ca11249dabe247c1a6e0877c24376dda`
);

Please try the above.
However, you must bring your own Infura API Key.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading