{"id":18437856,"url":"https://github.com/zilliqa/zli","last_synced_at":"2025-04-07T20:34:36.962Z","repository":{"id":43734343,"uuid":"202662574","full_name":"Zilliqa/zli","owner":"Zilliqa","description":"Zilliqa's command line tool based on gozilliqa-sdk","archived":false,"fork":false,"pushed_at":"2022-11-25T10:18:26.000Z","size":343,"stargazers_count":3,"open_issues_count":10,"forks_count":5,"subscribers_count":18,"default_branch":"dev","last_synced_at":"2023-04-28T07:02:44.414Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Zilliqa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-16T05:14:37.000Z","updated_at":"2022-12-18T13:27:45.000Z","dependencies_parsed_at":"2023-01-22T00:46:16.297Z","dependency_job_id":null,"html_url":"https://github.com/Zilliqa/zli","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zilliqa%2Fzli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zilliqa%2Fzli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zilliqa%2Fzli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zilliqa%2Fzli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Zilliqa","download_url":"https://codeload.github.com/Zilliqa/zli/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223291499,"owners_count":17120965,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T06:16:27.495Z","updated_at":"2024-11-06T06:16:28.036Z","avatar_url":"https://github.com/Zilliqa.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zli\n\n\u003ca href=\"https://github.com/Zilliqa/zilliqa/blob/master/LICENSE\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-GPL%20v3-green.svg\" /\u003e\u003c/a\u003e\n\n`zli` is a command line tool based on the Zilliqa [Golang SDK](https://github.com/Zilliqa/gozilliqa-sdk).\n\n## Requirements\n\nGolang (minimum version: go.1.12):\n* [Download page](https://golang.org/dl/)\n* [Installation instructions](https://golang.org/doc/install)\n\n## Installation\n\n### Dependencies\n\nA `go` module is used to manage dependencies. Run the following command to download all dependencies according to the module file `go.mod`:\n\n```\ngo get ./...\n```\n\n### Build\n\nRun the following command to generate the `zli` binary:\n\n```go\ngo build -o zli main/main.go\n```\n\n### Install\n\nOption 1: Install the `zli` binary by specifying the output path during the build:\n\n```go\ngo build -o $GOPATH/bin/zli main/main.go\n```\n\nOption 2: Run the installation script:\n\n```bash\nsh install.sh\n```\n\n## Commands\n\nRun `zli -h` to see the help message along with the list of available commands:\n\n```bash\nA convenient command line tool to generate accounts, run integration testings or run http server .etc\n\nUsage:\n  zli [flags]\n  zli [command]\n\nAvailable Commands:\n  account     Generate or load multiple accounts\n  contract    Deploy or call zilliqa smart contract\n  help        Help about any command\n  rpc         readonly json rpc of zilliqa\n  transfer    Transfer zilliqa token to a specific account\n  version     Print the version number of zli\n  wallet      Init a new wallet or get exist wallet info\n\nFlags:\n  -h, --help   help for zli\n\nUse \"zli [command] --help\" for more information about a command.\n```\n\n`zli` works by storing account information in a wallet configuration file in `~/.zilliqa`.\n\nRun `zli [command] --help` to see the usage details for each available command. Here are some commonly used commands:\n\n### wallet\n\n* `zli wallet init`: Generate a new wallet (configuration file) for `zli` to use. A default account (using randomly generated private key) is created inside the wallet.\n* `zli wallet echo`: Print out the contents of the wallet (i.e., the configuration file).\n* `zli wallet from [flags]` : Generate a new wallet from a specific private key.\n\n### contract\n\n* `zli contract deploy [flags]`: Deploy a new contract.\n* `zli contract call [flags]`: Call an existing contract.\n* `zli contract state [flags]`: Get the state data for a specific smart contract.\n* `zli contract compact [flags]`: Compact smart contract\n\n### account\n\n* `zli account generate [flags]`: Generate a random private key.\n\n### transfer\n\n* `zli transfer [flags]`: Transfer Zilliqa tokens to a specific account.\n\n### rpc\n\n* `zli rpc transaction [flags]`: Get the transaction details for a specific transaction ID.\n* `zli rpc balance [flags]`:  Get balance and nonce by address(base16 or bech32).\n\n## Examples\n\n### Executing corner-case tests on a tiny contract\n\n1. Prepare the wallet (configuration file `~/.zilliqa`) by running `zli wallet init` or `zli wallet from -p [private_key]`:\n\n```json\n{\n\t\"api\": \"https://ipc-ud-api.dev.z7a.xyz\",\n\t\"chain_id\": 2,\n\t\"default_account\": {\n\t\t\"private_key\": \"227159779c78c9a920cba73086cf73fb3ee15cdd95380aa3b93757669e345300\",\n\t\t\"public_key\": \"0324cdd72db3de0e9f570d550631438d581056fb0d9c4daddbad2928eaf49f54ee\",\n\t\t\"address\": \"31f33d13ad6aa724cde1f3d12d75fb344a1df9de\",\n\t\t\"bech_32_address\": \"zil1x8en6yadd2njfn0p70gj6a0mx39pm7w7lz3kpm\"\n\t},\n\t\"accounts\": [{\n\t\t\"private_key\": \"227159779c78c9a920cba73086cf73fb3ee15cdd95380aa3b93757669e345300\",\n\t\t\"public_key\": \"0324cdd72db3de0e9f570d550631438d581056fb0d9c4daddbad2928eaf49f54ee\",\n\t\t\"address\": \"31f33d13ad6aa724cde1f3d12d75fb344a1df9de\",\n\t\t\"bech_32_address\": \"zil1x8en6yadd2njfn0p70gj6a0mx39pm7w7lz3kpm\"\n\t}]\n}\n```\n\n2. Deploy a tiny contract by running `sh scripts/deploy-tiny-contract.sh`\n\n3. Run `zli testsuit tiny -a [contract_address]` or `sh scripts/test-tiny-contract.sh` to execute the tests. If the receipt of any transaction returns `false`, execution stops and the remaining tests are aborted.\n\n### Invoking a contract\n\n1. Prepare the wallet similar to the previous example.\n\n2. Run the following command to invoke a smart contract:\n\n```bash\nzli contract call -a \u003csmart contract address\u003e -t \u003ctransition name\u003e -r \u003cparameter\u003e\n```\n\nFor instance:\n\n```bash\nzli contract call -a 305d5b3acaa2f4a56b5e149400466c58194e695f -t SubmitTransaction -r \"[{\\\"vname\\\":\\\"recipient\\\",\\\"type\\\":\\\"ByStr20\\\",\\\"value\\\":\\\"0x381f4008505e940ad7681ec3468a719060caf796\\\"},{\\\"vname\\\":\\\"amount\\\",\\\"type\\\":\\\"Uint128\\\",\\\"value\\\":\\\"10\\\"},{\\\"vname\\\":\\\"tag\\\",\\\"type\\\":\\\"String\\\",\\\"value\\\":\\\"a\\\"}]\"\n```\n\n\u003e Note\n\u003e\n\u003e `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.\n\n### Running zli inside a Docker container\n\nAn 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](https://docs.docker.com/install/)).\n\n1. Build the `go-zli` Docker image:\n\n```bash\nsh build_docker_image.sh\n```\n\n2. Run `zli` inside a container environment:\n\n```bash\ndocker run --rm -it -v ~/contract:/contract docker.pkg.github.com/zilliqa/zli/zli bash\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzilliqa%2Fzli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzilliqa%2Fzli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzilliqa%2Fzli/lists"}