How to control simulator time and blocks
Mine blocks, advance virtual time, and test time-dependent contract behavior on a simulator network
Use simulator time controls for expirations, delayed messages, and other time-dependent scenarios. Manual mining queues accepted messages until a block is mined.
Time changes and mining affect the selected simulator network. Advancing time can expire messages or change contract behavior. Restore a saved snapshot to repeat the scenario from its original state.
Prerequisites
- Acton 1.2 or later installed.
- For an existing simulator, a snapshot to restore the original scenario.
Advance time and mine
- During creation, expand Network and mining. Set the initial block interval or enable Manual mining for explicit control of message inclusion.
- In the running environment, open sidebar settings → Mining and enable Mine empty blocks if blocks must advance without pending messages.
- Open Home → Advance time, enter
3600under Seconds, review the resulting time, and select Advance. - Select Mine block and inspect the new block and transaction timestamps.
Automatic mining and the block interval are creation settings. While running, only Mine empty blocks can change under Mining.
The Home control advances time by an offset. For an absolute time or a one-shot next-block timestamp, use the corresponding operations under API reference → Control API, or the CLI commands.
Start a network with manual mining and empty blocks enabled:
acton simulator start --port 5411 --no-mining --mine-empty-blocksIn another terminal, advance 1 hour and mine a block:
acton simulator increase-time 3600 --port 5411
acton simulator mine --port 5411
acton simulator status --port 5411 --jsonReplace <TIMESTAMP> with a Unix timestamp in seconds at or after the latest mined block time. Choose one of these alternatives:
acton simulator set-time '<TIMESTAMP>' --port 5411acton simulator set-next-block-timestamp '<TIMESTAMP>' --port 5411
acton simulator mine --port 5411The next-block override is consumed by the next mined block. With automatic mining, a block can consume it before another command runs; use manual mining when exact sequencing matters.
Verify the scenario
Check the latest block timestamp in Explorer, then rerun the relevant getter or script action. Advancing time alone does not execute a contract — a subsequent message exercises time-dependent code. Restore the checkpoint to repeat the same scenario from its original state.
Last updated on