SkillAgentSearch skills...

Zwalletcli

A client CLI using GoSDK to interface the blockchain, and smart contracts for interest, lock, stake, and vesting

Install / Use

/learn @0chain/Zwalletcli
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

zwallet - a CLI for Züs wallet

zwallet is a command line interface (CLI) to demonstrate the wallet functionalities of Züs. For more information on Züs Network and the system overview, refer to docs.zus.network.

The CLI utilizes the Züs GoSDK.

Architecture

zwallet can be configured to work with any Züs network. It uses a config and a wallet file stored on the local filesystem.

For most transactions, zwallet uses the 0dns to discover the network nodes, then creates and submits transaction(s) to the miners, and finally waits for transaction confirmation on the sharders.

architecture

Getting started

1. Installation

Prerequisites

  • Go: Installation instructions for Mac, Linux and Windows can be found here.

Procedures

  1. Clone the zwalletcli repo and install
git clone https://github.com/0chain/zwalletcli.git
cd zwalletcli
make install
  1. Add config yaml at ~/.zcn/config.yaml

The following script sets https://demo.zus.network as your network.

cat > ~/.zcn/config.yaml << EOF
block_worker: https://dev.zus.network/dns
signature_scheme: bls0chain
min_submit: 50 # in percentage
min_confirmation: 50 # in percentage
confirmation_chain_length: 3
EOF
  1. Run zwallet to display the list of supported commands.
./zwallet

For machine requirements and pre-requisites, follow the guides below:

2. Run zwallet commands

The following steps assume that your terminal's working directory is inside the zwalletcli repo.

Global parameters

zwallet accept global parameters to override default configuration and can be used in any command.

| Parameter | Description | Default | | ------------- | ------------------------------- | -------------- | | --h,--help | Show help/parameters for a particular command | | | --config | Config file and description | config.yaml | | --configDir | Config directory | ~/.zcn | | --network | Network file | network.yaml | | --silent | Do not print detailed logs | false | | --wallet | Wallet file | wallet.json | | --withNonce | Nonce that will be used in transaction | 0 | | --fee | Transaction Fee for given transaction | if not set, default is blockchain min fee |

Commands

Set up bash autocompletion - zwallet completion

Generate the autocompletion script for zwallet for the specified shell and instructions to enable them.

Sample Usage:

  zwallet completion [command]

commands : bash/fish/powershell/zsh based on the specified shell

See each sub-command's help for details on how to use the generated script.

Creating and restoring wallets

Creating wallet - (any command)

Simply run create-wallet command and it will create a wallet if none exist yet.

create wallet

Here is a sample with create-wallet command and this creates a wallet at default location~/.zcn/wallet.json

./zwallet create-wallet

Sample Output

wallet saved in /home/ubuntu/.zcn/wallet.json
{"client_id":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"client_key":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"keys":[{"public_key":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"private_key":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}],
"mnemonics":"xxxx xxxx xxxx xxxxx",
"version":"1.0","date_created":"2023-05-03T12:44:46+05:30","nonce":0}

Recovering wallet - recoverwallet

recoverwallet is used when restoring a lost wallet or when loading the wallet from a different computer.

Given a wallet's mnemonics, you can recover and recreate your wallet.

| Parameter | Required | Description | Default | Valid Values | | ------------ | -------- | -------------------------------------- | ------- | ------------ | | --mnemonic | Yes | The mnemonics of the wallet to recover | | | | --offline | No | recover wallet without registration on blockchain| false | |

recover wallet

Sample command

./zwallet recoverwallet --wallet recovered_wallet.json --mnemonic "pull floor crop best weasel suit solid gown filter kitten loan absent noodle nation potato planet demise online ten affair rich panel rent sell"

Sample output

Wallet recovered!!

Verify recovered wallet

cat ~/.zcn/recovered_wallet.json

Exploring network nodes

Listing all miners - ls-miners

The list of miners are retrieved using the Miner smart contract.

| Parameter | Required | Description | Default | Valid Values | | ----------- | -------- | -------------------- | ------- | ----------------- | | --json | No | Print output as JSON | | <empty to enable> | | --active | No | Gets active miners only, set it false to get all miners | true | boolean | | --all | No | Include all registered miners, default returns the first page of miners | | <empty to enable> | | --limit | No | Limits the number of miners returned | 20 | integer | | --offset | No | Skips the number of miners mentioned | | integer | | --stakable| No | Gets stakable miners only if set to true | false | boolean |

List miner nodes

./zwallet ls-miners

Sample output

- ID:         cdb9b5a29cb5f48b350481694c4645c2db24500e3af210e22e2d10477a68bad2
- Host:       demo1.zus.networ
View on GitHub
GitHub Stars21
CategoryDevelopment
Updated5mo ago
Forks19

Languages

Go

Security Score

77/100

Audited on Oct 8, 2025

No findings