diff --git a/.vscode/markdown-snippets.code-snippets b/.vscode/markdown-snippets.code-snippets new file mode 100644 index 00000000..e39e12d0 --- /dev/null +++ b/.vscode/markdown-snippets.code-snippets @@ -0,0 +1,24 @@ +{ + // Place your zksync-docs workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and + // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope + // is left empty or omitted, the snippet gets applied to all languages. The prefix is what is + // used to trigger the snippet and the body will be expanded and inserted. Possible variables are: + // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. + // Placeholders with the same ids are connected. + // Example: + // "Print to console": { + // "scope": "javascript,typescript", + // "prefix": "log", + // "body": [ + // "console.log('$1');", + // "$2" + // ], + // "description": "Log output to console" + // } + "External Link": { + "scope": "markdown", + "prefix": "@exlink", + "body": [":external-link{text=\"$1\" href=\"$2\"}$0"], + "description": "External link component", + }, +} diff --git a/components/content/ExternalLink.vue b/components/content/ExternalLink.vue index 7d6bb4d5..06268acc 100644 --- a/components/content/ExternalLink.vue +++ b/components/content/ExternalLink.vue @@ -25,6 +25,6 @@ withDefaults(defineProps(), { text: '', href: '', target: '_blank', - rel: 'noopener noreferrer', + rel: 'noopener', }); diff --git a/content/40.tooling/00.zksync-block-explorers.md b/content/40.tooling/00.zksync-block-explorers.md new file mode 100644 index 00000000..8ed92587 --- /dev/null +++ b/content/40.tooling/00.zksync-block-explorers.md @@ -0,0 +1,72 @@ +--- +title: Block Explorers +description: Learn about the official and 3rd party resources for exploring the zkSync Era network. +--- + +The :external-link{text="zkSync Era Block Explorer" href="https://explorer.zksync.io/"} +details comprehensive data about transactions, blocks, batches, wallets, tokens, and smart contracts on the zkSync Era network. + +## Block Explorer API + +We’ve developed the zkSync Era Block Explorer API for developers to access zkSync Era Block Explorer data directly via HTTP requests. + +- :external-link{text="Mainnet Block Explorer API" href="https://block-explorer-api.mainnet.zksync.io/docs"} +- :external-link{text="Testnet Block Explorer API" href="https://block-explorer-api.sepolia.zksync.dev/docs"} + +The API provides various endpoints for many use cases you might want in your app. +It is compatible with :external-link{text="Etherscan API" href="https://docs.etherscan.io/"}, +which makes it easy to transition your existing apps to zkSync Era network. + +::callout{icon="i-heroicons-exclamation-triangle" color="amber"} +**The API does not fully cover all the functionality yet.** +
+We are working on additional endpoints to cover more use cases and to make developers’ experience better. Stay tuned for further updates. +:: + +Feel free to contribute and create issues and feature requests in [zkSync Era Block Explorer GitHub repo](https://github.com/matter-labs/block-explorer). + +## Other block explorers + +A full list of zkSync block explorers can be found on the zkSync website's :external-link{text="Block Explorers page" href="https://zksync.io/explore#explorers"}. + +### Etherscan - zkSync Era Explorer + +Etherscan allows you to explore and search the zkSync Era network +for transactions, addresses, tokens, prices and other activities taking place on the Network. + +- :external-link{text="Etherscan Mainnet" href="https://era.zksync.network/"} +- :external-link{text="Etherscan Testnet" href="https://sepolia-era.zksync.network/"} + +### L2Scan + +L2Scan is the open source block explorer for zkSync by the Unifra team + +- :external-link{text="L2Scan Mainnet" href="https://zksync-era.l2scan.co/"} +- :external-link{text="L2Scan Testnet" href="https://zksync-era-sepolia.l2scan.co/"} + +### Blockscout + +Blockscout is a blockchain explorer for inspecting, analyzing, and interacting with zkSync. + +- :external-link{text="Blockscout Mainnet" href="https://zksync.blockscout.com/"} +- :external-link{text="Blockscout Testnet" href="https://zksync-sepolia.blockscout.com/"} + +### Hyperscan + +Routescan's zkSync Explorer allows you to explore and search for transactions, addresses, tokens, prices and other activities taking place on zkSync. + +- :external-link{text="Hyperscan" href="https://hyperscan.xyz/"} + +### zkScan Lite + +:external-link{text="zkScan" href="https://zkscan.io/"} Block Explorer and Analytics Platform for zkSync Lite. + +### OKLink + +:external-link{text="OKLink" href="https://www.oklink.com/zksync"} provides a familiar UI with data on transactions, blocks, account balances and more. + +### NFTScan + +:external-link{text="NFT Explorer" href="https://zksync.nftscan.com/"} provides developers and users +with professional NFT asset data search and query functions, including: NFT Collection, NFT Contract, Wallet Address, +NFT TxHash and other multi-dimensional data search queries. diff --git a/content/40.tooling/10.zksync-cli/00.overview.md b/content/40.tooling/10.zksync-cli/00.overview.md new file mode 100644 index 00000000..389f8e14 --- /dev/null +++ b/content/40.tooling/10.zksync-cli/00.overview.md @@ -0,0 +1,51 @@ +--- +title: Overview +description: Learn how to use the powerful zkSync CLI tool for local development. +--- + +The zkSync Command Line Interface (CLI) is a powerful tool designed to simplify the development and interaction with zkSync from a command shell. + +## Usage + +You can run commands locally without installation using the following command: `npx zksync-cli`. For example: `npx zksync-cli dev start`. + +### Install zksync-cli + +You can alternatively install the CLI globally using the npm package manager: + +```bash +npm install -g zksync-cli +``` + +::callout{icon="i-heroicons-light-bulb" color="blue"} +If you go the route of installing the zksync-cli package locally, we recommend using the global option. +:: + +### Update zksync-cli + +If you installed `zksync-cli` via the npm package manager, you can update with the following: + +```bash +npm update -g zksync-cli +``` + +## Available Commands + +- [`dev`](./commands/local-node.md): Start a local development environment with zkSync and Ethereum nodes. +- [`create`](./commands/create.md): Scaffold new projects using templates for frontend, contracts, and scripting. +- [`contract`](./commands/contract-interaction.md): Read and write data to zkSync contracts without building UI. +- [`transaction`](./commands/transaction-info.md): Fetch and display detailed information about a specific transaction. +- [`wallet`](./commands/wallet.md): Manage zkSync wallet assets, including transfers and balance checks. +- [`bridge`](./commands/bridge.md): Perform deposits and withdrawals between Ethereum and zkSync. +- [`config chains`](./commands/custom-chains.md): Add or edit custom chains for flexible testing and development. + +## Further Assistance + +Need help? Join our :external-link{text="GitHub Discussions" href="https://github.com/zkSync-Community-Hub/zksync-developers/discussions/"} +to ask questions, share your experiences, and connect with the zkSync community. + +## Source Code + +The :external-link{text="zkSync CLI project" href="https://github.com/matter-labs/zksync-cli"} +is open-source and available on GitHub under the MIT License. +Feel free to contribute, report issues, or suggest new features to help us improve the tool for everyone. diff --git a/content/40.tooling/10.zksync-cli/01.troubleshooting.md b/content/40.tooling/10.zksync-cli/01.troubleshooting.md new file mode 100644 index 00000000..7249c5d8 --- /dev/null +++ b/content/40.tooling/10.zksync-cli/01.troubleshooting.md @@ -0,0 +1,60 @@ +--- +title: Troubleshooting +description: Get help with issues related to zksync-cli. +--- + +Encountering issues with zkSync CLI? Here are some common problems and step-by-step recommendations for resolving them: + +## `command not found: zksync-cli` + +If you try to use the `zksync-cli` command and receive the `command not found` message, double check if you +have the package installed locally or were using the `npx zksync-cli` command. + +## `unknown command` Error + +If you encounter an `unknown command` error, follow these steps: + +a. **Check the zkSync CLI Version** + +- Run `zksync-cli --version` to check your current version. +- Compare it with the latest version available on :external-link{text="npm" href="https://www.npmjs.com/package/zksync-cli"}. +- If your version is lower than the one on npm, follow the steps below. +If your version is up-to-date, it's possible that the command was moved or renamed. +Use `zksync-cli help` for a list of current commands or refer to the documentation. + +b. **Verify Local Installation** + +- Use `npm list zksync-cli` to check if `zksync-cli` is installed in the current directory or any parent directories from where you are running your terminal. +- If it is indeed installed, make sure to uninstall it by running `npm uninstall zksync-cli` in its installation location. +Remove all instances of `zksync-cli` until none are found by `npm list zksync-cli`. + +c. **Verify Global Installation** + +- Use `npm list -g zksync-cli` to check if `zksync-cli` is installed globally. +- If it is installed globally, uninstall it using `npm uninstall -g zksync-cli`. + +d. **Clean npm Cache** + +- Run `npm cache clean --force`. + +e. **Use the Latest Version** + +- As a quick fix, or if the above steps don't resolve the issue, use `npx zksync-cli@latest [command]`, for example, `npx zksync-cli@latest dev start`. + +## My version is outdated + +If `zksync-cli` is not running the latest version: + +- Refer to the [instructions for `unknown command` Error](/tooling/zksync-cli/troubleshooting#unknown-command-error) +above to check and update your zkSync CLI version. + +## `command not found: npx` Error + +If you receive a `command not found: npx` error, it means Node.js is not installed or not correctly set up on your system: + +- Install Node.js from :external-link{text="the official website" href="https://nodejs.org/"}. This will also install `npm` and `npx`. +- After installation, restart your terminal and try running `npx zksync-cli` again. + +## Other issues + +For all other issues, we encourage you to seek help or report them in our :external-link{text="GitHub Discussions" href="https://github.com/zkSync-Community-Hub/zksync-developers/discussions/new?category=general&title=[zksync-cli]%20"}. diff --git a/content/40.tooling/10.zksync-cli/10.dev.md b/content/40.tooling/10.zksync-cli/10.dev.md new file mode 100644 index 00000000..4b876086 --- /dev/null +++ b/content/40.tooling/10.zksync-cli/10.dev.md @@ -0,0 +1,54 @@ +--- +title: zksync-cli dev +description: Manage a local node with zksync-cli. +--- + +Utilize `zksync-cli` to effortlessly initiate a local development environment. +Using the command, `zksync-cli dev start`, you can spin up local zkSync and Ethereum nodes, along with Block Explorer, Wallet, and Bridge +for a seamless development experience. + +### Prerequisites + +Before beginning, ensure you have installed: + +- :external-link{text="Node.js" href="https://nodejs.org"} v18+ +- :external-link{text="Git" href="https://git-scm.com/downloads"} +- :external-link{text="Docker" href="https://www.docker.com/get-started/"} + +## Starting and Stopping Nodes + +- **Start**: `zksync-cli dev start` initiates your local environment. On the first run, it prompts to select a node and additional modules. +- **Stop**: `zksync-cli dev stop` terminates the local environment. Use `zksync-cli dev stop [module name]` to stop specific modules. +- **Restart**: `zksync-cli dev restart` or `zksync-cli dev restart [module name]` restarts your environment or specific modules. + +## Configuring Your Environment + +- `zksync-cli dev config` allows the selection of nodes and additional modules like block explorer and bridge. +Run modules such as Block Explorer against an already running node by adding a new chain. + +## Managing Modules + +- `zksync-cli dev modules` lists all installed modules, providing a clear overview of your environment's components. + +## Viewing Logs + +- `zksync-cli dev logs` displays logs for all active modules, essential for monitoring and debugging. + +## Cleaning Modules + +- `zksync-cli dev clean` removes all module data from your computer. For specific modules, use `zksync-cli dev clean [module name]`. + +## Updating Modules + +- `zksync-cli dev update [module name]` updates individual modules, ensuring you're running the latest versions. + +## Troubleshooting + +If modules malfunction, e.g., failing to start: + +1. Use `zksync-cli dev stop` to cease all operations. +2. Reinstall the problematic module with `zksync-cli dev clean [module name]`. +3. Restart with `zksync-cli dev start`. Check Docker container logs for detailed errors, accessible through Docker Desktop. +4. Persisting issues? Please report them in our :external-link{text="GitHub discussions" href="https://github.com/zkSync-Community-Hub/zksync-developers/discussions/new?category=general&title=[zksync-cli]%20<Title>"}. + +For additional assistance, refer to our [troubleshooting guide](/tooling/zksync-cli/troubleshooting). diff --git a/content/40.tooling/10.zksync-cli/20.create.md b/content/40.tooling/10.zksync-cli/20.create.md new file mode 100644 index 00000000..45f8d6c9 --- /dev/null +++ b/content/40.tooling/10.zksync-cli/20.create.md @@ -0,0 +1,48 @@ +--- +title: zksync-cli create +description: Use the zksync-cli create command to streamline project setup. +--- + +The `zksync-cli create` command streamlines project setup by offering templates for frontend development, smart contracts, +and scripting for zkSync, enabling rapid deployment and development. + +### Prerequisites + +Ensure you have the following installed before you start: + +- :external-link{text="Node.js" href="https://nodejs.org"} v18+ +- :external-link{text="Git" href="https://git-scm.com/downloads"} + +## Available Templates + +`zksync-cli create` simplifies the initial project setup by providing templates in three main categories: + +### Frontend + +Fast-track your UI development with our frontend templates, supporting popular frameworks like Vue, React, Next.js, Nuxt, and Vite. +Options include viem, ethers, web3modal, rainbowkit, and more, equipping you with the necessary tools for dApp development. + +:external-link{text="zksync-frontend-templates repo" href="https://github.com/matter-labs/zksync-frontend-templates#readme"} + +### Contracts + +For smart contract development, choose from templates designed for quick deployment and testing, compatible with Solidity or Vyper. +Utilize tools like Hardhat to streamline your workflow. + +:external-link{text="zksync-contract-templates repo" href="https://github.com/matter-labs/zksync-contract-templates#readme"} + +### Scripting + +Enhance your project with Node.js scripting templates for automated interactions and advanced zkSync operations. +Includes examples of wallet or contract interactions using viem, ethers, or web3.js. + +:external-link{text="zksync-scripting-templates repo" href="https://github.com/matter-labs/zksync-scripting-templates#readme"} + +## Using Templates + +To create a project using a template, run the following command and follow the prompts to select your desired template category +and specific framework or tool: + +```bash +zksync-cli create +``` diff --git a/content/40.tooling/10.zksync-cli/30.contract.md b/content/40.tooling/10.zksync-cli/30.contract.md new file mode 100644 index 00000000..f9bc86f8 --- /dev/null +++ b/content/40.tooling/10.zksync-cli/30.contract.md @@ -0,0 +1,244 @@ +--- +title: zksync-cli contract +description: Interact with contracts using the zksync-cli contract command. +--- + +The `zksync-cli contract` command comes with actions to read, write and encode smart contracts on zkSync. +These commands automate tasks such as method verification, ABI handling, output decoding, and proxy contract processing. + +::callout{icon="i-heroicons-light-bulb" color="blue"} +After running a command with prompts you will see a full command with all the options that you can copy +and use later to quickly run the same command again. +:: + +## Contract Read + +The `zksync-cli contract read` command executes read-only methods on contracts, like checking ERC-20 balances or contract states. + +### Read Options + +You do not need to specify options below, you will be prompted to enter them if they are not specified. + +- `--chain <chain-name>`: Select the chain to use (e.g., `zksync-mainnet`, `zksync-sepolia`). +- `--rpc <url>`: Provide RPC URL instead of selecting a chain +- `--contract <address>`: Specify contract's address +- `--method <method-signature>`: Defines the contract method to interact with +- `--arguments <method-arguments...>`: Pass arguments to the contract method +- `--data <0x-transaction-data>`: Instead of specifying the method and arguments, you can pass the raw transaction data +- `--outputTypes <output-types...>`: Specifies output types for decoding +- `--from <address>`: Call method on behalf of specified address +- `--abi <path>`: Path to local ABI file or contract artifact +- `--decode-skip`: Skips prompting for output types and decoding the response +- `--show-info`: Displays transaction request information (e.g. encoded transaction data) + +### Basic read example + +```bash +zksync-cli contract read +``` + +1. You will be prompted to select a chain, contract address, and method. + + ```bash + ? Chain to use: zkSync Sepolia Testnet + ? Contract address: 0x45E6dC995113fd3d1A3b1964493105B9AA9a9A42 + ``` + +1. Next you need to select a **method (function) to call**. + + - In case your contract is verified it will automatically identify the ABI: + + ```bash + ? Contract method to call + ────────── Provided contract ────────── + ❯ balanceOf(address account) view returns (uint256) + decimals() pure returns (uint8) + name() pure returns (string) + symbol() pure returns (string) + totalSupply() view returns (uint256) + ─────────────────────────────────────── + Type method manually + ``` + + - Otherwise you'll have to enter method signature manually. + + ```bash + ? Enter method to call: balanceOf(address) + ``` + + - Alternatively, you can specify the ABI file manually using the `--abi` option. [See example](#using-local-abi-file) + +1. You will be prompted to enter **arguments** for the method, one by one. + + ```bash + ? Provide method arguments: + ? [1/1] account (address): 0xa1cf087DB965Ab02Fb3CFaCe1f5c63935815f044 + ``` + + When submitted a contract call will be made and you'll see the response in it's original encoded form. + + ```bash + ✔ Method response (raw): 0x000000000000000000000000000000000000000000010508e606548a9e5d2000 + ``` + +1. you will be asked the **method output** type to decode the response. +You can skip this step by submitting empty response or completely skip it by passing `--decode-skip` option. + + ```bash + ? Output types: uint256 + ✔ Decoded method response: 1232701801010000000000000 + ``` + +### Running read on behalf of another address + +You can specify the `--from` option to run the method on behalf of another address. +This is useful when you need to call a method that expects a specific address as `msg.sender`. + +```bash +zksync-cli contract read \ + --from "0xa1cf087DB965Ab02Fb3CFaCe1f5c63935815f044" +``` + +## Contract Write + +The `zksync-cli contract write` command performs write operations on smart contracts. +It enables sending transactions that alter the state of a contract, such as transferring tokens or changing ownership. + +### Write Options + +You do not need to specify options below, you will be prompted to enter them if they are not specified. + +- `--chain <chain-name>`: Select the chain to use +- `--rpc <url>`: Provide RPC URL instead of selecting a chain +- `--contract <address>`: Specify contract's address +- `--method <method-signature>`: Defines the contract method to interact with +- `--arguments <method-arguments...>`: Pass arguments to the contract method +- `--value <ether-amount>`: Ether amount to send with the transaction (e.g. 0.01) +- `--private-key <wallet-private-key>`: Private key of the wallet to use to sign the transaction +- `--data <0x-transaction-data>`: Instead of specifying the method and arguments, you can pass the raw transaction data +- `--abi <path>`: Path to local ABI file or contract artifact +- `--show-info`: Displays transaction request information (e.g. encoded transaction data) + +### Basic write example + +```bash +zksync-cli contract write +``` + +1. You will be prompted to select a chain, contract address, and method. + + ```bash + ? Chain to use: zkSync Sepolia Testnet + ? Contract address: 0x45E6dC995113fd3d1A3b1964493105B9AA9a9A42 + ``` + +1. Select a **method (function) to call**. + + - In case your contract is verified it will automatically identify the ABI: + + ```bash + ? Contract method to call + ────────── Provided contract ────────── + ❯ approve(address spender, uint256 amount) returns (bool) + transfer(address to, uint256 amount) returns (bool) + ─────────────────────────────────────── + Type method manually + ``` + + - Otherwise you'll have to enter method signature manually, for example `transfer(address,uint256)`. + + ```bash + ? Enter method to call: transfer(address,uint256) + ``` + + - Alternatively, you can specify the ABI file manually using the `--abi` option. [See example](#using-local-abi-file) + +1. You will be prompted to enter **arguments** for the method, one by one. + + ```bash + ? Provide method arguments: + ? [1/2] to (address): 0xa1cf087DB965Ab02Fb3CFaCe1f5c63935815f044 + ? [2/2] amount (uint256): 1 + ``` + +1. provide private key of the wallet to use to sign the transaction. + + ```bash + ? Private key of the wallet to sign transaction: ***** + ``` + +When submitted a contract call will be made and you'll see the transaction hash. + +```bash +✔ Transaction submitted. Transaction hash: 0xa83ad7e8932e18cdc57d3892040505a50d560a56fa507cabcd4180e9e5898bec +``` + +## Encode + +The `zksync-cli contract encode` command will get calldata (e.g. 0x1234) from contract method signature and arguments. + +### Encode options + +- `--method <contractMethod(arguments)>`: Contract method to interact with +- `--args, --arguments <arguments...>`: Arguments +- `--abi <path/to/abi>`: Contract artifact or ABI file location. + +### Basic encode example + +```bash +zksync-cli contract encode +``` + +1. Select a **method (function) to encode**. + + - Enter method signature manually, for example `transfer(address,uint256)`. + + ```bash + ? Enter method to call: transfer(address,uint256) + ``` + + - Alternatively, you can specify the ABI file using the `--abi` option. [See example](#using-local-abi-file) + + ```bash + ? Contract method to call + ────────── Provided contract ────────── + ❯ approve(address spender, uint256 amount) returns (bool) + transfer(address to, uint256 amount) returns (bool) + ─────────────────────────────────────── + Type method manually + ``` + +1. Enter the **arguments** for the method, one by one. + + ```bash + ? Provide method arguments: + ? [1/2] to (address): 0xa1cf087DB965Ab02Fb3CFaCe1f5c63935815f044 + ? [2/2] amount (uint256): 1 + ``` + +When finished you will see the encoded data. + +```bash +✔ Encoded data: 0xa41368620000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000c48656c6c6f20776f726c64210000000000000000000000000000000000000000 +``` + +## Using a local ABI file + +You can specify a local ABI file using the `--abi` option. +It should be a JSON file with either ABI data (array) or contract artifact which you get after compiling your contracts. + +```bash +zksync-cli contract read \ + --abi "./Greeter.json" +``` + +You will be prompted to select a method (function): + +```bash + ────────── Provided contract ────────── +❯ greet() view returns (string) + ─────────────────────────────────────── + Type method manually +``` + +Response will be decoded automatically according to the ABI file. diff --git a/content/40.tooling/10.zksync-cli/40.transaction.md b/content/40.tooling/10.zksync-cli/40.transaction.md new file mode 100644 index 00000000..a5a9b3ba --- /dev/null +++ b/content/40.tooling/10.zksync-cli/40.transaction.md @@ -0,0 +1,87 @@ +--- +title: zksync-cli transaction +description: Interact with transaction information using zksync-cli. +--- + +The `zksync-cli transaction info` command is designed to fetch and display detailed information about a specific transaction. +It can be used to check the status, amounts transferred, fees, method signatures, and arguments of transactions. + +## Options + +If no options are provided directly, the CLI will prompt the user to enter the necessary information, such as the chain and transaction hash. + +- `--tx <transaction hash>`: Specify the transaction hash to query. +- `--chain <chain-name>`: Select the chain to use (e.g., `zksync-mainnet`, `zksync-sepolia`). +- `--rpc <url>`: Provide RPC URL instead of selecting a chain +- `--full`: Show all available transaction data for comprehensive insights. +- `--raw`: Display the raw JSON response from the node. +- `--abi <path>`: Path to a local ABI file to decode the transaction's input data. + +## Examples + +### Basic usage + +```bash +zksync-cli transaction info +``` + +You will be prompted to select a chain and transaction hash. + +```bash +? Chain to use: zkSync Sepolia Testnet +? Transaction hash: 0x2547ce8219eb7ed5d73e68673b0e4ded83afc732a6c651d43d9dc49bb2f13d40 +``` + +The command will display detailed information about the transaction: + +```bash +──────────────────── Main info ──────────────────── +Transaction hash: 0x2547ce8219eb7ed5d73e68673b0e4ded83afc732a6c651d43d9dc49bb2f13d40 +Status: completed +From: 0x56DDd604011c5F8629bd7C2472E3504Bd32c269b +To: 0xBB5c309A3a9347c0135B93CbD53D394Aa84345E5 +Value: 0 ETH +Fee: 0.0001503581 ETH | Initial: 0.0004 ETH Refunded: 0.0038496419 ETH +Method: transmit(bytes,bytes32[],bytes32[],bytes32) 0xc9807539 + +───────────────── Method arguments ───────────────── +[1] bytes: 0x0000000000000000000000fd69e45d6f51e482ac4f8f2e14f2155200008b5f010001020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000007df298c81a0000000000000000000000000000000000000000000000000000007df298c81a0000000000000000000000000000000000000000000000000000007df298c81a +[2] bytes32[]: 0xd737d65b6b610c3f330bcfddbfc08e46d2a628c88bf22ec0d8f25627a3330798,0x9d33be2ba33b731555c13a4e7bf02d3d576fa3115f7523cbf07732321c85cdba +[3] bytes32[]: 0x73d639deda36b781ae049c8eceafba4196ee8ecc1efb74c538a28ea762ff6658,0x37ac79ff2ca902140613b0e51357d8fb218a67b4736bdee0c268c5fd9812e146 +[4] bytes32: 0x0101000000000000000000000000000000000000000000000000000000000000 + +───────────────────── Details ───────────────────── +Date: 2/8/2024, 2:19:54 PM (15 minutes ago) +Block: #364999 +Nonce: 50131 +``` + +### Parsing transaction data + +By default `zksync-cli` tries to fetch contract verification data from the server. +In case this is not possible it queries the +:external-link{text="open signature" href="https://www.4byte.directory/"} database to get the signature of the transaction method. +If the method signature is not found, the transaction's data is displayed as a hex string. + +Alternatively, you can provide the path to a local ABI file to decode the transaction's input data: + +```bash +zksync-cli transaction info \ + --abi "./Greeter.json" +``` + +### Viewing detailed information + +For an even more detailed overview you can use the `--full` option: + +```bash +zksync-cli transaction info --full +``` + +### Displaying raw JSON response + +To view the raw JSON response from the zkSync node, use the `--raw` option: + +```bash +zksync-cli transaction info --raw +``` diff --git a/content/40.tooling/10.zksync-cli/50.wallet.md b/content/40.tooling/10.zksync-cli/50.wallet.md new file mode 100644 index 00000000..6ff82343 --- /dev/null +++ b/content/40.tooling/10.zksync-cli/50.wallet.md @@ -0,0 +1,67 @@ +--- +title: zksync-cli wallet +description: Manage your wallet on zkSync using zksync-cli. +--- + +Utilize the `zksync-cli wallet` command for an easy way to manage your assets on zkSync, like token transfers and balance check. + +## Commands + +- `transfer [options]` - Transfer tokens on L2 to another account. +- `balance [options]` - Get token balance of an L2 account. + +## Transfer + +To transfer ETH between accounts on zkSync, use the following command: + +```bash +zksync-cli wallet transfer +``` + +### Options + +If no options are provided directly, the CLI will prompt the user to enter the necessary information + +- `--amount <0.1>`: Specify the amount to transfer. +- `--chain <chain>`: Select the chain to use. +- `--rpc <URL>`: Override the default L2 RPC URL. +- `--pk`, `--private-key <wallet private key>`: Use the private key of the sender for the transaction. +- `--to`, `--recipient <0x address>`: Define the recipient address on L2. +- `--token <token address>`: Specify an ERC-20 token for the transfer instead of ETH. + +### Examples + +#### Transfer ERC-20 Token + +For transferring ERC-20 tokens, include the `--token` option with the token's contract address: + +```bash +zksync-cli wallet transfer --token 0x3e622317f8C93f7328350cF0B56d9eD4C620C5d6 +``` + +## Balance + +View an L2 wallet's ETH balance using the following command: + +```bash +zksync-cli wallet balance +``` + +### Options + +If no options are provided directly, the CLI will prompt the user to enter the necessary information + +- `--address <0x address>`: Address of the wallet to check. +- `--token <token address>`: Specify an ERC-20 token for the transfer instead of ETH. +- `--chain <chain>`: Chain to use. +- `--rpc <URL>`: Override the default L2 RPC URL. + +### Examples + +#### Checking ERC-20 Token Balance + +To check the balance of a specific ERC-20 token, use the `--token` option, for example: + +```bash +zksync-cli wallet balance --token 0x3e622317f8C93f7328350cF0B56d9eD4C620C5d6 +``` diff --git a/content/40.tooling/10.zksync-cli/60.bridge.md b/content/40.tooling/10.zksync-cli/60.bridge.md new file mode 100644 index 00000000..24453199 --- /dev/null +++ b/content/40.tooling/10.zksync-cli/60.bridge.md @@ -0,0 +1,91 @@ +--- +title: zksync-cli bridge +description: Facilitate bridge operations between L1 and L2 using zksync-cli. +--- + +Facilitate bridge operations between Ethereum (L1) and zkSync (L2), including token deposits, withdrawals, +and finalizing withdrawals with the `zksync-cli bridge` command. + +## Commands + +- `deposit [options]` - Transfer token from L1 to L2. +- `withdraw [options]` - Transfer token from L2 to L1. +- `withdraw-finalize [options]` - Finalize withdrawal of funds. + +## Deposit + +Transfer ETH from L1 to L2 using the deposit command. + +```bash +zksync-cli bridge deposit +``` + +### Options + +If options are not specified, you will be prompted to enter them. + +- `--to, --recipient <0x address>`: Recipient address on L2. +- `--amount <0.1>`: Amount to deposit. +- `--token <0x address>`: ERC-20 token address. +- `--pk, --private-key <wallet private key>`: Private key of the sender. +- `--chain <chain>`: Chain to use. +- `--l1-rpc <URL>`: Override L1 RPC URL. +- `--rpc <URL>`: Override L2 RPC URL. + +### Examples + +#### Depositing ERC-20 Tokens + +To deposit ERC-20 tokens, include the `--token` option with the token's contract address: + +```bash +zksync-cli bridge deposit --token 0x3e622317f8C93f7328350cF0B56d9eD4C620C5d6 +``` + +## Withdraw + +Transfer tokens from L2 back to L1. + +```bash +zksync-cli bridge withdraw +``` + +### Options + +You will be prompted to enter options if they are not specified. + +- `--to, --recipient <0x address>`: Recipient address on L1. +- `--amount <0.1>`: Amount to withdraw. +- `--token <0x address>`: ERC-20 token address (omit this option to withdraw ETH). +- `--pk, --private-key <wallet private key>`: Private key of the sender. +- `--chain <chain>`: Chain to use. +- `--l1-rpc <URL>`: Override L1 RPC URL. +- `--rpc <URL>`: Override L2 RPC URL. + +### Examples + +#### Withdrawing ERC-20 Tokens + +For withdrawing ERC-20 tokens, specify the token address using the `--token` option: + +```bash +zksync-cli bridge withdraw --token 0x3e622317f8C93f7328350cF0B56d9eD4C620C5d6 +``` + +## Withdraw Finalize + +Finalize the withdrawal of funds with the following command. **This step is necessary to complete the withdrawal process initiated on L2.** + +```bash +zksync-cli bridge withdraw-finalize +``` + +### Options + +Options will be prompted if not specified. + +- `--hash <transaction_hash>`: L2 withdrawal transaction hash to finalize. +- `--pk, --private-key <wallet private key>`: Private key of the sender. +- `--chain <chain>`: Chain to use. +- `--l1-rpc <URL>`: Override L1 RPC URL. +- `--rpc <URL>`: Override L2 RPC URL. diff --git a/content/40.tooling/10.zksync-cli/70.config-chains.md b/content/40.tooling/10.zksync-cli/70.config-chains.md new file mode 100644 index 00000000..146e6446 --- /dev/null +++ b/content/40.tooling/10.zksync-cli/70.config-chains.md @@ -0,0 +1,33 @@ +--- +title: zksync-cli config chains +description: Configure custom chains to use with zksync-cli. +--- + +Specify your own chain configuration by adding or editing custom chains to use on `zksync-cli`. +This feature is essential for developers looking to interact with ZK Stack Hyperchains. + +## Configuring Custom Chains + +To add or edit a custom chain, use the following command: + +```bash +zksync-cli config chains +``` + +Upon execution, you will be guided through a series of prompts to enter specific details for the custom chain, including: + +- **Chain ID**: The id for the chain. +- **Chain Name**: A name for the chain. +- **Chain key**: A unique identifier for the chain. +- **RPC URL**: The RPC endpoint URL for interacting with the chain. +- **Other Information**: Depending on the chain's requirements, you may need to provide additional information such as block explorer URLs. + +## Using Custom Chains + +Once a custom chain is configured, you can use it across various `zksync-cli` commands. +All of your custom chains will be listed in the chain selection prompt, allowing you to select and use them as needed. +You can also specify a custom chain directly using the `--chain` option, for example: + +```bash +zksync-cli wallet balance --chain <custom-chain-key> +``` diff --git a/content/40.tooling/10.zksync-cli/_dir.yml b/content/40.tooling/10.zksync-cli/_dir.yml new file mode 100644 index 00000000..acdf43cf --- /dev/null +++ b/content/40.tooling/10.zksync-cli/_dir.yml @@ -0,0 +1 @@ +title: zkSync CLI diff --git a/content/40.tooling/_dir.yml b/content/40.tooling/_dir.yml new file mode 100644 index 00000000..a750e3b2 --- /dev/null +++ b/content/40.tooling/_dir.yml @@ -0,0 +1 @@ +title: Tooling diff --git a/content/20.api-reference/00.index.md b/content/70.api-reference/00.index.md similarity index 100% rename from content/20.api-reference/00.index.md rename to content/70.api-reference/00.index.md diff --git a/content/20.api-reference/10.conventions.md b/content/70.api-reference/10.conventions.md similarity index 100% rename from content/20.api-reference/10.conventions.md rename to content/70.api-reference/10.conventions.md diff --git a/content/20.api-reference/20.zks-rpc.md b/content/70.api-reference/20.zks-rpc.md similarity index 100% rename from content/20.api-reference/20.zks-rpc.md rename to content/70.api-reference/20.zks-rpc.md diff --git a/content/20.api-reference/30.debug-rpc.md b/content/70.api-reference/30.debug-rpc.md similarity index 100% rename from content/20.api-reference/30.debug-rpc.md rename to content/70.api-reference/30.debug-rpc.md diff --git a/content/20.api-reference/35.ethereum-rpc.md b/content/70.api-reference/35.ethereum-rpc.md similarity index 100% rename from content/20.api-reference/35.ethereum-rpc.md rename to content/70.api-reference/35.ethereum-rpc.md diff --git a/content/20.api-reference/40.pub-sub-rpc.md b/content/70.api-reference/40.pub-sub-rpc.md similarity index 100% rename from content/20.api-reference/40.pub-sub-rpc.md rename to content/70.api-reference/40.pub-sub-rpc.md diff --git a/content/20.api-reference/_dir.yml b/content/70.api-reference/_dir.yml similarity index 100% rename from content/20.api-reference/_dir.yml rename to content/70.api-reference/_dir.yml diff --git a/content/20.api-reference/_partials/_call-request-params.md b/content/70.api-reference/_partials/_call-request-params.md similarity index 100% rename from content/20.api-reference/_partials/_call-request-params.md rename to content/70.api-reference/_partials/_call-request-params.md diff --git a/content/20.api-reference/_partials/_filter-object.md b/content/70.api-reference/_partials/_filter-object.md similarity index 100% rename from content/20.api-reference/_partials/_filter-object.md rename to content/70.api-reference/_partials/_filter-object.md diff --git a/content/20.api-reference/_partials/_quantity-tag.md b/content/70.api-reference/_partials/_quantity-tag.md similarity index 100% rename from content/20.api-reference/_partials/_quantity-tag.md rename to content/70.api-reference/_partials/_quantity-tag.md diff --git a/content/20.api-reference/_partials/_trace-object.md b/content/70.api-reference/_partials/_trace-object.md similarity index 100% rename from content/20.api-reference/_partials/_trace-object.md rename to content/70.api-reference/_partials/_trace-object.md diff --git a/cspell-config/cspell-blockchain.txt b/cspell-config/cspell-blockchain.txt index 6dd649e1..51c929a7 100644 --- a/cspell-config/cspell-blockchain.txt +++ b/cspell-config/cspell-blockchain.txt @@ -6,3 +6,5 @@ merkle Weth Geth gwei +sepolia +Unifra diff --git a/cspell.json b/cspell.json index 8ba6fe42..21fca5f6 100644 --- a/cspell.json +++ b/cspell.json @@ -58,5 +58,5 @@ } ], "allowCompoundWords": true, - "flagWords": ["hte", "hve", "teh"] + "flagWords": ["hte", "hve", "teh", "cna"] }