Skip to content

Doubt: What is difference between localhost network and hardhat network? #1589

Discussion options

You must be logged in to vote

Hardhat has two network options hardhat and node (localhost)
The hardhat network (chainId: 1337) is a run-in-process network which means that it only runs whenever you run a scripts and terminates immediately the process ends. In short it is not persistent. If you use --network hardhat hardhat automatically creates a temporary blockchain instance, runs the script, and terminates the the instance once the script runs.

On the other hand, if you wish to have a persistent blockchain network, you use --network localhost. localhost normally has a chainId of 31337. The localhost runs as a standalone daemon that you can observe and note all transactions taking place on the network. The hardhat no…

Replies: 2 comments 11 replies

Comment options

You must be logged in to vote
9 replies
@othaime-en
Comment options

@alymurtazamemon
Comment options

@adityabhattad2021
Comment options

@adityabhattad2021
Comment options

@othaime-en
Comment options

Answer selected by adityabhattad2021
Comment options

You must be logged in to vote
2 replies
@adityabhattad2021
Comment options

@krakxn
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants