Mainnet Replay
Mainnet Replay is how a Stagenet follows a target chain’s changing state.
When you create a Stagenet, it starts from the target chain’s current block. From there, it replays new blocks from the target chain one after another.
As replay advances, untouched state continues to update from the target chain. State changed by transactions on your Stagenet is persisted and is no longer overwritten by replay.
This gives you a private environment that keeps following production state while letting your own transactions persist.
Block Replay
For each replayed block, the Stagenet:
- Executes any pending transactions submitted to the Stagenet.
- Updates untouched state to match the target chain at the end of the replayed block.
This makes your Stagenet follow the target chain’s state progression, giving your contracts access to on-chain data that changes over time:
- DeFi protocol state
- Oracle prices
- Token balances
Modified state
Mainnet Replay only updates state that has not been modified on the Stagenet.
If a Stagenet transaction changes chain state — including account fields, contract code, balances, nonces, or storage — that change is preserved locally. Replay updates from the target chain will no longer overwrite the modified state.
Everything else continues to follow the target chain as replay advances.
Block context
As replay advances, the Stagenet follows the target chain’s block progression.
block.numbermatches the target chain block currently being replayed.block.timestampis the timestamp of the replayed target chain block.- Block gas fields follow the target chain block being replayed.
- By default, the Stagenet uses the random chainId. It can be changed.
Preventing drift with Mainnet Follow
By default, state modified on your Stagenet is preserved locally.
For your own contracts and wallets, this is usually what you want. For third-party market state, such as DEX pools or oracle contracts, you may sometimes want selected state to keep following the live chain even after it is touched.
Use Mainnet Follow to keep selected accounts or storage slots synced to the live chain.
Learn more
For more details, see the Mainnet Replay feature section.