I am trying to call the ethers js functions which in turn call my smart contract using an express API. I created the APIs but I'm unable to run the server and get the response for the API request.

I started the local hardhat env with npx hardhat node. Butt eventually want to run the APIs on the smart contract deployed on the Polygon-Mumbai testnet.

When I run the express app using command node app.js I'm not able to connect with deployed smart contract in hardhat local env. And When I run it using npx hardhat run app.js --network localhost I am able to call the API along with the smart contract using postman, but the response doesn't go back to postman and it keeps waiting.

Do I need to leverage the config in hardhat.config.js file to start the server?

Any help is much appreciated. Thanks in advance!


Your Answer

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

Browse other questions tagged or ask your own question.