'How to restart a local hardhat node to initial state?

I am not really sure how to restart the state of the node to the initial state. Each time I try to redeploy a contract - I'm getting the same contract, the constructor params don't change.

How to clean my local hardhat node?



Solution 1:[1]

Took me a lot longer than I'm proud to admit to figure it out, but here's the answer:

The node doesn't store the state. Every time you stop and start the node again - it is in the initial state. That's why it's important to have some scripts to set your initial node state, that is, get it in the wanted state before you do any further testing.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shocky2