Doubt: What is difference between localhost network and hardhat network? #1589
-
I am actually confused about difference between different local networks and chain ids.
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
Hardhat has two network options On the other hand, if you wish to have a persistent blockchain network, you use Use |
Beta Was this translation helpful? Give feedback.
-
Answered objectively:"When to use --network localhost and --network hardhat?"
"What is the chain id when we run hh node in the shell"
"If anyone can please list out differences between hardhat localhost and localhost 8545"
"What is actually the difference between chain id 31337 and 1337 which chain id is of which network?"
|
Beta Was this translation helpful? Give feedback.
Hardhat has two network options
hardhat
andnode (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…