-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add initialBlockNumber
option for the node
#4405
Comments
Any updates here? Its a nice feature to have. |
Hardhat already supports an |
@fvictorio thanks for pointing out the |
initialBlockNumber
option for the node
Any updates on this? For now I'm trying to use the initialDate option when running a local node but I get an error:
|
@Ermal-code that's a bad error message we are returning, but the underlying issue is that
|
Describe the feature
Description
I propose a feature to allow users to specify a custom start time and initial block number for the local Hardhat network. Currently, Hardhat initializes the local development network with the current timestamp and starts from block number 0. While the network allows manipulation of the EVM time and block numbers through methods like
evm_increaseTime
andevm_mine
, it does not offer the capability to start the network with custom initial settings let alone specifying a start time in the past i.e. less than the current unix time.Motivation
The need for this feature arises from various testing scenarios where developers need to simulate or replay past mainnet transactions. Having control over the exact start time and block number is crucial for achieving accurate testing conditions.
For example, consider a series of transactions A, B, and C that occurred at times 1000, 1003, and 1008 respectively on mainnet. If we want to test these transactions on a local Hardhat node, the current method would be to:
This method lacks precision and makes it cumbersome to simulate more complex scenarios where the exact start time and block number are essential.
Proposed Solution
I propose extending the configuration options for the Hardhat network to include
startTime
andstartBlockNumber
. For example:The above settings would instruct the Hardhat network to initialize itself starting from the given Unix timestamp and block number.
Search terms
node start time past
The text was updated successfully, but these errors were encountered: