The Github repository can be found at https://github.com/Zilliqa/zli
Run the following to clone the repository to your local machine
Run the following command to generate the
Option 1: Install the
zli binary by specifying the output path during the build:
Option 2: Run the installation script:
zli -h to see the help message along with the list of available commands:
zli works by storing account information in a wallet configuration file in
zli [command] --help to see the usage details for each available command. Here are some commonly used commands:
zli wallet init: Generate a new wallet (configuration file) for
zlito use. A default account (using randomly generated private key) is created inside the wallet.
zli wallet echo: Print out the contents of the wallet (i.e., the configuration file).
zli wallet from [flags]: Generate a new wallet from a specific private key.
zli contract deploy [flags]: Deploy a new contract.
zli contract call [flags]: Call an existing contract.
zli contract state [flags]: Get the state data for a specific smart contract.
zli account generate [flags]: Generate a random private key.
zli transfer [flags]: Transfer Zilliqa tokens to a specific account.
zli rpc transaction [flags]: Get the transaction details for a specific transaction ID.
Executing Corner-Case Tests on a Tiny Contract
- Prepare the wallet (configuration file
~/.zilliqa) by running
zli wallet initor
zli wallet from -p [private_key]:
Deploy a tiny contract by running
zli testsuit tiny -a [contract_address]or
sh scripts/test-tiny-contract.shto execute the tests. If the receipt of any transaction returns
false, execution stops and the remaining tests are aborted.
Invoking a Contract
Prepare the wallet similar to the previous example.
Run the following command to invoke a smart contract:
zli supports passing the private key as a parameter to the
zli contract deploy or
zli contract call command. Just use the
-k [private key] option to switch to a different private key for sending transactions.
Running zli Inside a Docker Container
An alternative to running
zli as a native binary is to build (or download) the
go-zli Docker image, and to run
zli from inside the container. This option requires prior installation of Docker (refer to the Docker installation page).
- Build the
zliinside a container environment: