Wallet actions

Use ZKsync CLI to interact with your wallet

The ZKsync CLI provides basic commands to interact with your wallet. You can review your balance of ETH or ERC20 token as well as transfer ETH and ERC20 tokens between L2 addresses.

Balance

You can review your ETH balance using the balance sub-command:

zksync-cli wallet balance

The CLI prompts for which chain to use as well as the account address. It then returns the balance of that account address on the selected chain.

? Chain to use ZKsync Sepolia Testnet
? Account address 0xfAa77e3314c82cD5097B80Ab42C6A3749f33dEE6

ZKsync Sepolia Testnet Balance: 0.099987931675 ETH (Ether)

ERC20 token balance

To display the balance of an ERC20 token for an account address, use the --token option with the address of the ERC20 smart contract.

zksync-cli wallet balance \
--token 0x927488F48ffbc32112F1fF721759649A89721F8F

It returns the balance for the account with the display of the ERC20 token name.

? Chain to use ZKsync Sepolia Testnet
? Account address 0xfAa77e3314c82cD5097B80Ab42C6A3749f33dEE6

ZKsync Sepolia Testnet Balance: 0.000000000000000001 Crown (Crown)

Transfer

You can transfer ETH and ERC20 tokens using the transfer sub-command. Use the --token option with the address of the token smart contract to transfer ERC20 tokens.

zksync-cli wallet transfer

This command requires the chain, the amount to transfer, the private key of the sender, and the recipient address.

? Chain to use ZKsync Mainnet
? Amount to transfer 0.000001
? Private key of the sender [hidden]
? Recipient address on L2 0xfAa77e3314c82cD5097B80Ab42C6A3749f33dEE6

On a successful transaction, the CLI returns the details of the transfer and the sender's balance.

Transfer sent:
 Transaction hash: 0x1692c703f7204a7e36581187890701b592b3c6f1e55b7ad55563a9ae2389fb56
 Transaction link: https://explorer.zksync.io/tx/0x1692c703f7204a7e36581187890701b592b3c6f1e55b7ad55563a9ae2389fb56

Sender L2 balance after transaction: 0.013199184619193711 ETH (Ether)

Made with ❤️ by the ZKsync Community