commit fd64172ae4cf22a3f75c17a51720399528dd5dc1 Author: Antonio Antonino Date: Mon May 12 15:25:01 2025 +0300 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..14aed07 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "zksync-era"] + path = zksync-era + url = https://github.com/logos-co/zksync-era diff --git a/README.md b/README.md new file mode 100644 index 0000000..dfe9bef --- /dev/null +++ b/README.md @@ -0,0 +1,178 @@ + +# ZKSync Era-based Validium Deployment + +This repository documents the deployment of a **ZKSync Era-based Validium proof-of-concept (PoC)** showcased by **Nomos** during **IFT All-Hands 2025** in Split. + +It uses a forked version of the ZKSync Era framework. You can find the repository here: +👉 [logos-co/zksync-era][zksync-era-fork-repo] + +--- + +## What is ZKSync Era? + +ZKSync Era is a zero-knowledge rollup framework that enables scalable and secure L2 chains. + +For detailed documentation, including architecture and components of the framework, visit: +📚 [ZKSync Era Documentation][zksync-era-docs] + +--- + +## Deploy a ZKSync Era Validium with Nomos DA + +This guide walks you through setting up a **GPU-proved Validium L2** chain using **Nomos DA** and the forked ZKSync Era framework. + +If you need to modify any parameters, refer to the official ZKSync documentation to understand their implications. + +--- + +### Machine Setup + +1. Follow the official setup guide to install dependencies: + [ZKSync Era Dev Setup Guide][zksync-era-dev-setup] + +2. Clone this repo: + + ```bash + git clone https://github.com/logos-co/nomos-example-validium --recurse-submodules + cd zksync-era + ``` + +3. Install the forked `zkstack` CLI: + + ```bash + cargo install --path ./zkstack_cli/crates/zkstack --locked zkstack --force + ``` + +--- + +### Ecosystem Creation + +Create a new ecosystem using the `zkstack` CLI: + +```bash +zkstack ecosystem create \ + --ecosystem-name \ + --l1-network localhost \ + --link-to-code \ + --chain-name \ + --chain-id \ + --prover-mode gpu \ + --wallet-creation localhost \ + --l1-batch-commit-data-generator-mode validium \ + --evm-emulator true \ + --start-containers true \ + --update-submodules true \ + --verbose +``` + +- Choose `Eth` as the base currency when prompted. +- Replace placeholders with your chosen values. + +> â„šī¸ For testing without a real GPU prover, use `--prover-mode no-proofs`. + +--- + +### Ecosystem Initialization + +1. Navigate into your ecosystem folder: + + ```bash + cd + ``` + +2. Initialize the ecosystem: + + ```bash + zkstack ecosystem init \ + --deploy-erc20 false \ + --deploy-ecosystem true \ + --l1-rpc-url http://127.0.0.1:8545 \ + --deploy-paymaster true \ + --server-db-url postgres://postgres:notsecurepassword@localhost:5432 \ + --server-db-name \ + --observability false \ + --update-submodules true \ + --verbose + ``` + +3. When prompted, choose `"Nomos"` as the DA provider and enter: + - Nomos DA disperal endpoint URL + - Username/password for HTTP basic auth according to the node configuration + - A 64-character hex App ID (without the `0x`), e.g.: + + ``` + 00ea21912cdcbdd9189d49d07b61543ffdf7064355640eb6cc6fc6d902056d1b + ``` + +--- + +### Running the Sequencer + +Start the L2 sequencer: + +```bash +zkstack server --verbose +``` + +- The default RPC endpoint is: `http://localhost:3050` +- Connect with any EVM-compatible wallet (e.g. Metamask, Rabby) +- Use the `chain_id` you configured earlier + +Optional: also connect to the local L1 node at `http://localhost:8545`. + +--- + +### Running the Prover + +If your use case requires generating ZK proofs: + +1. Initialize the prover: + + ```bash + zkstack prover init \ + --bellman-cuda true \ + --bellman-cuda-dir \ + --setup-compressor-key true \ + --setup-keys true \ + --setup-database true \ + --prover-db-url postgres://postgres:notsecurepassword@localhost:5432 \ + --prover-db-name \ + --dont-drop false \ + --use-default false \ + --verbose + ``` + +2. Replace placeholders with your paths and database names. + +> This process can take time as it downloads all required proving and compression keys. + +3. Start prover binaries as explained in the [ZKSync Era Prover Docs][zksync-era-prover-docs]. + +> As things stand, proving time takes anywhere between 10 minutes to 1 hour, while proof compression typically takes less than one minute. Keep that in mind when trying the whole end-to-end flow. + +--- + +## Example Applications + +Once the L2 is running, you can deploy EVM applications on it. + +To bridge ETH from the local L1 to the L2, use the ZKSync Era Portal: + +```bash +zkstack portal --verbose +``` + +Use the portal UI to bridge from an L1 account. For a local setup, you can use: + +- Address: `0x36615Cf349d7F6344891B1e7CA7C72883F5dc049` +- Private key: `0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110` + +More dev accounts can be found in the [ZKSync Era L1 Accounts][zksync-era-l1-accounts]. + +--- + +[zksync-era-fork-repo]: https://github.com/logos-co/zksync-era +[zksync-era-docs]: https://docs.zksync.io/zk-stack +[zksync-era-dev-setup]: https://github.com/matter-labs/zksync-era/blob/main/docs/src/guides/setup-dev.md +[zksync-era-prover-docs]: https://matter-labs.github.io/zksync-era/prover/latest/03_launch.html +[zksync-era-l1-accounts]: https://docs.zksync.io/zk-stack/running/using-a-local-zk-chain#base-layer-is-the-local-reth-node diff --git a/zksync-era b/zksync-era new file mode 160000 index 0000000..a73a4d8 --- /dev/null +++ b/zksync-era @@ -0,0 +1 @@ +Subproject commit a73a4d87319e21e513b92118d8250968980330c8