Züs
Search…
⌃K

Get Started

This section covers ZWallet CLI concepts, repository configuration, and installation.

Concepts

Wallet
A wallet is required to hold the tokens. It comes with private and public keys including a secret mnemonic key.‌
MultiSignature Wallet
A Multisignature Wallet is a wallet for which any transaction from this wallet needs to be voted by T(N) associated signer wallets. To create a Multisignature Wallet, you need to specify the number of signers (N) you want on that wallet and minimum number of votes (T) it needs for a transaction to be approved.
dStorage
Its distributed storage where all the data files are stored.‌

System requirements

To properly build components, you must have a Machine setup with the following requirements:‌
  • Windows,Linux ,Mac OS (Linux with ubuntu 18.04 preferred)
  • 4 vCPU, 8 Gb Memory at minimum
  • 50 GB of space to store the ZWallet build components. ‌
We will be building and describing Zbox CLI capabilities on Ubuntu Linux. So If you want to build Zbox CLI on other platforms.
Follow this guide for Windows and other Platforms and move straight to the Creating a Wallet section.

Prerequisites

Installing and running the ZWallet requires deployment-specific dependencies to be preinstalled‌.

GoLang Binaries

Installation instructions for Go can be found here.

Build-Essential

The build**-**essential package is required to build and make Zbox application. It includes the necessary GCC/g++ compilers and other essential critical libraries and utilities.
Run apt update command to update the packages.
sudo apt update
Get Build-essential package.
sudo apt-get install build-essential

Git

Git is required to retrieve and clone the Zbox repository. Install Git by using the command
sudo apt install git

Building ZWallet

1. Clone the Zbox Repository using the command
git clone https://github.com/0chain/zwalletcli.git
2. Navigate into Zboxcli directory using
cd zwalletcli
3. Use the make install command to compile the source code.
make install
This might take couple of minutes. Sample output after successful compiling:

Configure ZWallet network

Configuration for the 0Chain network by default is stored in network/one.yaml file of the zwallet github repo which we will copy to a new config.yaml file in our local system . The config.yaml file and all the other 0chain components information will be stored in a .zcn folder located in the home directory of the file system.
1.Make a new .zcn folder in the home Linux directory using
mkdir $HOME/.zcn
2. Copy the content from one.yaml to a new config.yaml file using
cp network/one.yaml $HOME/.zcn/config.yaml
3. To verify whether the config.yaml exists and network configuration is stored properly. Check the config.yaml details using the command
nano config.yaml
Response :
---
block_worker: https://one.devnet-0chain.net/dns
signature_scheme: bls0chain
min_submit: 50
min_confirmation: 50
confirmation_chain_length: 3
max_txn_query: 5
query_sleep_time: 5
# # OPTIONAL - Uncomment to use/ Add more if you want
# preferred_blobbers:
# - http://one.devnet-0chain.net:31051
# - http://one.devnet-0chain.net:31052

Change ZWallet network

  1. 1.
    Open the config.yaml file located at $HOME/.zcn path of your system. The config.yaml file contents should be similar to the code snippet below :
---
block_worker: https://one.devnet-0chain.net/dns
signature_scheme: bls0chain
min_submit: 50
min_confirmation: 50
confirmation_chain_length: 3
max_txn_query: 5
query_sleep_time: 5
# # OPTIONAL - Uncomment to use/ Add more if you want
# preferred_blobbers:
# - http://one.devnet-0chain.net:31051
# - http://one.devnet-0chain.net:31052
# - http://one.devnet-0chain.net:31053
Zwallet connects to the 0Chain network using the block_worker field. These network details are automatically fetched from the blockWorker's network API. Preferred Blobbers are also present which you can uncomment for using specified storage providers for handling your files.
2. Change the block_worker field for the desired network. In this case we will change it to beta.0chain.net. After changes it should look similar to the file below:
---
block_worker: https://beta.0chain.net/dns
signature_scheme: bls0chain
min_submit: 50
min_confirmation: 50
confirmation_chain_length: 3
max_txn_query: 5
query_sleep_time: 5
# # OPTIONAL - Uncomment to use/ Add more if you want
# preferred_blobbers:
# - http://beta.0chain.net:31051
# - http://beta.0chain.net:31052
# - http://beta.0chain.net:31053

Starting ZWallet

