Here is how you can do it using Truffle & Ganache.
In truffle-config.js
, extend the configuration of your network to something like this:
networks: {
myNetwork: {
host: ...,
port: ...,
network_id: ...,
gas: ...,
gasPrice: ...,
networkCheckTimeout: 9000000000, // or some other large value
provider: ganache.provider({
gasLimit: ...,
gasPrice: ...,
default_balance_ether: ...,
fork: "url of an archive node",
fork_block_number: desiredBlockNumber
})
}
}
Update: you also need const ganache = require('ganache-core');
in this file.