zksync-cli bridge
Facilitate bridge operations between L1 and L2 using zksync-cli.
Facilitate bridge operations between Ethereum (L1) and ZKsync Era (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.
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:
zksync-cli bridge deposit --token 0x3e622317f8C93f7328350cF0B56d9eD4C620C5d6
Withdraw
Transfer tokens from L2 back to L1.
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:
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.
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.