3

On one hand, when I run "npx hardhat node --network localhost" it tells me that we can only run hardhat node, so i run "npx hardhat node" and it works.

enter image description here

Ok so I am using hardhat network node, not localhost.

On the other hand when I go to deploy with "npx hardhat run scripts/deploy.js" nothing happens in the node window (picture below). However when I do "npx hardhat run --network localhost" it shows up on the node window.

Is this not confusing? I am using hardhat node on one side and when I deploy to hardhat I can't see anything, but then when I deploy to localhost all the info shows on on the node window.

What is the difference between localhost and hardhat network?

enter image description here

1 Answer 1

6

Hardhat has a local ethereum network that is run in two flavors. The "hardhat" network is run in-process, while the "localhost" version is run as a standalone daemon, enabling JSON-RPC and WebSocket connections. Whenever you run a script, the in-process "hardhat" network is started automatically. Alternatively, you can run the standalone version using the command npx hardhat node.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.