Recreating L2 state from L1 pubdata

Prerequisites

Note: Running the L1 pubdata tool will require approximately 500GB of memory and will take a few days to complete.

This tool is written in nightly Rust. You can install Rust by following the official instructions here, and then running the following command to switch to the nightly toolchain:

rustup toolchain install nightly

Clone the zksync-state-reconstruct tool:

git clone https://github.com/eqlabs/zksync-state-reconstruct
cd zksync-state-reconstruct

Usage

To start reconstructing the state, run the following command with any valid HTTP/HTTPS Ethereum JSON-RPC endpoint, for example using https://eth.llamarpc.com.

You can also use an Ethereum endpoint from Alchemy, Infura or any other endpoint provider:

cargo +nightly run -- reconstruct l1 --http-url https://eth.llamarpc.com

Here's what a successful start of the tool will look like in your terminal:

L2 state reconstruction start

Here's what the tool will look like as it's running:

L2 state reconstruction running

Once the tool has finished syncing, you will only be warned if the published L2 state is not the same as the reconstructed L2 state. If the tool has finished syncing and you have not received any warnings, then the L2 state has been successfully reconstructed.


Made with ❤️ by the ZKsync Community