1

I am working on a website in which I want to call on different NFTs connected to the currently selected MetaMask account.

For testing I am running a local Hardhat node on which I have deployed my contracts. Is there a possibility to use the alchemy api not only for the ethereum mainnet etc. but also use it for a local node used for testing?

If not, what could be a way to simulate it, so that the solution could also be used in production?

2
  • Sorry, I don't quite understand what you want to achieve. You can't use Alchemy locally, but most likely you can achieve what you need in some other way - just need to understand first what you are trying to do.. So you have your contracts in local blockchain - why would you need Alchemy? Commented Dec 9, 2022 at 9:36
  • The biggest thing I wanted to achieve was listening to events with alchemy. I did not specify this in my question, sorry about that. In the end I just tested on testnets which are supported by alchemy for that.
    – rajohs
    Commented Dec 10, 2022 at 2:07

1 Answer 1

4
+50

You can't use Alchemy as your local hardhat node.

There are a lot of things that Alchemy does, but it would have a really hard time indexing your local hardhat chain, especially since it doesn't have access to your local chain.

So that answers your title question, but not your main question which is really how do I get my local chain into metamask. Which you can do by adding your local hardhat node's IP (your localhost) to your metamask. Note it will only "work" while your hardhat node is up.

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.