title | tags | ||||
---|---|---|---|---|---|
04. ZkSync Development Tools |
|
Authors: Evta, looking forward to your joining
More Details for ZKSync Development Tools: English Chinese
-
Blockchain Explorer: zkSync Era Block Explorer;
-
zkSync Faucet Chainstack Faucet;
-
zkSync CLI: zkSync CLI is a command line tool used to simplify zkSync development and interaction.
-
Running with zksync-cli:
npx zksync-cli dev start;
- Configure custom chains
npx zksync-cli config chains;
- Used to operate contracts on the chain (read, write, etc.)
npx zksync-cli contract read
- Query on-chain transaction information (transaction status, transfer amount, gas fee, etc.);
npx zksync-cli transaction info [options]
options:
-full: query detailed information
-raw: display the original JSON response;
- Create projects (front-end, smart contracts and scripts).
npx zksync-cli create
- Wallet is used to manage wallet-related functions (transfers, balance inquiries, etc.). Balance query:
npx zksync-cli wallet balance [options]
options:
-address: The address where you want to query the balance;
-token: If you want to query ERC20 tokens, you can add this parameter and pass in the contract address; -chain: Specify which chain to query on;
-rpc: specify the RPC URL; used to handle cross-chain operations between Ethernet and zkSync.
- Use
deposit
to transfer assetsfrom L1 to L2
:
npx zksync-cli bridge deposit;
- Use
withdraw
to transfer assetsfrom L2 to L1
:
npx zksync-cli bridge withdraw`
- Remix IDE also supports zkSync contract development(you need to start docker) by the zkSync Era Remix Plugin:
npx zksync-cli dev start
- Use
zksync-cli
to quickly create Hardhat projects:
npx zksync-cli create
-
zksync-ethers extends the
ethers
library to support zkSync-specific features (such as account abstraction) -
foundry-zksync allows users to use foundry to develop smart contracts on zkSync, introducing
zkforge
andzkcast
to extend the originalforge
andcast
make it easier for developers to develop in zkSync. -
The command can create a template test project named
test-demo
Run the following two lines of commands to install the third-party libraries that the project depends on, and add an additional zkSync data test tool package
npx zksync-cli create test-demo
npm install
npm install -D @matterlabs/hardhat-zksync-chai-matchers @nomicfoundation/hardhat-chai-matchers @nomiclabs/hardhat-ethers
Finally, run npm test
to start the test. All test files in the test
directory will be run. (zksolc
and solc
will be downloaded when starting for the first time. )