Volatile state during Hardhat Network node restart
0 reputation · 14 Jan 2023, 08:07 UTC
Local State Persistence
The Hardhat Network simulates an Ethereum environment for development and testing. A core behavior of the local node is that the blockchain state, including deployed contract addresses and modified account balances, is held in memory.
When the node process is terminated and restarted, the environment returns to its initial state. This creates a challenge when attempting to maintain a consistent set of deployed contracts across multiple development sessions without re-running the entire deployment pipeline.
Is there a documented configuration to persist the local blockchain state to disk automatically? If not, what is the recommended mechanism for restoring a specific state snapshot after a node restart?