From 84873fd7925b5390f067f3c346a074d779122300 Mon Sep 17 00:00:00 2001 From: digismash <149180324+digismash@users.noreply.github.com> Date: Wed, 1 Nov 2023 14:36:44 +0530 Subject: [PATCH 01/16] Update README.md --- README.md | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index e3dcbab2..66623b20 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # zwallet - a CLI for Züs wallet -`zwallet` is a command line interface (CLI) to demonstrate the wallet functionalities of Züs. +`zwallet` is a command line interface (CLI) to demonstrate the wallet functionalities of Züs. A user can perform many functions like creating and restoring wallets, getting and sending ZCN tokens among other features. The CLI utilizes the [Züs GoSDK](https://github.com/0chain/gosdk). - [Züs Overview](#züs-overview) @@ -48,7 +48,7 @@ The CLI utilizes the [Züs GoSDK](https://github.com/0chain/gosdk). For instance, the user can start with 10 data and 5 parity providers and select where they are located globally, and later decide to add a provider on-the-fly to increase resilience, performance, or switch to a lower cost provider. -Users can also add their own servers to the network to operate in a hybrid cloud architecture. Such flexibility allows the user to improve their regulatory, content distribution, and security requirements with a true multi-cloud architecture. Users can also construct a private cloud with all of their own servers rented across the globe to have a better content distribution, highly available network, higher performance, and lower cost. +Users can also add their own servers to the network to operate in a hybrid cloud architecture. Such flexibility allows the user to improve their regulatory obligations, content distribution, and security requirements with a true multi-cloud architecture. Users can also construct a private cloud with all of their own servers rented across the globe to have a better content distribution, highly available network, higher performance, and lower cost. [The QoS protocol](https://medium.com/0chain/qos-protocol-weekly-debrief-april-12-2023-44524924381f) is time-based where the blockchain challenges a provider on a file that the provider must respond within a certain time based on its size to pass. This forces the provider to have a good server and data center performance to earn rewards and income. @@ -60,7 +60,7 @@ Other apps are [Bolt](https://bolt.holdings/), a wallet that is very secure with ## 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. +Users can configure `zwallet` 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. @@ -71,7 +71,7 @@ For most transactions, `zwallet` uses the `0dns` to discover the network nodes, ### 1. Installation **Prerequisites** - +Install Go , open-source programming language from the links below based on your operating system. - Go: Installation instructions for Mac, Linux and Windows can be found [here](https://go.dev/doc/install). **Procedures** @@ -109,20 +109,19 @@ For detailed steps on the installation, follow the guides below: - [How to build on Windows](https://github.com/0chain/zwalletcli/wiki/Build-Windows) ### 2. Run `zwallet` commands - -The following steps assume that your terminal's working directory is inside the `zwalletcli` repo. - +Ensure your terminal's working directory is inside the `zwalletcli` repo for the following steps. +... MINGW64 ~/zwalletcli ## 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](https://github.com/0chain/zwalletcli/blob/staging/network/config.yaml) and [description](https://github.com/0chain/zwalletcli#zcnconfigyaml) | `config.yaml` | -| `--configDir` | Config directory | `~/.zcn` | -| `--network` | [Network file](#override-network) | `network.yaml` | -| `--silent` | Do not print detailed logs | `false` | +| `--h,--help` | Shows help/parameters for a particular command (./zwallet -h) will list all help commands. To know detail about a particular command like example 'send' use (./zwallet send --help ) | | +| `--config` | [Config file](https://github.com/0chain/zwalletcli/blob/staging/network/config.yaml) and [description](https://github.com/0chain/zwalletcli#zcnconfigyaml). Configuration file | `config.yaml` | +| `--configDir` | Configuration directory | `~/.zcn` | +| `--network` | Network file to overwrite the network details [Network file](#override-network) | `network.yaml` | +| `--silent` | Do not print sdk logs in stderr (error messages where it prints logs by default) | `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) | @@ -133,7 +132,7 @@ The following steps assume that your terminal's working directory is inside the #### Creating wallet - (any command) -Simply run `create-wallet` command and it will create a wallet if none exist yet. +Run `create-wallet` command and it will create a wallet if none exist yet. ![create wallet](docs/createwallet.png "Create wallet") @@ -154,12 +153,13 @@ wallet saved in /home/ubuntu/.zcn/wallet.json "version":"1.0","date_created":"2023-05-03T12:44:46+05:30","nonce":0} ``` -Here is a sample with `faucet` command and this creates a wallet at default location`~/.zcn/wallet.json` +#### Creating wallet with 'faucet' command +Here is a sample `faucet` command and this creates a wallet at default location`~/.zcn/wallet.json` ```sh ./zwallet faucet --methodName pour --input "new wallet" ``` - +#### Creating a second wallet with 'faucet' command Another `faucet` command to create a second wallet at `~/.zcn/new_wallet.json` ```sh @@ -222,6 +222,7 @@ The list of miners are retrieved using the Miner smart contract. ![List miner nodes](docs/ls-miners.png "List miner nodes") +View the list of miners with the following command. ```sh ./zwallet ls-miners ``` @@ -251,6 +252,7 @@ The list of sharders are retrieved using the latest finalized magic block. All r ![List sharder nodes](docs/ls-sharders.png "List sharder nodes") +List all sharders with below command. ```sh ./zwallet ls-sharders --all ``` @@ -294,6 +296,7 @@ The list of blobbers are retrieved using the Storage smart contract. ![List blobber nodes](docs/getblobbers.png "List blobber nodes") +List all blobbers with below command. ```sh ./zwallet getblobbers ``` @@ -312,7 +315,7 @@ Blobbers: `./zwallet bridge-list-auth ` command can be used to list all authorizers available to validate client transactions. -**Sample Command:** +**Sample Command to list authorizers:** ``` ./zwallet bridge-list-auth @@ -345,7 +348,7 @@ Blobbers: | --id | Yes | Provide Authorizer ID to view its configuration . | | --help | | Syntax Help for the command | -Sample Command: +Sample command to list details of an Authorizer's configuration.: ``` ./zwallet bridge-auth-config --id $AUTHORIZER_ID @@ -378,7 +381,7 @@ Print the ID of a blockchain node. ![Get node ID](docs/getid.png "Get node ID") - +Command to get the ID of a blockchain node. ```sh ./zwallet getid --url http://demo1.zus.network:31101 ``` @@ -394,9 +397,9 @@ ID: 675502b613ba1c5985636e3e92b9a857855a52155e3316bb40fe9607e14167fb `./zwallet sc-config ` command displays current storage smart contract configuration -Sample Command: +Sample command to display storage smart contract configuration: ``` -./zbox sc-config +./zwallet sc-config ``` Sample Response : ``` From 7951b0a54c8a891465edd63c936783b22776e40e Mon Sep 17 00:00:00 2001 From: digismash <149180324+digismash@users.noreply.github.com> Date: Wed, 1 Nov 2023 22:19:36 +0530 Subject: [PATCH 02/16] Update README.md From ee6b67e3565d9e7fac27f0de3dab7d43fa55a243 Mon Sep 17 00:00:00 2001 From: digismash <149180324+digismash@users.noreply.github.com> Date: Thu, 2 Nov 2023 20:12:32 +0530 Subject: [PATCH 03/16] Update README.md --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 66623b20..c13095c5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # zwallet - a CLI for Züs wallet -`zwallet` is a command line interface (CLI) to demonstrate the wallet functionalities of Züs. A user can perform many functions like creating and restoring wallets, getting and sending ZCN tokens among other features. +`zwallet` is a command line interface (CLI) to demonstrate the wallet functionalities of Züs. A user can perform many functions like creating and restoring wallets and getting and sending ZCN tokens, among other features. The CLI utilizes the [Züs GoSDK](https://github.com/0chain/gosdk). - [Züs Overview](#züs-overview) @@ -46,9 +46,9 @@ The CLI utilizes the [Züs GoSDK](https://github.com/0chain/gosdk). [Züs](https://zus.network/) is a high-performance cloud on a fast blockchain offering privacy and configurable uptime. It is an alternative to traditional cloud S3 and has shown better performance on a test network due to its parallel data architecture. The technology uses erasure code to distribute the data between data and parity servers. Züs storage is configurable to provide flexibility for IT managers to design for desired security and uptime, and can design a hybrid or a multi-cloud architecture with a few clicks using [Blimp's](https://blimp.software/) workflow, and can change redundancy and providers on the fly. -For instance, the user can start with 10 data and 5 parity providers and select where they are located globally, and later decide to add a provider on-the-fly to increase resilience, performance, or switch to a lower cost provider. +For instance, the user can start with 10 data and 5 parity providers and, select where they are located globally, and later decide to add a provider on-the-fly to increase resilience, and performance or switch to a lower-cost provider. -Users can also add their own servers to the network to operate in a hybrid cloud architecture. Such flexibility allows the user to improve their regulatory obligations, content distribution, and security requirements with a true multi-cloud architecture. Users can also construct a private cloud with all of their own servers rented across the globe to have a better content distribution, highly available network, higher performance, and lower cost. +Users can also add their own servers to the network to operate in a hybrid cloud architecture. Such flexibility allows users to improve their regulatory obligations, content distribution, and security requirements with an authentic multi-cloud architecture. Users can also construct a private cloud with all their own servers rented across the globe to have better content distribution, a highly available network, higher performance, and lower cost. [The QoS protocol](https://medium.com/0chain/qos-protocol-weekly-debrief-april-12-2023-44524924381f) is time-based where the blockchain challenges a provider on a file that the provider must respond within a certain time based on its size to pass. This forces the provider to have a good server and data center performance to earn rewards and income. @@ -635,7 +635,7 @@ To check the balance of another wallet, use `--wallet` global parameter. ![Send tokens to another wallet](docs/send.png "Send tokens to another wallet") -Transferring tokens from a wallet to another is done through `send` +Transferring tokens from one wallet to another is done through `send` | Parameter | Required | Description | Default | Valid Values | | ---------------- | -------- | ------------------------------ | ------- | ------------ | @@ -670,7 +670,7 @@ To use a different wallet as sender, use `--wallet` global parameter. | --------- | -------- | ----------------------------- | ------- | ---------------------- | | `--hash` | Yes | Hash of transaction to verify | | valid transaction hash | -Note: Not all `zwallet` commands (eg. `send`) prints the transaction hash created. To see more details printed including the hashes, use `--verbose` global parameter. +Note: Not all `zwallet` commands (e.g. `send`) prints the transaction hash created. To see more details printed, including the hashes, use `--verbose` global parameter. ![Verify transaction confirmation](docs/verify.png "Verify transaction confirmation") @@ -693,8 +693,8 @@ To see more details about the transaction on `verify`, use `--verbose` global pa ``` #### Collect rewards -Use `collect-reward` to transfer reward tokens from a stake pool.The stake pool keeps an account for all stakeholders to maintain accrued rewards. -You earn rewards for: Sharders and Miners +Use `collect-reward` to transfer reward tokens from a stake pool. The stake pool keeps an account for all stakeholders to maintain accrued rewards. +You earn rewards for: Sharders and Miners. - `Miners` produce blocks. - `Sharders` stores the blockchain and other related data, such as the event database. They also support a query REST API. @@ -710,14 +710,14 @@ Sample Command : ./zbox collect-reward --provider_type miner --provider_id $MINER/SHARDER_ID ``` ### Staking on miners and sharders - +(The below link is not working, - need the correct link ) [Miner smart contract](https://github.com/0chain/0chain/blob/master/code/go/0chain.net/smartcontract/minersc/READEME.md) allows staking on the miner and sharder nodes. The maximum number of stake pools per node is limited to the number of delegates allowed. To find out the number of delegates and the minimum and maximum tokens allowed, query the staking config. #### Getting the staking config - `mn-config` -`mn-config` display the global info of Miner SC for staking. +`mn-config` displays the global info of Miner SC for staking. ![Miner SC global info](docs/mn-config.png "Miner SC global info") @@ -827,9 +827,9 @@ Reformatted output #### Locking a stake on a node - `mn-lock` -Staking tokens on a node gains additional tokens over time. Tokens locked for staking can be unlocked anytime although have to wait for the next view change cycle. +Staking tokens on a node gains additional tokens over time. Tokens locked for staking can be unlocked anytime, although you have to wait for the next view change cycle. -Note however that if a node becomes offline, all stake pools are automatically unlocked and tokens are returned to wallets. +Note, however, that if a node becomes offline, all stake pools are automatically unlocked, and tokens are returned to wallets. | Parameter | Required | Description | Default | Valid Values | | ---------- | -------- | ------------------------------------------------------------ | ------- | ------------ | From 036e605d21711f6c6ab0605e96304cfeb9fe2a0e Mon Sep 17 00:00:00 2001 From: digismash <149180324+digismash@users.noreply.github.com> Date: Fri, 3 Nov 2023 21:21:20 +0530 Subject: [PATCH 04/16] zwalletcli cleanup README.md --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index c13095c5..1b0dacef 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,7 @@ wallet saved in /home/ubuntu/.zcn/wallet.json ``` #### Creating wallet with 'faucet' command -Here is a sample `faucet` command and this creates a wallet at default location`~/.zcn/wallet.json` +Here is a sample `faucet` command, and this creates a wallet at default location`~/.zcn/wallet.json` ```sh ./zwallet faucet --methodName pour --input "new wallet" @@ -593,13 +593,13 @@ The following command will give 1 token to the default wallet. ./zwallet faucet --methodName pour --input "need token" ``` -The following command will return 0.5 token to faucet. +You can specify the number of tokens required using the following command for adding 5 tokens with --tokens 5 ```sh -./zwallet faucet --methodName refill --input "not using" --tokens 0.5 +./zwallet faucet --methodName pour --input "need token" --tokens 5 ``` -Sample output from `faucet` prints the transaction +Sample output from `faucet` prints the transaction. ``` Execute faucet smart contract success with txn : d25acd4a339f38a9ce4d1fa91b287302fab713ef4385522e16d18fd147b2ebaf @@ -710,10 +710,10 @@ Sample Command : ./zbox collect-reward --provider_type miner --provider_id $MINER/SHARDER_ID ``` ### Staking on miners and sharders -(The below link is not working, - need the correct link ) -[Miner smart contract](https://github.com/0chain/0chain/blob/master/code/go/0chain.net/smartcontract/minersc/READEME.md) allows staking on the miner and sharder nodes. -The maximum number of stake pools per node is limited to the number of delegates allowed. To find out the number of delegates and the minimum and maximum tokens allowed, query the staking config. +[Miner smart contract](https://github.com/0chain/0chain/blob/master/code/go/0chain.net/smartcontract/minersc/README.md) allows staking on the miner and sharder nodes. + +The maximum number of stake pools per node is limited to the number of delegates allowed. To determine the number of delegates and the minimum and maximum tokens allowed, query the staking config. #### Getting the staking config - `mn-config` @@ -751,7 +751,7 @@ minted: 928552.464 max_delegates: 200 ``` -#### Getting a miner or sharder info for staking - `mn-info` +#### Getting a miner or sharder information for staking - `mn-info` Node stats for staking are retrieved from Miner SC. @@ -770,7 +770,7 @@ Sample command Sample output ```json -{"simple_miner":{"id":"68ed8f16e1d50e3217425b3e98fb7a39e5d7201fe4b1dccfe8477b5c54761b24","n2n_host":"five.devnet-0chain.net","host":"five.devnet-0chain.net","port":31102,"path":"sharder02","public_key":"458170c28496333426f9866989f7b335564d13d00f50db503275e7ec50a008031764ba5df42c20c85d76e7fe7eda43f39afdb650b8ffa9ed340e6fc50c35ae22","short_name":"localhost.s02","build_tag":"50fb047353c4c3d268c0e0ebfd8e63f1d10c6813","total_stake":0,"delegate_wallet":"68ed8f16e1d50e3217425b3e98fb7a39e5d7201fe4b1dccfe8477b5c54761b24","service_charge":0.1,"number_of_delegates":10,"min_stake":0,"max_stake":1000000000000,"stat":{"sharder_rewards":1160553450000000},"node_type":"sharder","last_health_check":1619554377},"pending":{"01978379a586de2882638345e215baaf8382093609d910da5ac1a833e2814f6f":{"stats":{"delegate_id":"133807913c66ec0b4342612f23fecd1852b456152433b8380cd2abcd411d4c07","high":0,"low":-1,"interest_paid":0,"reward_paid":0,"number_rounds":0,"status":"PENDING"},"pool":{"pool":{"id":"01978379a586de2882638345e215baaf8382093609d910da5ac1a833e2814f6f","balance":10000000000},"lock":{"delete_view_change_set":false,"delete_after_view_change":0,"owner":"ff12c78ee4a985b4fc2ac52ec8a24e9df2bd912636da15437b0eb7707b99abf4"}}}}} +{"simple_miner":{"id":"68ed8f16e1d50e3217425b3e98fb7a39e5d7201fe4b1dccfe8477b5c54761b24","n2n_host":"demo.zus.network","host":"demo.zus.network","port":31102,"path":"sharder02","public_key":"458170c28496333426f9866989f7b335564d13d00f50db503275e7ec50a008031764ba5df42c20c85d76e7fe7eda43f39afdb650b8ffa9ed340e6fc50c35ae22","short_name":"localhost.s02","build_tag":"50fb047353c4c3d268c0e0ebfd8e63f1d10c6813","total_stake":0,"delegate_wallet":"68ed8f16e1d50e3217425b3e98fb7a39e5d7201fe4b1dccfe8477b5c54761b24","service_charge":0.1,"number_of_delegates":10,"min_stake":0,"max_stake":1000000000000,"stat":{"sharder_rewards":1160553450000000},"node_type":"sharder","last_health_check":1619554377},"pending":{"01978379a586de2882638345e215baaf8382093609d910da5ac1a833e2814f6f":{"stats":{"delegate_id":"133807913c66ec0b4342612f23fecd1852b456152433b8380cd2abcd411d4c07","high":0,"low":-1,"interest_paid":0,"reward_paid":0,"number_rounds":0,"status":"PENDING"},"pool":{"pool":{"id":"01978379a586de2882638345e215baaf8382093609d910da5ac1a833e2814f6f","balance":10000000000},"lock":{"delete_view_change_set":false,"delete_after_view_change":0,"owner":"ff12c78ee4a985b4fc2ac52ec8a24e9df2bd912636da15437b0eb7707b99abf4"}}}}} ``` Reformatted output @@ -841,7 +841,7 @@ Note, however, that if a node becomes offline, all stake pools are automatically Sample command ```sh -./zwallet mn-lock --id dc8c6c93fb42e7f6d1c0f93baf66cc77e52725f79c3428a37da28e294aa2319a --tokens 1 +./zwallet mn-lock --miner_id dc8c6c93fb42e7f6d1c0f93baf66cc77e52725f79c3428a37da28e294aa2319a --tokens 1 ``` The output would print the stake pool id. @@ -854,7 +854,7 @@ If the locking of stakes is failing, verify the following. 1. Wallet has enough tokens 2. Node ID is valid -3. Node has available delegate +3. Node has an available delegate ### Getting the stake pools of a wallet - `mn-user-info` From 7ebbb7762cc0e45a17e6398c4d20b2e4d28d6f0e Mon Sep 17 00:00:00 2001 From: digismash <149180324+digismash@users.noreply.github.com> Date: Sat, 4 Nov 2023 18:03:46 +0530 Subject: [PATCH 05/16] zwalletcli cleanup README.md --- README.md | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 1b0dacef..acf4eb5e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # zwallet - a CLI for Züs wallet -`zwallet` is a command line interface (CLI) to demonstrate the wallet functionalities of Züs. A user can perform many functions like creating and restoring wallets and getting and sending ZCN tokens, among other features. +ZWallet CLI is a Go-based command-line tool for managing ZCN tokens on the Züs blockchain. It provides an interactive way to receive, send, store, stake, and exchange ZCN tokens, as well as fetch information about Züs components such as miners, sharders, and blobbers. The CLI utilizes the [Züs GoSDK](https://github.com/0chain/gosdk). - [Züs Overview](#züs-overview) @@ -44,9 +44,9 @@ The CLI utilizes the [Züs GoSDK](https://github.com/0chain/gosdk). ## Züs Overview -[Züs](https://zus.network/) is a high-performance cloud on a fast blockchain offering privacy and configurable uptime. It is an alternative to traditional cloud S3 and has shown better performance on a test network due to its parallel data architecture. The technology uses erasure code to distribute the data between data and parity servers. Züs storage is configurable to provide flexibility for IT managers to design for desired security and uptime, and can design a hybrid or a multi-cloud architecture with a few clicks using [Blimp's](https://blimp.software/) workflow, and can change redundancy and providers on the fly. +[Züs](https://zus.network/) is a high-performance cloud on a fast blockchain offering privacy and configurable uptime. It is an alternative to traditional cloud S3 and has shown better performance on a test network due to its parallel data architecture. The technology uses erasure code to distribute the data between data and parity servers. Züs storage is configurable to provide flexibility for IT managers to design for desired security and uptime, can design a hybrid or a multi-cloud architecture with a few clicks using [Blimp's](https://blimp.software/) workflow, and can change redundancy and providers on the fly. -For instance, the user can start with 10 data and 5 parity providers and, select where they are located globally, and later decide to add a provider on-the-fly to increase resilience, and performance or switch to a lower-cost provider. +For instance, the user can start with 10 data and 5 parity providers and select where they are located globally, and later decide to add a provider on-the-fly to increase resilience, and performance or switch to a lower-cost provider. Users can also add their own servers to the network to operate in a hybrid cloud architecture. Such flexibility allows users to improve their regulatory obligations, content distribution, and security requirements with an authentic multi-cloud architecture. Users can also construct a private cloud with all their own servers rented across the globe to have better content distribution, a highly available network, higher performance, and lower cost. @@ -54,7 +54,7 @@ Users can also add their own servers to the network to operate in a hybrid cloud The [privacy protocol](https://zus.network/build) from Züs is unique where a user can easily share their encrypted data with their business partners, friends, and family through a proxy key sharing protocol, where the key is given to the providers, and they re-encrypt the data using the proxy key so that only the recipient can decrypt it with their private key. -Züs has ecosystem apps to encourage traditional storage consumption such as [Blimp](https://blimp.software/), a S3 server and cloud migration platform, and [Vult](https://vult.network/), a personal cloud app to store encrypted data and share privately with friends and family, and [Chalk](https://chalk.software/), a high-performance story-telling storage solution for NFT artists. +Züs has ecosystem apps to encourage traditional storage consumption, such as [Blimp](https://blimp.software/), a S3 server and cloud migration platform, and [Vult](https://vult.network/), a personal cloud app to store encrypted data and share privately with friends and family, and [Chalk](https://chalk.software/), a high-performance story-telling storage solution for NFT artists. Other apps are [Bolt](https://bolt.holdings/), a wallet that is very secure with air-gapped 2FA split-key protocol to prevent hacks from compromising your digital assets, and it enables you to stake and earn from the storage providers; [Atlus](https://atlus.cloud/), a blockchain explorer and [Chimney](https://demo.chimney.software/), which allows anyone to join the network and earn using their server or by just renting one, with no prior knowledge required. @@ -71,8 +71,8 @@ For most transactions, `zwallet` uses the `0dns` to discover the network nodes, ### 1. Installation **Prerequisites** -Install Go , open-source programming language from the links below based on your operating system. -- Go: Installation instructions for Mac, Linux and Windows can be found [here](https://go.dev/doc/install). +Install Go , an open-source programming language, from the links below based on your operating system. +- Go: Installation instructions for Mac, Linux, and Windows can be found [here](https://go.dev/doc/install). **Procedures** @@ -174,7 +174,7 @@ Creating related read pool for storage smart-contract... Read pool created successfully ``` -Verify second wallet +Verify the second wallet ```sh cat ~/.zcn/new_wallet.json @@ -252,7 +252,7 @@ The list of sharders are retrieved using the latest finalized magic block. All r ![List sharder nodes](docs/ls-sharders.png "List sharder nodes") -List all sharders with below command. +List all sharders with the below command. ```sh ./zwallet ls-sharders --all ``` @@ -296,7 +296,7 @@ The list of blobbers are retrieved using the Storage smart contract. ![List blobber nodes](docs/getblobbers.png "List blobber nodes") -List all blobbers with below command. +List all blobbers with the below command. ```sh ./zwallet getblobbers ``` @@ -341,11 +341,11 @@ Blobbers: ``` #### Get Authorizer Configuration -`./zwallet bridge-auth-config `command can be used to view authorizer configuration. Here are the parameters for the command. +`./zwallet bridge-auth-config `command can be used to view the authorizer configuration. Here are the parameters for the command. | Parameter | Required | Description | | --------- | -------- | ------------------------------------------------- | -| --id | Yes | Provide Authorizer ID to view its configuration . | +| --id | Yes | Provide Authorizer ID to view its configuration. | | --help | | Syntax Help for the command | Sample command to list details of an Authorizer's configuration.: @@ -395,7 +395,7 @@ ID: 675502b613ba1c5985636e3e92b9a857855a52155e3316bb40fe9607e14167fb #### Show Storage Smart Contract Configuration -`./zwallet sc-config ` command displays current storage smart contract configuration +`./zwallet sc-config ` command displays the current storage smart contract configuration. Sample command to display storage smart contract configuration: ``` @@ -493,7 +493,7 @@ Version info: gosdk.....: v1.8.17-0.20230522160233-570f983a6283 ``` #### Show global configurations -`./zwallet global-config ` command displays global chain configuration +`./zwallet global-config ` command displays the global chain configuration Sample Command : ``` @@ -650,10 +650,11 @@ The following sends 0.2 token from the default wallet to the specified client ID ./zwallet send --to_client_id e7ebb698213b6bda097c0a14ccbe574356e99e9b666e4baeae540da1d9b51e7e --tokens .2 --desc "gift" ``` -Output +Output sample ``` -Send tokens success +Send tokens success: 820af3d7b66bceae1a7a6d2eaed58a279a65feebf0afbec59bb89f61e81e2c11 + ``` To use a different wallet as sender, use `--wallet` global parameter. @@ -670,7 +671,7 @@ To use a different wallet as sender, use `--wallet` global parameter. | --------- | -------- | ----------------------------- | ------- | ---------------------- | | `--hash` | Yes | Hash of transaction to verify | | valid transaction hash | -Note: Not all `zwallet` commands (e.g. `send`) prints the transaction hash created. To see more details printed, including the hashes, use `--verbose` global parameter. +Note: Not all `zwallet` commands (e.g., `send`) prints the transaction hash created. To see more details printed, including the hashes, use `--verbose` global parameter. ![Verify transaction confirmation](docs/verify.png "Verify transaction confirmation") @@ -693,8 +694,8 @@ To see more details about the transaction on `verify`, use `--verbose` global pa ``` #### Collect rewards -Use `collect-reward` to transfer reward tokens from a stake pool. The stake pool keeps an account for all stakeholders to maintain accrued rewards. -You earn rewards for: Sharders and Miners. +Use `collect-reward` to transfer reward tokens from a stake pool. The stake pool keeps an account of all stakeholders to maintain accrued rewards. +You earn rewards for Sharders and Miners. - `Miners` produce blocks. - `Sharders` stores the blockchain and other related data, such as the event database. They also support a query REST API. @@ -707,7 +708,7 @@ You earn rewards for: Sharders and Miners. Sample Command : ``` -./zbox collect-reward --provider_type miner --provider_id $MINER/SHARDER_ID +./zwallet collect-reward --provider_type miner --provider_id $MINER/SHARDER_ID ``` ### Staking on miners and sharders @@ -977,13 +978,14 @@ Reformatted output ![Unlock a stake](docs/mn-unlock.png "Unlock a stake") ```sh -./zwallet mn-unlock --id dc8c6c93fb42e7f6d1c0f93baf66cc77e52725f79c3428a37da28e294aa2319a +./zwallet mn-unlock --miner_id dc8c6c93fb42e7f6d1c0f93baf66cc77e52725f79c3428a37da28e294aa2319a ``` Output ``` -tokens will be unlocked next VC +... transaction_base.go:673: https://dev3.zus.network/sharder01/v1/block/get?round=19683&content=header200 OK +tokens unlocked. ``` Tokens are released on the next view change cycle or at the next reward round. From 468ae75dcd26a504114ada7b98b9efd9adb425dd Mon Sep 17 00:00:00 2001 From: digismash <149180324+digismash@users.noreply.github.com> Date: Wed, 8 Nov 2023 19:52:20 +0530 Subject: [PATCH 06/16] zwalletcli review comments and cleanup Update README.md --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index acf4eb5e..f970045f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# zwallet - a CLI for Züs wallet +# zwallet - a CLI for Züs wallet -ZWallet CLI is a Go-based command-line tool for managing ZCN tokens on the Züs blockchain. It provides an interactive way to receive, send, store, stake, and exchange ZCN tokens, as well as fetch information about Züs components such as miners, sharders, and blobbers. +ZWallet CLI is a command-line command line interface (CLI) to demonstrate the wallet functionalities of Züs. It provides an interactive way to receive, send, store, stake, and exchange ZCN tokens, as well as fetch information about Züs components such as miners, sharders, and blobbers. The CLI utilizes the [Züs GoSDK](https://github.com/0chain/gosdk). - [Züs Overview](#züs-overview) @@ -117,11 +117,11 @@ Ensure your terminal's working directory is inside the `zwalletcli` repo for the | Parameter | Description | Default | | ------------- | ------------------------------- | -------------- | -| `--h,--help` | Shows help/parameters for a particular command (./zwallet -h) will list all help commands. To know detail about a particular command like example 'send' use (./zwallet send --help ) | | +| `--h, --help` | Shows help/parameters for a particular command (./zwallet -h) will list all help commands. To know detail about a particular command like example 'send' use (./zwallet send --help ) | | | `--config` | [Config file](https://github.com/0chain/zwalletcli/blob/staging/network/config.yaml) and [description](https://github.com/0chain/zwalletcli#zcnconfigyaml). Configuration file | `config.yaml` | | `--configDir` | Configuration directory | `~/.zcn` | | `--network` | Network file to overwrite the network details [Network file](#override-network) | `network.yaml` | -| `--silent` | Do not print sdk logs in stderr (error messages where it prints logs by default) | `false` | +| `--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) | @@ -159,8 +159,8 @@ Here is a sample `faucet` command, and this creates a wallet at default location ```sh ./zwallet faucet --methodName pour --input "new wallet" ``` -#### Creating a second wallet with 'faucet' command -Another `faucet` command to create a second wallet at `~/.zcn/new_wallet.json` +#### Creating additional wallet with 'faucet' command +You can create more wallets with the faucet command with a wallet name of your choice. Another `faucet` command to create a second wallet at `~/.zcn/new_wallet.json` ```sh ./zwallet faucet --methodName pour --input "new wallet" --wallet new_wallet.json @@ -168,7 +168,7 @@ Another `faucet` command to create a second wallet at `~/.zcn/new_wallet.json` Sample Output ``` -No wallet in path /.zcn/new_wallet.json found. Creating wallet... +Creating wallet... ZCN wallet created!! Creating related read pool for storage smart-contract... Read pool created successfully @@ -671,7 +671,7 @@ To use a different wallet as sender, use `--wallet` global parameter. | --------- | -------- | ----------------------------- | ------- | ---------------------- | | `--hash` | Yes | Hash of transaction to verify | | valid transaction hash | -Note: Not all `zwallet` commands (e.g., `send`) prints the transaction hash created. To see more details printed, including the hashes, use `--verbose` global parameter. +Note: Not all `zwallet` commands (e.g, `send`) prints the transaction hash created. To see more details printed, including the hashes, use `--verbose` global parameter. ![Verify transaction confirmation](docs/verify.png "Verify transaction confirmation") From 39a6b0b91cba395ece8621be802c06413576760a Mon Sep 17 00:00:00 2001 From: digismash <149180324+digismash@users.noreply.github.com> Date: Thu, 9 Nov 2023 21:52:32 +0530 Subject: [PATCH 07/16] zwalletcli cleanup - Update README.md example outputs of each option of each command for most cases for better understanding. --- README.md | 63 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index f970045f..6466cdf5 100644 --- a/README.md +++ b/README.md @@ -71,8 +71,8 @@ For most transactions, `zwallet` uses the `0dns` to discover the network nodes, ### 1. Installation **Prerequisites** -Install Go , an open-source programming language, from the links below based on your operating system. -- Go: Installation instructions for Mac, Linux, and Windows can be found [here](https://go.dev/doc/install). +Install Go, an open-source programming language based on your operating system from the links below. +- Go: Mac, Linux, and Windows installation instructions can be found [here](https://go.dev/doc/install). **Procedures** @@ -113,11 +113,11 @@ Ensure your terminal's working directory is inside the `zwalletcli` repo for the ... MINGW64 ~/zwalletcli ## Global parameters -`zwallet` accept global parameters to override default configuration and can be used in any command. +`zwallet` accepts global parameters to override default configuration and can be used in any command. | Parameter | Description | Default | | ------------- | ------------------------------- | -------------- | -| `--h, --help` | Shows help/parameters for a particular command (./zwallet -h) will list all help commands. To know detail about a particular command like example 'send' use (./zwallet send --help ) | | +| `--h, --help` | Shows help/parameters for a particular command (./zwallet -h) will list all help commands. To know detail about a particular command like example 'send', use (./zwallet send --help ) | | | `--config` | [Config file](https://github.com/0chain/zwalletcli/blob/staging/network/config.yaml) and [description](https://github.com/0chain/zwalletcli#zcnconfigyaml). Configuration file | `config.yaml` | | `--configDir` | Configuration directory | `~/.zcn` | | `--network` | Network file to overwrite the network details [Network file](#override-network) | `network.yaml` | @@ -131,12 +131,16 @@ Ensure your terminal's working directory is inside the `zwalletcli` repo for the ### Creating and restoring wallets #### Creating wallet - (any command) +You can create a wallet in two ways. +1) Use the `create-wallet` or +2) Use the 'faucet' command +##### Creating a wallet if none exists -Run `create-wallet` command and it will create a wallet if none exist yet. +Run the `create-wallet` command to create a wallet if none exists. ![create wallet](docs/createwallet.png "Create wallet") -Here is a sample with `create-wallet` command and this creates a wallet at default location`~/.zcn/wallet.json` +Here is a sample with `create-wallet` command and this creates a wallet at the default location`~/.zcn/wallet.json` ```sh ./zwallet create-wallet @@ -144,7 +148,7 @@ Here is a sample with `create-wallet` command and this creates a wallet at defau Sample Output ``` -wallet saved in /home/ubuntu/.zcn/wallet.json +wallet saved in /home/.../.zcn/wallet.json {"client_id":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "client_key":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "keys":[{"public_key":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", @@ -152,6 +156,10 @@ wallet saved in /home/ubuntu/.zcn/wallet.json "mnemonics":"xxxx xxxx xxxx xxxxx", "version":"1.0","date_created":"2023-05-03T12:44:46+05:30","nonce":0} +``` +If there is an existing wallet in the .zcn directory, and you run `./zwallet create-wallet`, you will get a message - +``` +..wallet already exists at \..\.zcn\wallet.json ``` #### Creating wallet with 'faucet' command Here is a sample `faucet` command, and this creates a wallet at default location`~/.zcn/wallet.json` @@ -159,26 +167,24 @@ Here is a sample `faucet` command, and this creates a wallet at default location ```sh ./zwallet faucet --methodName pour --input "new wallet" ``` +Verify wallet creation +You can verify the wallet creation by checking your .zcn folder for the corresponding wallet name. + #### Creating additional wallet with 'faucet' command -You can create more wallets with the faucet command with a wallet name of your choice. Another `faucet` command to create a second wallet at `~/.zcn/new_wallet.json` +You can create more wallets with the faucet command with a wallet name of your choice. The `faucet` command to create a second wallet at the location `~/.zcn/` is as follows. ```sh -./zwallet faucet --methodName pour --input "new wallet" --wallet new_wallet.json +./zwallet faucet --methodName pour --input "new wallet" --wallet my_fifth_wallet.json ``` -Sample Output -``` -Creating wallet... -ZCN wallet created!! -Creating related read pool for storage smart-contract... -Read pool created successfully +Sample Output (Windows) ``` - -Verify the second wallet - -```sh -cat ~/.zcn/new_wallet.json +******* Wallet SDK Version:v1.8.17-78-g80b63345 ******* (InitZCNSDK) +No wallet in path C:\Users\..\.zcn\my_fifth_wallet.json found. Creating wallet... +ZCN wallet created!!.. Execute faucet smart contract success with txn: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ``` +Verify wallet creation +You can verify the recovered wallet by checking your .zcn folder for the corresponding wallet name. #### Recovering wallet - `recoverwallet` @@ -204,12 +210,9 @@ Sample output ``` Wallet recovered!! ``` - Verify recovered wallet +You can verify the recovered wallet by checking your .zcn folder for the corresponding wallet name. -```sh -cat ~/.zcn/recovered_wallet.json -``` ### Exploring network nodes #### Listing all miners - `ls-miners` @@ -241,6 +244,18 @@ Sample output - Port: 31202 ``` +You can use various flags to customize your usage. + +| Command | flag |Description | Usage | Output | +| --------- | -------- |------------------------------- |--------- +| `ls-miners` | --active |Gets list of active miners only |`./zwallet ls-miners --active` | | +| `ls-miners` | --all |Includes all registered miners |`./zwallet ls-miners --all` | | +| `ls-miners` | --json |as JSON |`./zwallet ls-miners --active` | | +| `ls-miners` | --limit |Limits the amount of miners returned (default 20) |`./zwallet ls-miners --active` | | +| `ls-miners` | --offset |Skips the number of miners mentioned |`./zwallet ls-miners --active` | | + flag usage output + + #### Listing all sharders -`ls-sharders` The list of sharders are retrieved using the latest finalized magic block. All registered sharders can be retrieved with the `--all` parameter. From 7b2619383df617e7a029fcf16300e53553877709 Mon Sep 17 00:00:00 2001 From: digismash <149180324+digismash@users.noreply.github.com> Date: Fri, 10 Nov 2023 22:22:38 +0530 Subject: [PATCH 08/16] Clean up of zwallet commands and responses Update README.md --- README.md | 78 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 52 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 6466cdf5..91a9dce3 100644 --- a/README.md +++ b/README.md @@ -115,16 +115,16 @@ Ensure your terminal's working directory is inside the `zwalletcli` repo for the `zwallet` accepts global parameters to override default configuration and can be used in any command. -| Parameter | Description | Default | -| ------------- | ------------------------------- | -------------- | -| `--h, --help` | Shows help/parameters for a particular command (./zwallet -h) will list all help commands. To know detail about a particular command like example 'send', use (./zwallet send --help ) | | -| `--config` | [Config file](https://github.com/0chain/zwalletcli/blob/staging/network/config.yaml) and [description](https://github.com/0chain/zwalletcli#zcnconfigyaml). Configuration file | `config.yaml` | -| `--configDir` | Configuration directory | `~/.zcn` | -| `--network` | Network file to overwrite the network details [Network file](#override-network) | `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) | +| Parameter | Description | Default | +| -------------------------- | ------------------------------- | -------------- | +| `--h, --help` | Shows help/parameters for a particular command | | +| `--config` | [Config file](https://github.com/0chain/zwalletcli/blob/staging/network/config.yaml) and [description](https://github.com/0chain/zwalletcli#zcnconfigyaml). Configuration file | `config.yaml` | +| `--configDir` | Configuration directory | `~/.zcn` | +| `--network` | Network file to overwrite the network details [Network file](#override-network) | `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 @@ -157,17 +157,27 @@ wallet saved in /home/.../.zcn/wallet.json "version":"1.0","date_created":"2023-05-03T12:44:46+05:30","nonce":0} ``` + If there is an existing wallet in the .zcn directory, and you run `./zwallet create-wallet`, you will get a message - ``` ..wallet already exists at \..\.zcn\wallet.json ``` +Below is a list of flags that can be specified with the `create-wallet` command. +| Flags | Description | Usage | +| ------------ | ---------------------------------------------------| -----------------------------------| +| --help | help for create-wallet | `./zwallet create-wallet --help` | +| `--silent` | do not print wallet details in the standard output | `./zwallet create-wallet --silent` | +| `--wallet` | give custom name to the wallet | `./zwallet create-wallet --wallet` | + + #### Creating wallet with 'faucet' command Here is a sample `faucet` command, and this creates a wallet at default location`~/.zcn/wallet.json` ```sh ./zwallet faucet --methodName pour --input "new wallet" ``` -Verify wallet creation +**Verify wallet creation** + You can verify the wallet creation by checking your .zcn folder for the corresponding wallet name. #### Creating additional wallet with 'faucet' command @@ -183,14 +193,15 @@ Sample Output (Windows) No wallet in path C:\Users\..\.zcn\my_fifth_wallet.json found. Creating wallet... ZCN wallet created!!.. Execute faucet smart contract success with txn: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ``` -Verify wallet creation +**Verify wallet creation** + You can verify the recovered wallet by checking your .zcn folder for the corresponding wallet name. #### 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. +Given a wallet's mnemonics, you can recover and recreate your wallet. The following flags work with `recoverwallet` | Parameter | Required | Description | Default | Valid Values | | ------------ | -------- | -------------------------------------- | ------- | ------------ | @@ -199,18 +210,20 @@ Given a wallet's mnemonics, you can recover and recreate your wallet. ![recover wallet](docs/recoverwallet.png "Recover wallet") -Sample command +Sample command using `--mnemonic` ```sh ./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 command using `--mnemonic` and `--offline` Sample output ``` Wallet recovered!! ``` -Verify recovered wallet +**Verify recovered wallet** + You can verify the recovered wallet by checking your .zcn folder for the corresponding wallet name. ### Exploring network nodes @@ -244,17 +257,15 @@ Sample output - Port: 31202 ``` -You can use various flags to customize your usage. - -| Command | flag |Description | Usage | Output | -| --------- | -------- |------------------------------- |--------- -| `ls-miners` | --active |Gets list of active miners only |`./zwallet ls-miners --active` | | -| `ls-miners` | --all |Includes all registered miners |`./zwallet ls-miners --all` | | -| `ls-miners` | --json |as JSON |`./zwallet ls-miners --active` | | -| `ls-miners` | --limit |Limits the amount of miners returned (default 20) |`./zwallet ls-miners --active` | | -| `ls-miners` | --offset |Skips the number of miners mentioned |`./zwallet ls-miners --active` | | - flag usage output +You can use various flags below to customize your usage with `ls-miners` for example - `./zwallet ls-miners --active`. +| Parameter | Description | Default | +| -------------------------- | ------------------------------- | -------------- | +| `--active` | Gets list of active miners only | | +| `--all` | Includes all registered miners | | +| `--json` | Print response as JSON data | | +| `--limit` | Limits the number of miners returned | (default 20) | +| `--offset` | Skips the number of miners mentioned | | #### Listing all sharders -`ls-sharders` @@ -304,7 +315,15 @@ ID: fd02f4436692bd9f679fae809f4f140fd4daaa35769ae9c6db1ab9664f766c22 - Port: 31102 ``` +You can use various flags below to customize your usage with `ls-sharders` for example - `./zwallet ls-sharders --active`. +| Parameter | Description | Default | +| -------------------------- | ------------------------------- | -------------- | +| `--active` | Gets list of active sharders only | | +| `--all` | Includes all registered sharders | | +| `--json` | Print response as JSON data | | +| `--limit` | Limits the number of sharders returned | (default 20) | +| `--offset` | Skips the number of sharders mentioned | | #### Listing all blobbers - `getblobbers` The list of blobbers are retrieved using the Storage smart contract. @@ -356,7 +375,7 @@ Blobbers: ``` #### Get Authorizer Configuration -`./zwallet bridge-auth-config `command can be used to view the authorizer configuration. Here are the parameters for the command. +`./zwallet bridge-auth-config` command can be used to view the authorizer configuration. Here are the parameters for the command. | Parameter | Required | Description | | --------- | -------- | ------------------------------------------------- | @@ -493,6 +512,13 @@ validator_reward 0.025 validators_per_challenge 2 writepool.min_lock 0.1 ``` +You can also use the `--json` flag with the `sc-config ` command + +| Parameter | Description | +| --------- | --------------------------------------- | +| `--json` | Print output as JSON | + + #### Get Version The version of zwallet and gosdk can be fetched using the `./zwallet version` command. From 7bfba32a79463289fa2460e68bf1204c1197f142 Mon Sep 17 00:00:00 2001 From: digismash <149180324+digismash@users.noreply.github.com> Date: Sat, 11 Nov 2023 17:00:12 +0530 Subject: [PATCH 09/16] zwallet cli clean up and details Update README.md --- README.md | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 91a9dce3..fd3b2bde 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,9 @@ The CLI utilizes the [Züs GoSDK](https://github.com/0chain/gosdk). - [Commands](#commands) - [Creating and restoring wallets](#creating-and-restoring-wallets) - [Creating wallet - (any command)](#creating-wallet---any-command) + - [Creating a wallet if none exists](#creating-a-wallet-if-none-exists) + - [Creating wallet with faucet command](#creating-wallet-with-faucet-command) + - [Creating additional wallet with faucet command](#creating-additional-wallet-with-faucet-command) - [Recovering wallet - `recoverwallet`](#recovering-wallet---recoverwallet) - [Exploring network nodes](#exploring-network-nodes) - [Listing all miners - `ls-miners`](#listing-all-miners---ls-miners) @@ -32,7 +35,7 @@ The CLI utilizes the [Züs GoSDK](https://github.com/0chain/gosdk). - [Collect rewards - `collect-reward`](#collect-rewards) - [Staking on miners and sharders](#staking-on-miners-and-sharders) - [Getting the staking config - `mn-config`](#getting-the-staking-config---mn-config) - - [Getting a miner or sharder info for staking - `mn-info`](#getting-a-miner-or-sharder-info-for-staking---mn-info) + - [Getting a miner or sharder info for staking-`mn-info`](#getting-a-miner-or-sharder-information-for-staking---mn-info) - [Locking a stake on a node - `mn-lock`](#locking-a-stake-on-a-node---mn-lock) - [Getting the stake pools of a wallet - `mn-user-info`](#getting-the-stake-pools-of-a-wallet---mn-user-info) - [Getting the stake pool info - `mn-pool-info`](#getting-the-stake-pool-info---mn-pool-info) @@ -41,7 +44,7 @@ The CLI utilizes the [Züs GoSDK](https://github.com/0chain/gosdk). - [Config](#config) - [~/.zcn/config.yaml](#zcnconfigyaml) - [(Optional) Override Network](#override-network) - + ## Züs Overview [Züs](https://zus.network/) is a high-performance cloud on a fast blockchain offering privacy and configurable uptime. It is an alternative to traditional cloud S3 and has shown better performance on a test network due to its parallel data architecture. The technology uses erasure code to distribute the data between data and parity servers. Züs storage is configurable to provide flexibility for IT managers to design for desired security and uptime, can design a hybrid or a multi-cloud architecture with a few clicks using [Blimp's](https://blimp.software/) workflow, and can change redundancy and providers on the fly. @@ -129,11 +132,11 @@ Ensure your terminal's working directory is inside the `zwalletcli` repo for the ## Commands ### Creating and restoring wallets - #### Creating wallet - (any command) You can create a wallet in two ways. 1) Use the `create-wallet` or 2) Use the 'faucet' command + ##### Creating a wallet if none exists Run the `create-wallet` command to create a wallet if none exists. @@ -232,9 +235,9 @@ You can verify the recovered wallet by checking your .zcn folder for the corresp The list of miners are retrieved using the Miner smart contract. -| Parameter | Required | Description | Default | Valid Values | -| --------- | -------- | -------------------- | ------- | ----------------- | -| `--json` | No | Print output as JSON | | | +| Parameter | Required | Description | Default | +| --------- | -------- | -------------------- | ------- | +| `--json` | No | Print output as JSON | | ![List miner nodes](docs/ls-miners.png "List miner nodes") @@ -271,10 +274,10 @@ You can use various flags below to customize your usage with `ls-miners` for exa The list of sharders are retrieved using the latest finalized magic block. All registered sharders can be retrieved with the `--all` parameter. -| Parameter | Required | Description | Default | Valid Values | -| --------- | -------- | --------------------------------------- | ------- | ----------------- | -| `--json` | No | Print output as JSON | | | -| `--all` | No | Print also registered nodes on Miner SC | | | +| Parameter | Required | Description | Default | +| --------- | -------- | --------------------------------------- | ------- | +| `--json` | No | Print output as JSON | | +| `--all` | No | Print also registered nodes on Miner SC | | ![List sharder nodes](docs/ls-sharders.png "List sharder nodes") @@ -324,6 +327,7 @@ You can use various flags below to customize your usage with `ls-sharders` for e | `--json` | Print response as JSON data | | | `--limit` | Limits the number of sharders returned | (default 20) | | `--offset` | Skips the number of sharders mentioned | | + #### Listing all blobbers - `getblobbers` The list of blobbers are retrieved using the Storage smart contract. @@ -533,6 +537,19 @@ Version info: zwallet...: v1.2.3-21-gb10c459 gosdk.....: v1.8.17-0.20230522160233-570f983a6283 ``` + +You can also use the `--json` flag with the `./zwallet version ` command + +| Parameter | Description | +| --------- | --------------------------------------- | +| `--json` | Print output as JSON | + +Sample Response : +``` +{"gosdk":"v1.8.18-0.20230901213317-53d640a9b7f9","zwallet":"v1.10.0-6-gd0f62a4"} +``` + + #### Show global configurations `./zwallet global-config ` command displays the global chain configuration @@ -621,7 +638,7 @@ server_chain.view_change false Tokens can be retrieved and added to your wallet through the Faucet smart contract. | Parameter | Required | Description | Default | Valid Values | -| -------------- | -------- | ------------------------------------------------------------ | ------- | ---------------- | +| -------------- | ----- | ------------------------------------------------------------ | ------- | ---------------- | | `--methodName` | Yes | Smart Contract method to call (`pour` - get tokens, `refill` - return tokens) | | `pour`, `refill` | | `--input` | Yes | Request description | | any string | | `--tokens` | No | Amount of tokens (maximum of 1.0) | 1.0 | (0 - 1.0] | @@ -643,7 +660,7 @@ You can specify the number of tokens required using the following command for ad Sample output from `faucet` prints the transaction. ``` -Execute faucet smart contract success with txn : d25acd4a339f38a9ce4d1fa91b287302fab713ef4385522e16d18fd147b2ebaf +Execute faucet smart contract success with txn: d25acd4a339f38a9ce4d1fa91b287302fab713ef4385522e16d18fd147b2ebaf ``` #### Checking balance - `getbalance` From eb3c37a5185fb87aab377dd53c923a41d108cf12 Mon Sep 17 00:00:00 2001 From: digismash <149180324+digismash@users.noreply.github.com> Date: Sat, 11 Nov 2023 17:11:55 +0530 Subject: [PATCH 10/16] zwallet cli cleanup with additional responses Update README.md --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fd3b2bde..4262c383 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ Ensure your terminal's working directory is inside the `zwalletcli` repo for the #### Creating wallet - (any command) You can create a wallet in two ways. 1) Use the `create-wallet` or -2) Use the 'faucet' command +2) Use the `faucet` command ##### Creating a wallet if none exists @@ -168,7 +168,7 @@ If there is an existing wallet in the .zcn directory, and you run `./zwallet cre Below is a list of flags that can be specified with the `create-wallet` command. | Flags | Description | Usage | | ------------ | ---------------------------------------------------| -----------------------------------| -| --help | help for create-wallet | `./zwallet create-wallet --help` | +| `--help` | help for create-wallet | `./zwallet create-wallet --help` | | `--silent` | do not print wallet details in the standard output | `./zwallet create-wallet --silent` | | `--wallet` | give custom name to the wallet | `./zwallet create-wallet --wallet` | @@ -218,9 +218,7 @@ Sample command using `--mnemonic` ```sh ./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 command using `--mnemonic` and `--offline` - -Sample output +Sample output using `--mnemonic` or combined with `--offline` ``` Wallet recovered!! From fcfe8248e5e8636798849b2cbec3aee84c2efccd Mon Sep 17 00:00:00 2001 From: Harshit Mehndiratta <65766301+hm90121@users.noreply.github.com> Date: Thu, 16 Nov 2023 17:45:41 +0530 Subject: [PATCH 11/16] add sc owner commands --- README.md | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4262c383..45bbf78b 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,9 @@ The CLI utilizes the [Züs GoSDK](https://github.com/0chain/gosdk). - [Getting Auhorizer Configuration - `bridge-auth-config`](#get-authorizer-configuration) - [Getting node ID by URL - `getid`](#getting-node-id-by-url---getid) - [Getting Storage Smart Contract Configuration - `sc-config`](#show-storage-smart-contract-configuration) + - [Updating Storage Smart Contract Configuration - `sc-update-config`](#updating-storage-smart-contract-configuration) - [Getting Global Configuration - `global-config`](#show-global-configurations) + - [Updating Global Configuration - `global-update-config`](#updating-global-configuration) - [Get Version - `get-version`](#get-version) - [Getting and sending tokens](#getting-and-sending-tokens) - [Getting tokens with Faucet smart contract - `faucet`](#getting-tokens-with-faucet-smart-contract---faucet) @@ -41,6 +43,7 @@ The CLI utilizes the [Züs GoSDK](https://github.com/0chain/gosdk). - [Getting the stake pool info - `mn-pool-info`](#getting-the-stake-pool-info---mn-pool-info) - [Unlock a stake - `mn-unlock`](#unlock-a-stake---mn-unlock) - [Updating staking config of a node - `mn-update-settings`](#updating-staking-config-of-a-node---mn-update-settings) + - [Updating the miner smart contract configuration - `mn-update-config`](#updating-miner-smart-contract-configuration) - [Config](#config) - [~/.zcn/config.yaml](#zcnconfigyaml) - [(Optional) Override Network](#override-network) @@ -521,6 +524,25 @@ You can also use the `--json` flag with the `sc-config ` command | `--json` | Print output as JSON | +#### Updating Storage Smart Contract Configuration + +Update storage smart contract settings. + +| Parameter | Required | Description | Default | Valid Values | +| -------------- | ----- | ------------------------------------------------------------ | ------- | ---------------- | +| `--keys` | Yes | Name of variable to change in storage smart contract configuration.The variables are mentioned in [Show Storage Smart Contract Configuration](#show-storage-smart-contract-configuration) sample response. | | any strings +| `--values` | Yes | Specify new values | | any strings | + +Note: The config can only be updated using chain owner wallet. See command below for reference: + +Sample Command for updating max read price: +```shell +./zwallet sc-update-config --keys "max_read_price" --values "80" --wallet chain_owner_wallet.json +``` +Sample Response: +```shell +storagesc smart contract settings updated Hash: +``` #### Get Version The version of zwallet and gosdk can be fetched using the `./zwallet version` command. @@ -629,6 +651,26 @@ server_chain.transaction.timeout 600 server_chain.view_change false ``` +#### Updating global configuration + +Update global settings. + +| Parameter | Required | Description | Default | Valid Values | +| -------------- | ----- | ------------------------------------------------------------ | ------- | ---------------- | +| `--keys` | Yes | Name of variable to change in global configuration.The variables are mentioned in [Show Global Configuration](#show-global-configurations) sample response. | | any strings +| `--values` | Yes | Specify new values | | any strings | + +Note: The config can only be updated using chain owner wallet. See command below for reference: + +Sample Command: +```shell +./zwallet global-update-config --keys server_chain.block.generators_percent --values 0.15 --wallet chain_owner_wallet.json +``` +Sample Response: +```shell +global settings updated Hash: +``` + ### Getting and sending tokens #### Getting tokens with Faucet smart contract - `faucet` @@ -766,6 +808,7 @@ Sample Command : ``` ./zwallet collect-reward --provider_type miner --provider_id $MINER/SHARDER_ID ``` + ### Staking on miners and sharders [Miner smart contract](https://github.com/0chain/0chain/blob/master/code/go/0chain.net/smartcontract/minersc/README.md) allows staking on the miner and sharder nodes. @@ -1040,7 +1083,6 @@ Reformatted output Output ``` -... transaction_base.go:673: https://dev3.zus.network/sharder01/v1/block/get?round=19683&content=header200 OK tokens unlocked. ``` @@ -1060,11 +1102,37 @@ Staking config can only be updated by the node's delegate wallet. ![Update node settings for staking](docs/mn-update-settings.png "Update node settings for staking") -Sample command +Sample command: ```sh ./zwallet mn-update-settings --id dc8c6c93fb42e7f6d1c0f93baf66cc77e52725f79c3428a37da28e294aa2319a --max_stake 1000000000000 --min_stake 10000000 --num_delegates 25 ``` + +Sample Response: +``` +settings updated Hash: +``` + +#### Updating miner smart contract configuration + +Update the miner smart contract config. + +| Parameter | Required | Description | Default | Valid Values | +| -------------- | ----- | ------------------------------------------------------------ | ------- | ---------------- | +| `--keys` | Yes | Name of variable to change in miner smart contract configuration. The variables are mentioned in [Getting the staking config - `mn-config`](#getting-the-staking-config---mn-config) sample response. | | any strings +| `--values` | Yes | Specify new values | | any strings | + +Note: The config can only be updated using chain owner wallet. See command below for reference: + +Sample Command for changing max stake: +```shell +./zwallet mn-update-config --keys max_stake --values 90 --wallet chain_owner_wallet.json +``` +Sample Response: +```shell +storagesc smart contract settings updated Hash: +``` + ## Config ### ~/.zcn/config.yaml From 259255ec6e676ba0831bd36e692adf82655ea03b Mon Sep 17 00:00:00 2001 From: Harshit Mehndiratta <65766301+hm90121@users.noreply.github.com> Date: Tue, 21 Nov 2023 17:52:55 +0530 Subject: [PATCH 12/16] add easy to use installation instructions --- README.md | 208 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 170 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 45bbf78b..07f24cfb 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,8 @@ The CLI utilizes the [Züs GoSDK](https://github.com/0chain/gosdk). - [Architecture](#architecture) - [Getting started](#getting-started) - [1. Installation](#1-installation) - - [2. Run `zwallet` commands](#2-run-zwallet-commands) + - [2. Configure network](#2-configure-network) + - [3. Run `zwallet` commands](#3-run-zwallet-commands) - [Global parameters](#global-parameters) - [Commands](#commands) - [Creating and restoring wallets](#creating-and-restoring-wallets) @@ -76,61 +77,192 @@ For most transactions, `zwallet` uses the `0dns` to discover the network nodes, ### 1. Installation -**Prerequisites** -Install Go, an open-source programming language based on your operating system from the links below. -- Go: Mac, Linux, and Windows installation instructions can be found [here](https://go.dev/doc/install). +* [Linux Installation](#linux-installation) +* [Mac Installation](#mac-installation) +* [Windows Installation](#windows-installation) -**Procedures** +#### Linux Installation -1. Clone the `zwalletcli` repo and install +**Note:** zwallet binaries are designed to function optimally with gcc 11 as the default compiler. Notably, Ubuntu 22 is equipped with gcc 11 by default. However, Ubuntu 20 initially comes with gcc 9. To upgrade the gcc version, execute the following commands: -```sh -git clone https://github.com/0chain/zwalletcli.git -cd zwalletcli -make install +``` +sudo add-apt-repository ppa:ubuntu-toolchain-r/test +sudo apt update +sudo apt install build-essential +sudo apt install gcc-11 g++-11 ``` -2. Add config yaml at `~/.zcn/config.yaml` +1. Download the latest linux zwalletcli release file `zwallet-linux.tar.gz` from [here](https://github.com/0chain/zwalletcli/releases/latest). -The following script sets `https://demo.zus.network` as your network. +2. The zip file will be downloaded in `Downloads` directory of your system. Open terminal,navigate to `Downloads` directory and extract the downloaded archive to `/usr/local/bin` path using the commands below. -```sh -cat > ~/.zcn/config.yaml << EOF +``` +cd Downloads +sudo tar -xzf zwallet-linux.tar.gz --directory /usr/local/bin +``` + +3. Navigate to the extracted directory path. + +``` +cd /usr/local/bin +``` + +4. Run the zwallet executable by using the command below. + +``` +./zwallet +``` + +On successful installation you will see a help section: + +``` +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-delete Deletes an authorizer to token bridge SC manually + auth-sc-register Register an authorizer to token bridge SC manually + +Use "zwallet [command] --help" for more information about a command. +``` +5. To rerun zwalletcli at later time repeat steps 3 and 4 on the terminal. + +#### Windows Installation + +1. Download the latest windows zwalletcli zip file `zwallet-windows.zip` from [here](https://github.com/0chain/zwalletcli/releases/latest). +2. By default, the zip file will be downloaded in `Downloads` directory of your system(C:\Users\\Downloads). Extract the executable and dll files from archive `zwallet-windows.zip` file into a directory of your choice. + + **Note:** In case the zip file lack the necessary DLL files, kindly download them from [here](https://github.com/0chain/zboxcli/files/11840033/windows.dll.s.zip) and proceed to manually copy and paste these + files into the extracted executable directory path. + +3. Open Windows Command prompt and navigate to directory where you have extracted the `zwallet-windows.zip` files and run the executable using `zwallet` command. See screenshot for reference. + +![windows command prompt](https://github.com/0chain/zwalletcli/assets/65766301/96891298-00ef-44d1-a4f9-a31752c0ab69) + +4. On successful installation you will see a help section similar to response below : + +``` +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-delete Deletes an authorizer to token bridge SC manually + auth-sc-register Register an authorizer to token bridge SC manually + +``` +5. To rerun zwalletcli at later time repeat steps 3 and 4 on windows command prompt. + +#### Mac Installation + +1. Download the latest mac zwalletcli release file `zwallet-macos.tar.gz` release from [here](https://github.com/0chain/zwalletcli/releases/latest). + +2. The zip file will be downloaded in `Downloads` directory of your system. Open terminal, navigate to `Downloads` directory and extract the downloaded archive to `/usr/local/bin` path using the commands below. + +``` +cd Downloads/ +sudo tar -xzf zwallet-macos.tar.gz --directory /usr/local/bin +``` + +3. Navigate to extracted directory path. + +``` +cd /usr/local/bin +``` + +4. Run the zwallet executable using the command below. + +``` +./zwallet +``` + +On successful installation you will see a help section similar to response below: + +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-delete Deletes an authorizer to token bridge SC manually + auth-sc-register Register an authorizer to token bridge SC manually + + +5. To rerun zwalletcli at later time repeat steps 3 and 4 on the terminal. + +### 2. Configure network + +1. Copy the contents from [config.yaml](https://github.com/0chain/zwalletcli/blob/staging/network/config.yaml) file and save it as `config.yaml` file on desktop of your mac and linux system . + +2. Open terminal and make a new .zcn folder in the home linux and mac directory using the command below: + +``` +mkdir $HOME/.zcn +``` +Note: For windows manually create a folder named `.zcn` at `C:\Users\`path. + +3. Copy `config.yaml` from desktop into `$HOME/.zcn` directory in mac and linux using the command below: + +``` +cp /Users//Desktop/config.yaml $HOME/.zcn +``` +Note: For windows manually copy paste the `config.yaml` file into `C:\Users\\.zcn` path. + +4. Verify the contents of config file in Linux and Mac using the command below: + +Note: In Windows check the contents manually by opening the file at `C:\Users\\.zcn` path. + +``` +cat config.yaml +``` + +Response: +``` +--- block_worker: https://demo.zus.network/dns signature_scheme: bls0chain -min_submit: 50 # in percentage -min_confirmation: 50 # in percentage +min_submit: 50 +min_confirmation: 50 confirmation_chain_length: 3 -EOF -``` -3. Run `zwallet` to display the list of supported commands. +max_txn_query: 5 +query_sleep_time: 5 +# # OPTIONAL - Uncomment to use/ Add more if you want +# preferred_blobbers: +# - http://demo.zus.network:31051 +# - http://demo.zus.network:31052 +# - http://demo.zus.network:31053 -```sh -./zwallet ``` ----- -For detailed steps on the installation, follow the guides below: -- [How to build on Linux/Mac](https://github.com/0chain/zwalletcli/wiki/Build-on-Linux-and-Mac) -- [How to build on Windows](https://github.com/0chain/zwalletcli/wiki/Build-Windows) +Zbox connects to the Züs 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. + +**Note:** A block worker URL is a field that require the URL of blockchain network you want to connect to. Change the default value of block_worker field with the following: `http://198.18.0.98:9091/` for the local testnet. + +### 3. Run `zwallet` commands -### 2. Run `zwallet` commands -Ensure your terminal's working directory is inside the `zwalletcli` repo for the following steps. -... MINGW64 ~/zwalletcli ## Global parameters `zwallet` accepts global parameters to override default configuration and can be used in any command. -| Parameter | Description | Default | -| -------------------------- | ------------------------------- | -------------- | -| `--h, --help` | Shows help/parameters for a particular command | | -| `--config` | [Config file](https://github.com/0chain/zwalletcli/blob/staging/network/config.yaml) and [description](https://github.com/0chain/zwalletcli#zcnconfigyaml). Configuration file | `config.yaml` | -| `--configDir` | Configuration directory | `~/.zcn` | -| `--network` | Network file to overwrite the network details [Network file](#override-network) | `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) | +| Flags | Description | Usage | +| -------------------------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ | +| --config string | Specify a zbox configuration file (default is [$HOME/.zcn/config.yaml](#zcnconfigyaml)) | `./zwallet [command] --config config1.yaml` | +| --configDir string | Specify a zbox configuration directory (default is $HOME/.zcn) | `./zwallet [command] --configDir /$HOME/.zcn2` | +| -h, --help | Gives more information about a particular command. | `./zwallet [command] --help` | +| --network string | Specify a network file to overwrite the network details(default is [$HOME/.zcn/network.yaml](#zcnnetworkyaml)) | `./zwallet [command] --network network1.yaml` | +| --silent | (default false) Do not show interactive sdk logs (shown by default) | `./zwallet [command] --silent` | +| --wallet string | Specify a wallet file or 2nd wallet (default is $HOME/.zcn/wallet.json) | `./zwallet [command] --wallet wallet2.json` | +| --wallet_client_id string | Specify a wallet client id (By default client_id specified in $HOME/.zcn/wallet.json is used) | `./zwallet [command] --wallet_client_id ` | +| --wallet_client_key string | Specify a wallet client_key (By default client_key specified in $HOME/.zcn/wallet.json is used) | `./zwallet [command] --wallet_client_key < client_key>` | +| --fee float | transaction fee for the given transaction (if unset, it will be set to blockchain min fee) | `./zwallet [command] --fee 0.5` + ## Commands From 449aade5c26f7f10c8bae6367e26d977f740058a Mon Sep 17 00:00:00 2001 From: Harshit Mehndiratta <65766301+hm90121@users.noreply.github.com> Date: Tue, 21 Nov 2023 18:00:19 +0530 Subject: [PATCH 13/16] add xcode instructions --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 07f24cfb..97c87c1f 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,10 @@ Available Commands: cd Downloads/ sudo tar -xzf zwallet-macos.tar.gz --directory /usr/local/bin ``` +Note: There can be a chance running above command on terminal will trigger a prompt to install Xcode Command Line Tools if you donot have them installed already. You'll see a panel similar to screenshot below that asks you to install Xcode Command Line Tools. Click 'Install' to begin the download and installation process. + +![install-Xcode-CLT](https://github.com/0chain/zwalletcli/assets/65766301/fb8d761b-c8ce-468b-855f-a06d819850e7) + 3. Navigate to extracted directory path. From 14d8d034a4929e22e2076710200f97ce15f82add Mon Sep 17 00:00:00 2001 From: Harshit Mehndiratta <65766301+hm90121@users.noreply.github.com> Date: Tue, 21 Nov 2023 18:01:33 +0530 Subject: [PATCH 14/16] correct typos --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 97c87c1f..6f1852bf 100644 --- a/README.md +++ b/README.md @@ -188,8 +188,10 @@ cd /usr/local/bin On successful installation you will see a help section similar to response below: +``` Use Zwallet to store, send and execute smart contract on 0Chain platform. - + + Usage: zwallet [command] @@ -197,7 +199,9 @@ Available Commands: auth-register Register an authorizer manually auth-sc-delete Deletes an authorizer to token bridge SC manually auth-sc-register Register an authorizer to token bridge SC manually - + +Use "zwallet [command] --help" for more information about a command. +``` 5. To rerun zwalletcli at later time repeat steps 3 and 4 on the terminal. From 861d436a63360c736eb7bda17381b75e9c2c0768 Mon Sep 17 00:00:00 2001 From: Harshit Mehndiratta <65766301+hm90121@users.noreply.github.com> Date: Wed, 22 Nov 2023 15:41:11 +0530 Subject: [PATCH 15/16] fix renders --- README.md | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6f1852bf..3ac316ef 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,9 @@ The CLI utilizes the [Züs GoSDK](https://github.com/0chain/gosdk). - [Config](#config) - [~/.zcn/config.yaml](#zcnconfigyaml) - [(Optional) Override Network](#override-network) - + + + ## Züs Overview [Züs](https://zus.network/) is a high-performance cloud on a fast blockchain offering privacy and configurable uptime. It is an alternative to traditional cloud S3 and has shown better performance on a test network due to its parallel data architecture. The technology uses erasure code to distribute the data between data and parity servers. Züs storage is configurable to provide flexibility for IT managers to design for desired security and uptime, can design a hybrid or a multi-cloud architecture with a few clicks using [Blimp's](https://blimp.software/) workflow, and can change redundancy and providers on the fly. @@ -141,7 +143,7 @@ Use "zwallet [command] --help" for more information about a command. 3. Open Windows Command prompt and navigate to directory where you have extracted the `zwallet-windows.zip` files and run the executable using `zwallet` command. See screenshot for reference. -![windows command prompt](https://github.com/0chain/zwalletcli/assets/65766301/96891298-00ef-44d1-a4f9-a31752c0ab69) +![windows command prompt](https://github.com/0chain/gitbookdocs/assets/65766301/27dfea98-db56-4462-87f1-12a6015d9c58) 4. On successful installation you will see a help section similar to response below : @@ -171,8 +173,7 @@ sudo tar -xzf zwallet-macos.tar.gz --directory /usr/local/bin ``` Note: There can be a chance running above command on terminal will trigger a prompt to install Xcode Command Line Tools if you donot have them installed already. You'll see a panel similar to screenshot below that asks you to install Xcode Command Line Tools. Click 'Install' to begin the download and installation process. -![install-Xcode-CLT](https://github.com/0chain/zwalletcli/assets/65766301/fb8d761b-c8ce-468b-855f-a06d819850e7) - +![install-Xcode-CLT](https://github.com/0chain/gitbookdocs/assets/65766301/403a8315-7593-4ace-ab89-6b8d1fe6554b) 3. Navigate to extracted directory path. @@ -207,7 +208,7 @@ Use "zwallet [command] --help" for more information about a command. ### 2. Configure network -1. Copy the contents from [config.yaml](https://github.com/0chain/zwalletcli/blob/staging/network/config.yaml) file and save it as `config.yaml` file on desktop of your mac and linux system . +1. Copy the contents from [config.yaml](https://github.com/0chain/zwalletcli/blob/staging/network/config.yaml) file and save it as `config.yaml` file on `Desktop` of your system . 2. Open terminal and make a new .zcn folder in the home linux and mac directory using the command below: @@ -219,13 +220,13 @@ Note: For windows manually create a folder named `.zcn` at `C:\Users\/Desktop/config.yaml $HOME/.zcn +cp /Users//Desktop/config.yaml $HOME/.zcn ``` Note: For windows manually copy paste the `config.yaml` file into `C:\Users\\.zcn` path. 4. Verify the contents of config file in Linux and Mac using the command below: -Note: In Windows check the contents manually by opening the file at `C:\Users\\.zcn` path. +Note: In windows check the contents manually by opening the file at `C:\Users\\.zcn` path. ``` cat config.yaml @@ -249,7 +250,7 @@ query_sleep_time: 5 ``` -Zbox connects to the Züs 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. +Zwallet connects to the Züs 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. **Note:** A block worker URL is a field that require the URL of blockchain network you want to connect to. Change the default value of block_worker field with the following: `http://198.18.0.98:9091/` for the local testnet. @@ -272,6 +273,25 @@ Zbox connects to the Züs network using the `block_worker` field. These network | --fee float | transaction fee for the given transaction (if unset, it will be set to blockchain min fee) | `./zwallet [command] --fee 0.5` +### 3. Run `zwallet` commands + +## Global parameters + +`zwallet` accepts global parameters to override default configuration and can be used in any command. + +| Flags | Description | Usage | +| -------------------------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ | +| --config string | Specify a zbox configuration file (default is [$HOME/.zcn/config.yaml](#zcnconfigyaml)) | `./zwallet [command] --config config1.yaml` | +| --configDir string | Specify a zbox configuration directory (default is $HOME/.zcn) | `./zwallet [command] --configDir /$HOME/.zcn2` | +| -h, --help | Gives more information about a particular command. | `./zwallet [command] --help` | +| --network string | Specify a network file to overwrite the network details(default is [$HOME/.zcn/network.yaml](#zcnnetworkyaml)) | `./zwallet [command] --network network1.yaml` | +| --silent | (default false) Do not show interactive sdk logs (shown by default) | `./zwallet [command] --silent` | +| --wallet string | Specify a wallet file or 2nd wallet (default is $HOME/.zcn/wallet.json) | `./zwallet [command] --wallet wallet2.json` | +| --wallet_client_id string | Specify a wallet client id (By default client_id specified in $HOME/.zcn/wallet.json is used) | `./zwallet [command] --wallet_client_id ` | +| --wallet_client_key string | Specify a wallet client_key (By default client_key specified in $HOME/.zcn/wallet.json is used) | `./zwallet [command] --wallet_client_key < client_key>` | +| --fee float | transaction fee for the given transaction (if unset, it will be set to blockchain min fee) | `./zwallet [command] --fee 0.5` + + ## Commands ### Creating and restoring wallets @@ -427,7 +447,7 @@ List all sharders with the below command. ./zwallet ls-sharders --all ``` -Sample output +Sample output: ``` MagicBlock Sharders @@ -1305,3 +1325,4 @@ EOF ``` Overriding the nodes can be useful in local chain setup. In some cases, the block worker might return URLs with IP/alias only accessible within the docker network. + From d6728e34dd54c369f8e2b43bd89f7e7373b4c9e4 Mon Sep 17 00:00:00 2001 From: Harshit Mehndiratta <65766301+hm90121@users.noreply.github.com> Date: Wed, 29 Nov 2023 18:04:30 +0530 Subject: [PATCH 16/16] typos and overide network steps --- README.md | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 3ac316ef..339a8d11 100644 --- a/README.md +++ b/README.md @@ -254,23 +254,26 @@ Zwallet connects to the Züs network using the `block_worker` field. These netwo **Note:** A block worker URL is a field that require the URL of blockchain network you want to connect to. Change the default value of block_worker field with the following: `http://198.18.0.98:9091/` for the local testnet. -### 3. Run `zwallet` commands +5. Override the nodes by creating a network.yaml file in your `.zcn` directory and add the following lines of code: + +``` +miners: + - http://localhost:7071 + - http://localhost:7072 + - http://localhost:7073 +sharders: + - http://localhost:7171 +``` +Note: The step above is only required when you are deploying testnet from [here](https://github.com/0chain/0chain). + + + + + + -## Global parameters -`zwallet` accepts global parameters to override default configuration and can be used in any command. -| Flags | Description | Usage | -| -------------------------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ | -| --config string | Specify a zbox configuration file (default is [$HOME/.zcn/config.yaml](#zcnconfigyaml)) | `./zwallet [command] --config config1.yaml` | -| --configDir string | Specify a zbox configuration directory (default is $HOME/.zcn) | `./zwallet [command] --configDir /$HOME/.zcn2` | -| -h, --help | Gives more information about a particular command. | `./zwallet [command] --help` | -| --network string | Specify a network file to overwrite the network details(default is [$HOME/.zcn/network.yaml](#zcnnetworkyaml)) | `./zwallet [command] --network network1.yaml` | -| --silent | (default false) Do not show interactive sdk logs (shown by default) | `./zwallet [command] --silent` | -| --wallet string | Specify a wallet file or 2nd wallet (default is $HOME/.zcn/wallet.json) | `./zwallet [command] --wallet wallet2.json` | -| --wallet_client_id string | Specify a wallet client id (By default client_id specified in $HOME/.zcn/wallet.json is used) | `./zwallet [command] --wallet_client_id ` | -| --wallet_client_key string | Specify a wallet client_key (By default client_key specified in $HOME/.zcn/wallet.json is used) | `./zwallet [command] --wallet_client_key < client_key>` | -| --fee float | transaction fee for the given transaction (if unset, it will be set to blockchain min fee) | `./zwallet [command] --fee 0.5` ### 3. Run `zwallet` commands