Start the Zbox by navigating back to ZWalletcli directory using
cd zwalletcli
and type
./zwallet
On a successful run you will see a help section like this:
Use Zwallet to store, send and execute smart contract on 0Chain platform.
Usage:
zwallet [command]
Available Commands:
auth-register Register an authorizer manually
auth-sc-register Register an authorizer to token bridge SC manually
bridge-auth-config Show authorizer configurations.
bridge-auth-config-update Update ZCNSC authorizer settings by ID
bridge-auth-delete Delete ZCNSC authorizer by ID
bridge-burn-eth burn eth tokens
bridge-burn-zcn burn zcn tokens
bridge-client-init init bridge client config (bridge.yaml) in HOME (~/.zcn) folder
bridge-config Show ZCNBridge configurations.
bridge-config-update Update ZCNSC bridge global settings
bridge-get-wzcn-burn get confirmed burn ticket for ethereum burn transaction
bridge-get-zcn-burn get the confirmed burn ticket for zcn burn transaction
bridge-import-account Import Ethereum account to local key storage (default $HOME/.zcn/wallets)
bridge-list-accounts List Ethereum account registered in local key chain
bridge-list-auth List authorizers
bridge-mint-wzcn mint WZCN tokens using the hash of ZCN burn transaction
bridge-mint-zcn mint zcn tokens using the hash of Ethereum burn transaction
bridge-owner-init init bridge owner config (owner.yaml) in HOME (~/.zcn) folder
bridge-verify verify ethereum transaction
collect-reward Pay accrued rewards for a stake pool.
completion Generate the autocompletion script for the specified shell
createmswallet create multisig wallet
faucet Faucet smart contract
fc-config Show Faucet configurations.
fc-update-config Update the Faucet smart contract
getbalance Get balance from sharders
getblobbers Get registered blobbers from sharders
getid Get Miner or Sharder ID from its URL
getnonce Get nonce from sharders
global-config Show global configurations.
global-update-config Update global settings
help Help about any command
ls-miners Get list of all active miners fro Miner SC
ls-sharders Get list of all active sharders fro Miner SC
mn-config Show miner SC configuration.
mn-info Get miner/sharder info from Miner SC.
mn-lock Add miner/sharder stake.
mn-pool-info Get miner/sharder pool info from Miner SC.
mn-unlock Unlock miner/sharder stake.
mn-update-config Update the miner smart contract
mn-update-node-settings Change miner/sharder settings in Miner SC.
mn-update-settings Change miner/sharder settings in Miner SC.
mn-user-info Get miner/sharder user pools info from Miner SC.
recoverwallet Recover wallet
register Registers the wallet with the blockchain
sc-config Show storage SC configuration.
sc-update-config Update the storage smart contract
send Send ZCN tokens to another wallet
verify verify transaction
version Prints version information
vp-add Add a vesting pool
vp-config Check out vesting pool configurations.
vp-delete Delete a vesting pool
vp-info Check out vesting pool information.
vp-list Check out vesting pools list.
vp-stop Stop vesting for one of destinations and unlock tokens not vested
vp-trigger Trigger a vesting pool work.
vp-unlock Unlock tokens of a vesting pool
vp-update-config Update the vesting pool configurations.
Flags:
--config string config file (default is config.yaml)
--configDir string configuration directory (default is $HOME/.zcn)
-h, --help help for zwallet
--network string network file to overwrite the network details (if required, default is network.yaml)
--silent Do not print sdk logs in stderr (prints by default)
--wallet string wallet file (default is wallet.json)
--withNonce int nonce that will be used in transaction (default is 0)
Use "zwallet [command] --help" for more information about a command.

Creating a Wallet

As you can see from the help menu, ZWallet CLI provides a long list of commands to use. Lets begin with creation of wallet on 0Chain decentralized network.
For creating a wallet using ZWallet. Simply run any zwallet command and it will create a wallet if none exist yet.
Here is a sample with faucet command which will create a wallet with test tokens at default location~/.zcn/wallet.json
./zwallet faucet --methodName pour --input "new wallet"
Verify the content of wallet using cat command:
cat ~/.zcn/wallet.json

Checking the wallet balance

To check whether the wallet is successfully created, verify the token balance in ZWallet using
./zwallet getbalance
Note that by default ZWallet checks balance for the wallet specified in wallet.json file located in the zcn folder in linux home directory.
Successful Response for ./zwallet getbalance command:
Balance: 1 (1.17 USD)

Getting tokens into the wallet

If getting Get balance failed.error when running ./zwallet getbalance command. Run the ./zwallet faucet --methodName pour --input "{Pay day}" command and then check the balance again.
The faucet command will get test tokens into the wallet for transactional purposes and make the wallet usable. Successful Response of the faucetcommand:
Execute faucet smart contract success
Now you have a wallet with available ZCN tokens, which can be used with 0chain blockchain and decentralized storage services.