diff --git a/content/10.zk-stack/20.running-a-zk-chain/30.raas.md b/content/10.zk-stack/20.running-a-zk-chain/30.raas.md index 61327c39..0b0c2e98 100644 --- a/content/10.zk-stack/20.running-a-zk-chain/30.raas.md +++ b/content/10.zk-stack/20.running-a-zk-chain/30.raas.md @@ -21,8 +21,7 @@ and maintain flexibility in an ever-evolving technological landscape. The list of RaaS providers you can use to deploy and customise their your ZK chain: - - +- [Caldera](https://www.caldera.xyz/) - [Zeeve](https://www.zeeve.io/appchains/zksync-hyperchains-zkrollups/) - [Ankr](https://azuremarketplace.microsoft.com/en-us/marketplace/apps/ankrpbc1684783099666.ankr_appchains?tab=Overview/) - [AltLayer](https://altlayer.io/raas) diff --git a/content/10.zk-stack/20.running-a-zk-chain/99.dependencies.md b/content/10.zk-stack/20.running-a-zk-chain/99.dependencies.md deleted file mode 100644 index b0152449..00000000 --- a/content/10.zk-stack/20.running-a-zk-chain/99.dependencies.md +++ /dev/null @@ -1,289 +0,0 @@ ---- -title: Dependencies ---- - -## TL;DR - -If you run on 'clean' Debian on GCP: - -```bash -# Rust -curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -# NVM -curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash -# All necessary stuff -sudo apt-get install build-essential pkg-config cmake clang lldb lld libssl-dev postgresql docker-compose -# Docker -sudo usermod -aG docker YOUR_USER - -## You might need to re-connect (due to usermod change). - -# Node & yarn -nvm install node -npm install -g yarn -yarn set version 1.22.19 - -# SQL tools -cargo install sqlx-cli --version 0.5.13 -# Stop default postgres (as we'll use the docker one) -sudo systemctl stop postgresql -# Start docker. -sudo systemctl start docker -``` - -## Supported operating systems - -ZKsync currently can be launched on any \*nix operating system (e.g. any linux distribution or MacOS). - -If you're using Windows, then make sure to use WSL 2, since WSL 1 is known to cause troubles. - -Additionally, if you are going to use WSL 2, make sure that your project is located in the _linux filesystem_, since -accessing NTFS partitions from inside of WSL is very slow. - -If you're using MacOS with an ARM processor (e.g. M1/M2), make sure that you are working in the _native_ environment -(e.g. your terminal and IDE don't run in Rosetta, and your toolchain is native). Trying to work with ZKsync code via -Rosetta may cause problems that are hard to spot and debug, so make sure to check everything before you start. - -If you are a NixOS user or would like to have a reproducible environment, skip to the section about `nix`. - -## `Docker` - -Install `docker`. It is recommended to follow the instructions from the -[official site](https://docs.docker.com/install/). - -Note: currently official site proposes using Docker Desktop for Linux, which is a GUI tool with plenty of quirks. If you -want to only have CLI tool, you need the `docker-ce` package and you can follow -[this guide](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04) for Ubuntu. - -Installing `docker` via `snap` or from the default repository can cause troubles. - -You need to install both `docker` and `docker-compose`. - -**Note:** `docker-compose` is installed automatically with `Docker Desktop`. - -**Note:** On linux you may encounter the following error when you’ll try to work with `zksync`: - -```sh -ERROR: Couldn't connect to Docker daemon - you might need to run `docker-machine start default`. -``` - -If so, you **do not need** to install `docker-machine`. Most probably, it means that your user is not added to -the`docker` group. You can check it as follows: - -```bash -docker-compose up # Should raise the same error. -sudo docker-compose up # Should start doing things. -``` - -If the first command fails, but the second succeeds, then you need to add your user to the `docker` group: - -```bash -sudo usermod -a -G docker your_user_name -``` - -After that, you should logout and login again (user groups are refreshed after the login). The problem should be solved -at this step. - -If logging out does not help, restarting the computer should. - -## `Node` & `Yarn` - -1. Install `Node` (requires version `v18.18.0`). Since our team attempts to always use the latest LTS version of - `Node.js`, we suggest you to install [nvm](https://github.com/nvm-sh/nvm). It will allow you to update `Node.js` - version easily in the future (by running `nvm use` in the root of the repository) -2. Install `yarn` (make sure to get version 1.22.19 - you can change the version by running `yarn set version 1.22.19`). - Instructions can be found on the [official site](https://classic.yarnpkg.com/en/docs/install/). - Check if `yarn` is installed by running `yarn -v`. If you face any problems when installing `yarn`, it might be the - case that your package manager installed the wrong package.Make sure to thoroughly follow the instructions above on - the official website. It contains a lot of troubleshooting guides in it. - -## `Axel` - -Install `axel` for downloading keys: - -On mac: - -```bash -brew install axel -``` - -On debian-based linux: - -```bash -sudo apt-get install axel -``` - -Check the version of `axel` with the following command: - -```sh -axel --version -``` - -Make sure the version is higher than `2.17.10`. - -## `clang` - -In order to compile RocksDB, you must have LLVM available. On debian-based linux it can be installed as follows: - -On linux: - -```bash -sudo apt-get install build-essential pkg-config cmake clang lldb lld -``` - -On mac: - -You need to have an up-to-date `Xcode`. You can install it directly from `App Store`. With Xcode command line tools, you -get the Clang compiler installed by default. Thus, having XCode you don't need to install `clang`. - -## `OpenSSL` - -Install OpenSSL: - -On mac: - -```bash -brew install openssl -``` - -On linux: - -```bash -sudo apt-get install libssl-dev -``` - -## `Rust` - -Install the latest `rust` version. - -Instructions can be found on the [official site](https://www.rust-lang.org/tools/install). - -Verify the `rust` installation: - -```bash -rustc --version -rustc 1.xx.y (xxxxxx 20xx-yy-zz) # Output may vary depending on actual version of rust -``` - -If you are using MacOS with ARM processor (e.g. M1/M2), make sure that you use an `aarch64` toolchain. For example, when -you run `rustup show`, you should see a similar input: - -```bash -rustup show -Default host: aarch64-apple-darwin -rustup home: /Users/user/.rustup - -installed toolchains --------------------- - -... - -active toolchain ----------------- - -1.67.1-aarch64-apple-darwin (overridden by '/Users/user/workspace/zksync-era/rust-toolchain') -``` - -If you see `x86_64` mentioned in the output, probably you're running (or used to run) your IDE/terminal in Rosetta. If -that's the case, you should probably change the way you run terminal, and/or reinstall your IDE, and then reinstall the -Rust toolchain as well. - -## Postgres - -Install the latest postgres: - -On mac: - -```bash -brew install postgresql@14 -``` - -On linux: - -```bash -sudo apt-get install postgresql -``` - -### Cargo nextest - -[cargo-nextest](https://nexte.st/) is the next-generation test runner for Rust projects. `zk test rust` uses -`cargo nextest` by default. - -```bash -cargo install cargo-nextest -``` - -### SQLx CLI - -SQLx is a Rust library we use to interact with Postgres, and its CLI is used to manage DB migrations and support several -features of the library. - -```bash -cargo install sqlx-cli --version 0.5.13 -``` - -## Solidity compiler `solc` - -Install the latest solidity compiler. - -```bash -brew install solidity -``` - -Alternatively, download a [precompiled version](https://github.com/ethereum/solc-bin) and add it to your PATH. - -## Python - -Most environments will have this preinstalled but if not, install Python. - -## Easier method using `nix` - -Nix is a tool that can fetch _exactly_ the right dependencies specified via hashes. The current config is Linux-only but -it is likely that it can be adapted to Mac. - -Install `nix`. Enable the nix command and flakes. - -Install docker, rustup and use rust to install SQLx CLI like described above. If you are on NixOS, you also need to -enable nix-ld. - -Go to the zksync folder and run `nix develop --impure`. After it finishes, you are in a shell that has all the -dependencies. - -## Environment - -Edit the lines below and add them to your shell profile file (e.g. `~/.bash_profile`, `~/.zshrc`): - -```bash -# Add path here: -export ZKSYNC_HOME=/path/to/zksync - -export PATH=$ZKSYNC_HOME/bin:$PATH - -# If you're like me, uncomment: -# cd $ZKSYNC_HOME -``` - -### Tip: `mold` - -Optionally, you may want to optimize the build time with the modern linker, [`mold`](https://github.com/rui314/mold). - -This linker will speed up the build times, which can be pretty big for Rust binaries. - -Follow the instructions in the repo in order to install it and enable for Rust. - -## Tip: Speeding up building `RocksDB` - -By default, each time you compile `rocksdb` crate, it will compile required C++ sources from scratch. It can be avoided -by using precompiled versions of library, and it will significantly improve your build times. - -In order to do so, you can put compiled libraries to some persistent location, and add the following to your shell -configuration file (e.g. `.zshrc` or `.bashrc`): - -```sh -export ROCKSDB_LIB_DIR= -export SNAPPY_LIB_DIR= -``` - -Make sure that compiled libraries match the current version of RocksDB. One way to obtain them, is to compile the -project in the usual way once, and then take built libraries from -`target/{debug,release}/build/librocksdb-sys-{some random value}/out`. diff --git a/content/10.zk-stack/20.running-a-zk-chain/99.enabling-prover.md b/content/10.zk-stack/20.running-a-zk-chain/99.enabling-prover.md deleted file mode 100644 index 9a9ad1dc..00000000 --- a/content/10.zk-stack/20.running-a-zk-chain/99.enabling-prover.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -title: Enabling Prover -description: ---- - -With the default configuration, your ZK chain is not running a prover, -and has a `DummyExecutor` contract, which mainly “accepts” that a batch is executed without proof. -This enables you to test it with much lower hardware requirements. - -To enable the prover, run the `zk stack prover-setup` command. -It will guide through the necessary configuration. - -> :warning: Running a prover is not required for deploying a testnet. The requirements below are only necessary if you want to enable the prover. - -## Requirements for CPU Prover - -The docker compose file assumes you will be running all components in the same machine. The current minimum requirements for a low TPS scenario are: - -- 32 Core CPU -- 128 GB of RAM -- 700 of Disk Space (SSD preferred) - -## Requirements for GPU Prover - -The docker compose file assumes you will be running all components in the same machine. The current minimum requirements for a low TPS scenario are: - -- 16 GB VRAM NVIDIA GPU -- 16 Core CPU -- 64 GB of RAM -- 300 GB of Disk Space (SSD preferred) diff --git a/content/10.zk-stack/20.running-a-zk-chain/99.using-zk-chain.md b/content/10.zk-stack/20.running-a-zk-chain/99.using-zk-chain.md deleted file mode 100644 index 1bcc17fa..00000000 --- a/content/10.zk-stack/20.running-a-zk-chain/99.using-zk-chain.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -title: Using Your ZK Chain RPC -description: ---- - -Your server contains both HTTPS as well as WS services that are fully web3 compatible (and contain some extra ZK Stack functionalities). - -By default your server is available at - but if you deployed the server into some cloud provider, -you will have a different URL to interact with. - -## Using zksync-cli - -When executing any command with zksync-cli, -you can specify RPC urls for both L1 and L2 if you choose “localnet” as your network. -An example deposit command would look like: - -```bash -npx zksync-cli bridge deposit --rpc=http://localhost:3050 --l1-rpc=http://localhost:8545 -``` - -## Using dApp Portal - -You can run the Portal module locally, and point it to your ZK chain configuration. -It comes with scripts that help pulling the ZK chain configuration from your zksync-era repo and adapting to portal needs. -Learn more here. An example command would look like: - -```bash -npm run hyperchain:migrate ../zksync-era -npm run dev:node:hyperchain -``` - -## Using Block Explorer - -Block explorer contains three components (Worker, API, and App), which you can run all together locally and connect to your ZK chain. -For that, you need to set up all the necessary environment and configuration files with your ZK chain settings. -You can use a script to build them. See setting up env variables. - -Once you have your zksync-era repo set up locally, you can run the following command to -build environment and configuration files for block explorer based on your **[zksync-era](https://github.com/matter-labs/zksync-era)** repo configuration: - -```bash -npm run hyperchain:configure -``` - -The script generates all the necessary configuration files for block-explorer, which you can edit if you need any changes. - -## Addendum - -- If you make changes to any contract, you can always deploy a new ZK chain to easily test those changes. - -- If you configure your ZK chain once, you don't need to do it again as the wizard allows you to use an existing config file. - -- For now, it is only possible to deploy a ZK chain as an L2, but soon it will also work as L3s. - -- When running the default matterlabs/geth, you have a set of rich wallets available to you. - ::drop-panel - ::panel{label="Rich Wallets"} - :display-partial{path="/_partials/_rich-wallets"} - :: - :: -- If you want to have a custom local base chain, you must ensure you have a database for your ZK chain, as well as the local RPC for your L1. - -- To run a Postgres 14 database for your ZK chain, execute the following: - -```bash -docker-compose -f docker-compose-zkstack-common.yml up -d postgres -``` - -In case you don't want to use the docker Postgres database above but another one you already have locally, -make sure its version is 14 and it is running and accepts connections at postgres://postgres@localhost/zksync_local. -You can test with: - -```bash -psql -h localhost -U postgres -d postgres -c 'SELECT 1;' -``` - -If you face an issue compiling rust code (example `: Error allocating TSD`) try removing the `rust-toolchain` file from the repo.