From 4016397ded2e8c267a1a7432eda324b26451fd2c Mon Sep 17 00:00:00 2001 From: Manuel Mauro Date: Mon, 14 Oct 2024 17:29:51 +0200 Subject: [PATCH] docs(zkstack_cli): apply redesign ZK Toolbox commands (#96) # Description Apply redesign ZK Toolbox commands to tutorials. ## Linked Issues ## Additional context --------- Co-authored-by: Antonio --- content/tutorials/custom-zk-chain/10.index.md | 54 +++++++++---------- .../20.customizing-your-chain.md | 22 ++++---- content/tutorials/custom-zk-chain/_dir.yml | 2 +- cspell-config/cspell-zksync.txt | 1 + 4 files changed, 40 insertions(+), 39 deletions(-) diff --git a/content/tutorials/custom-zk-chain/10.index.md b/content/tutorials/custom-zk-chain/10.index.md index e5842875..c4b82528 100644 --- a/content/tutorials/custom-zk-chain/10.index.md +++ b/content/tutorials/custom-zk-chain/10.index.md @@ -3,7 +3,7 @@ title: Getting Started with ZK Chains description: Create and run your first ZK chain. --- -This tutorial shows you how to use the `zk_inception` CLI to run an Elastic Chain ecosystem and custom ZK chain locally: +This tutorial shows you how to use the ZK Stack CLI to run an Elastic Chain ecosystem and custom ZK chain locally: - You'll set up a local **Elastic Chain ecosystem** - You'll create a standard **ZK chain** @@ -18,24 +18,24 @@ This tutorial shows you how to use the `zk_inception` CLI to run an Elastic Chai - For background on the Elastic Chain or ZK chains, read the [ZK chains](https://docs.zksync.io/zk-stack/concepts/zk-chains) section in our docs. - Install the dependencies for the `zksync-era` repo by following the instructions in the matter-labs/zksync-era project's [Setup dev guide](https://github.com/matter-labs/zksync-era/blob/main/docs/guides/setup-dev.md) (you can skip the "Environment" section). +- Install the latest version of [foundry-zksync](https://foundry-book.zksync.io/getting-started/installation). -::callout{icon="i-heroicons-light-bulb"} -If you previously have `foundry-zksync` installed, -reinstall the normal version of [foundry](https://book.getfoundry.sh/getting-started/installation) for this tutorial. -:: +## Installing ZK Stack CLI + +You can use `zkstackup` to install and manage `zkstack`: -## Installing `zk_inception` CLI +```bash +curl -L https://raw.githubusercontent.com/matter-labs/zksync-era/main/zkstack_cli/zkstackup/install | bash +``` -To install the CLI globally, run this command in your root folder. -You can use the Rust command `cargo` to install the CLI with the command below: +Then install the most recent version of `zkstack` with: ```bash -cargo install --git https://github.com/matter-labs/zksync-era/ \ ---locked zk_inception --force +zkstackup ``` ::callout{icon="i-heroicons-light-bulb"} -You can find a full reference for the `zk_inception` CLI in the [`zksync-era` repo](https://github.com/matter-labs/zksync-era/tree/main/zk_toolbox/crates/zk_inception). +You can find a full reference for the ZK Stack CLI in the [`zksync-era` repo](https://github.com/matter-labs/zksync-era/tree/main/zkstack_cli). :: ## Setting up the Elastic Chain ecosystem @@ -49,9 +49,9 @@ There are two components needed for running a ZK chain locally: 1. An Elastic Chain ecosystem to manage different chains 2. At least one chain deployed within the ecosystem -To setup both of these components, use the `zk_inception` CLI. +To setup both of these components, use ZK Stack CLI. -The first step is to create a new ecosystem with the `ecosystem create` command. +The first step is to create a new ecosystem with the `zkstack ecosystem create` command. ::callout{icon="i-heroicons-light-bulb"} Make sure Docker is running on your machine. @@ -60,7 +60,7 @@ Make sure Docker is running on your machine. Move to a directory where you want your ecosystem folder to be, and run the command below to generate an ecosystem folder. ```bash -zk_inception ecosystem create +zkstack ecosystem create ``` You will be prompted with a series of options to customize your ecosystem and generate a new chain within the ecosystem. @@ -68,9 +68,9 @@ For this tutorial, use the options shown below. If you choose different names for your ecosystem or chain, remember to update the names in the commands later on. ```bash -$ zk_inception ecosystem create +❯ zkstack ecosystem create -┌ ZKsync toolbox +┌ ZK Stack CLI │ ◇ What do you want to name the ecosystem? │ my_elastic_chain @@ -84,7 +84,7 @@ $ zk_inception ecosystem create ◇ What do you want to name the chain? │ zk_chain_1 │ -◇ Whats the chain id? +◇ What's the chain id? │ 271 │ ◇ Select how do you want to create the wallet @@ -148,10 +148,10 @@ Move into the ecosystem folder: cd my_elastic_chain ``` -Next, run the `ecosystem init` command below to deploy the ecosystem: +Next, run the `zkstack ecosystem init` command below to deploy the ecosystem: ```bash -zk_inception ecosystem init --dev +zkstack ecosystem init --dev ``` The `--dev` flag will choose the default options for development. @@ -163,7 +163,7 @@ If you have any issues at this step, try reinstalling the dependencies at the to This process will take some time as there is a lot happening here. To see more detailed logs of what is happening at each step, you can add the `--verbose` flag to the command. -To summarize, the `ecosystem init` command: +To summarize, the `zkstack ecosystem init` command: - Checks to see if your environment has the necessary dependencies. - Compiles and deploys all of the necessary contracts for the ecosystem. @@ -178,7 +178,7 @@ For the ERC20 contracts, you can find the deployed addresses inside `/chains/zk_chain_1/ZkStack.yaml`. It contains the most basic configurations for the chain. @@ -186,11 +186,11 @@ It contains the most basic configurations for the chain. Inside `/chains/zk_chain_1/configs`, you can find six more configuration files: 1. `contracts.yaml`: configurations for all the L1 & L2 contracts. -1. `external_node.yaml`: configurations for the chain's node server. -1. `general.yaml`: general configurations. -1. `genesis.yaml`: chain specific configurations with parameters that were used during genesis. -1. `secrets.yaml`: secrets that are individual for every chain. -1. `wallets.yaml`: all wallets that you are using for this chain. +2. `external_node.yaml`: configurations for the chain's node server. +3. `general.yaml`: general configurations. +4. `genesis.yaml`: chain specific configurations with parameters that were used during genesis. +5. `secrets.yaml`: secrets that are individual for every chain. +6. `wallets.yaml`: all wallets that you are using for this chain. ::callout{icon="i-heroicons-exclamation-triangle" color="amber"} Never commit your private keys or sensitive secrets. @@ -201,7 +201,7 @@ Never commit your private keys or sensitive secrets. The last step here is to start a server for `zk_chain_1`: ```bash -zk_inception server +zkstack server ``` With this, your L1 chain should be running at port `8545`, and the `zk_chain_1` node should be running at port `3050`. diff --git a/content/tutorials/custom-zk-chain/20.customizing-your-chain.md b/content/tutorials/custom-zk-chain/20.customizing-your-chain.md index 970a7e1d..99352600 100644 --- a/content/tutorials/custom-zk-chain/20.customizing-your-chain.md +++ b/content/tutorials/custom-zk-chain/20.customizing-your-chain.md @@ -175,18 +175,18 @@ Now that your ERC20 token is deployed, you can create a new chain. First, shut down the node server running for `zk_chain_1` by terminating the process. -Move back into your elastic chain ecosystem folder and run the `chain create` command: +Move back into your elastic chain ecosystem folder and run the `zkstack chain create` subcommand: ```bash -zk_inception chain create +zkstack chain create ``` This time, use the answers below: ```bash -$ zk_inception chain create +❯ zkstack chain create -┌ ZKsync toolbox +┌ ZK Stack CLI │ ◇ What do you want to name the chain? │ custom_zk_chain @@ -233,7 +233,7 @@ Make sure the server for `zk_chain_1` that you started in the previous section i Next, initialize the chain in the ecosystem with the command below, and select the default options for the prompts. ```bash -zk_inception chain init +zkstack chain init ``` During the initialization process, your ERC20 token address gets added to the allowlist mentioned earlier. @@ -241,7 +241,7 @@ During the initialization process, your ERC20 token address gets added to the al Now that the chain is initialized, you can start the chain server: ```bash -zk_inception server +zkstack server ``` ## Bridging the base token to your chain @@ -345,10 +345,10 @@ L2 ETH Balance 🎉: 20000000000000000000n You can switch in between different chains without losing any state by terminating the chain server process and then running the command below: ```bash -zk_inception ecosystem change-default-chain +zkstack ecosystem change-default-chain ``` -Now when you start the server with `zk_inception server`, the new default chain's node will start with the saved state. +Now when you start the server with `zkstack server`, the new default chain's node will start with the saved state. To fully shut down the ecosystem and erase all of the data and state, you can shut down the Docker containers from the ecosystem folder using the command: @@ -359,11 +359,11 @@ docker-compose down To restart the docker containers for your ecosystem and run your custom ZK chain again, follow the steps below: -1. In the ecosystem folder, run `zk_inception containers`. +1. In the ecosystem folder, run `zkstack containers`. 1. Redeploy your ERC20 contract to the L1. 1. Update the base token address in `/chains/custom_zk_chain/configs/contracts.yaml` under `l1.base_token_addr` and in `/chains/custom_zk_chain/ZkStack.yaml` under `base_token.address`. 1. Send ERC20 tokens to both of the ecosystem and chain governor addresses. -1. Initialize the ecosystem with `zk_inception ecosystem init --dev`. -1. Start the chain server with `zk_inception server`. +1. Initialize the ecosystem with `zkstack ecosystem init --dev`. +1. Start the chain server with `zkstack server`. 1. Bridge ERC20 tokens from the L1 to L2. diff --git a/content/tutorials/custom-zk-chain/_dir.yml b/content/tutorials/custom-zk-chain/_dir.yml index 42ac80c5..34906af4 100644 --- a/content/tutorials/custom-zk-chain/_dir.yml +++ b/content/tutorials/custom-zk-chain/_dir.yml @@ -19,7 +19,7 @@ what_you_will_learn: - How to setup a ZK chain with a custom base token. updated: 2024-08-14 tools: - - zk_inception + - zkstack - hardhat - cast - zksync-cli diff --git a/cspell-config/cspell-zksync.txt b/cspell-config/cspell-zksync.txt index d13800fa..4dc9cc45 100644 --- a/cspell-config/cspell-zksync.txt +++ b/cspell-config/cspell-zksync.txt @@ -12,6 +12,7 @@ zknode zkout zksolc zkstack +zkstackup !zkSync zksync ZKsync