Private Block Explorer

Learn about the Prividium Block Explorer.

Like the RPC layer, the block explorer is split into to two versions with the prividium framework: one public-facing and one internal. The internal block explorer mirrors a standard block explorer for a public chain. All transaction data can be accessed by the chain operators.

The public-facing block explorer uses the the Proxy RPC API so that the configured access rules are applied.

Setting up a block explorer

In a new terminal run:

zkstack explorer init --prividium

You can select the default options in the prompts.

This command creates a database to store explorer data and generates a docker compose file with explorer services at prividium_chain/configs/explorer-docker-compose.yml.

Next, you need to start the explorer backend services:

zkstack explorer backend

This command uses the previously created docker compose file to start the services required for the explorer.

Finally, in a new terminal you can run the explorer app:

zkstack explorer run

This command will start the dockerized explorer app using configuration from apps/explorer.config.json file inside your ecosystem directory. You can edit this file to configure the app if needed.

You can now navigate to the explorer web-app. By default, the explorer frontend starts on http://127.0.0.1:3010, you can configure the port in apps.yaml file.

Switching to an internal explorer

To switch between the public-facing Prividium block explorer and a standard full-access block explorer for internal use:

  1. Stop the explorer frontend.
  2. Stop the explorer backend.
  3. Run zkstack explorer init and select No when prompted to use the Prividium explorer.
  4. Restart the explorer backend and frontend services.

Right now both versions of the explorer can't be run at the same time with zkstack, but it's possible to configure this manually.

To switch back to a Prividium block explorer, re-run the steps from "Setting up a block explorer".

Using the Block Explorer

To use the public-facing Prividium block explorer, users must first sign in with their wallet. The block explorer then provides the configured level of access based on their account.

Setup options

When initializing the Prividium explorer, there are four options for configuration:

  • The explorer database url
  • The explorer database name
  • The session max age, set in milliseconds, is the time a logged-in session lasts in the block explorer app. The default is one day.
  • The session same site value sets the configuration for when to send session credentials from the API. The value can be none, strict or lax. The default option is strict.

Upgrading the Explorer

To upgrade your explorer to the latest version:

  1. Run zkstackup to upgrade your version of zkstack.
  2. Stop the explorer frontend.
  3. Stop the explorer backend.
  4. Run zkstack explorer init --prividium.
  5. Restart the explorer backend and frontend services.

Made with ❤️ by the ZKsync Community