zksync-cli contract

ZKsync CLI contract command reference
zksync-cli contract [sub-command] [options]

Description

The contract command provides several sub-commands to interact with transactions via the command line.

read

zksync-cli contract read [options]
--chainrequired
chain id

The id of the chain to create the transaction.

--rpc
URL

Override the defined L2 RPC URL for the Chain specified.

--contract
0x address

The address of the smart contract.

--method
string

The method with argument types in the smart contract to interact with.

Example: "balanceOf(address)"

--args, --arguments
string[]

The arguments for the smart contract method.

--data
string

The encoded transaction data to add to the transaction.

--output, --outputTypes
string[]

The expected output types returned from the method.

--from
0x address

The address to read on behalf of.

--abi
string

The relative file location of the contract artifact or ABI file.

--decode-skip
boolean

Set to true to skip the decoding response.

--show-info
boolean

Set to true to show the transaction request information (e.g. encoded data).

write

zksync-cli contract write [options]
--chainrequired
chain id

The id of the chain to create the transaction.

--rpc
URL

Override the defined L2 RPC URL for the Chain specified.

--contract
0x address

The address of the smart contract.

--method
string

The method with argument types in the smart contract to interact with.

Example: "transfer(address, uint256)"

--args, --arguments
string[]

The arguments for the smart contract method.

--value
Ether amount

The Ether value to send with the transaction.

--data
string

The encoded transaction data to add to the transaction.

--private-key, --pk
string

The private key of the sender used to generate the transaction.

--abi
string

The relative file location of the contract artifact or ABI file.

--show-info
boolean

Set to true to show the transaction request information (e.g. encoded data).

encode

zksync-cli contract encode [options]
--method
string

The method with argument types in the smart contract to interact with.

Example: "transfer(address, uint256)"

--args, --arguments
string[]

The arguments for the smart contract method.

--abi
string

The relative file location of the contract artifact or ABI file.


Made with ❤️ by the ZKsync Community