A devnet (sometimes called a mocknet) is a local blockchain development environment that is used for the rapid development of smart contracts alongside your front-end application development. With a devnet, your smart contract application can interact with simulated blockchain entities (miners, nodes, transaction fees, and a stream of mined blocks), all within your local machine.
Historically, spinning up devnet would require waiting for the devnet environment to build itself up to a particular chain state with your contracts deployed. This waiting period would take a few minutes due to the numerous conditions it needs to operate a simulated blockchain environment.
With this latest release, the devnet will now use a pre-built snapshot that includes all chain state, of both the Stacks and Bitcoin network, up to epoch 3.0. When you start your devnet, it loads this snapshot and immediately begins processing your contract deployments and transactions.
There's zero overhead. No waiting for a specific block height to get going. Your devnet works exactly as before, just faster.
When the Snapshot Gets Used
The new snapshot works with most standard devnet configurations, but if you need backwards compatibility, a few manifest settings will disable the snapshot and fall back to the legacy startup process:
- Epoch block height settings - Any custom block heights set for epochs before 3.0
- bind_containers_volumes - Required to load snapshot
- Custom images - Non-default stacks, bitcoin, or stacks-api images
- PoX stacking orders - Pre-configured stacking arrangements
If your manifest includes any change to these settings, the devnet will start normally from genesis since the snapshot data won’t be equivalent.
Disabling the Snapshot
But if you have the standard devnet configurations defaulted and still need to test starting from genesis or debug an early blockchain state? Use the <code-rich-text>--from-genesis<code-rich-text> flag to disable the snapshot and start from scratch:
This will ignore the snapshot data if you need to verify behavior across all epochs.
What's Next
Upgrade to the latest Clarinet version and try the faster startup with your next devnet session. The feature is live now and requires no changes to your existing projects. Check out this blog to learn the different ways of using devnet.