# Get Started

## System Requirements

To properly build components, you must have a machine setup with the following requirements:

* Linux (Ubuntu Preferred) Version: 20.04 or Above\
  &#x20;Mac(Apple Silicon or Intel) Version: Big Sur or Above\
  &#x20;Windows : Windows 10 or Above
* 4 vCPU, 4 GB Memory at minimum
* 1 GB of space minimum for zwallet build components&#x20;

## Install zwalletcli

* [Linux Installation](#linux-installation)
* [macOS Installation](#macos-installation)
* [Windows Installation](#windows-installation)
* [Building zwalletcli from source ](#building-zwallet)

### Linux Installation

1. Open terminal and download the latest linux zwalletcli archive release[.](https://github.com/0chain/zwalletcli/releases/latest)

```
curl -LO https://github.com/0chain/zwalletcli/releases/download/v1.10.0/zwallet-macos.tar.gz
```

2. Extract the downloaded archive to a specified directory using the command below.

```
sudo tar -xzf zwallet-linux.tar.gz --directory /usr/local/bin
```

&#x20;3\.  Provide execution privileges to the executable.

```
chmod +x /usr/local/bin/zwallet
```

4\.   Navigate to the extracted directory path.&#x20;

```
cd /usr/local/bin
```

5. 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.
                        Complete documentation is available at https://0chain.net

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.
```

&#x20; 6\. [Configure zwallet network](#configure-zwallet-network)

&#x20; 7\. [Create wallet](#creating-a-wallet)

### Windows Installation

1. Download the latest windows zwalletcli archive release from [here](https://github.com/0chain/zwalletcli/releases/latest).
2. Extract the executable from archive `zwallet-windows.zip`
3. Run the executable `zwallet.exe` in windows command prompt.
4. On successful installation you will see a help section similar to response below  :&#x20;

```
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

```

**Note:** The above response is shortened for formatting purposes. \
5\. [Configure zwallet network](#configure-zwallet-network)

6\. [Create wallet](#creating-a-wallet)

### macOS Installation

1. Open terminal and download the latest mac zwalletcli archive release[.](https://github.com/0chain/zwalletcli/releases/latest)

```
curl -LO https://github.com/0chain/zwalletcli/releases/download/v1.10.0/zwallet-macos.tar.gz
```

2. Extract the downloaded archive to a specified directory using the command below:

```
sudo tar -xzf zwallet-macos.tar.gz --directory /usr/local/bin
```

3. &#x20;Provide execution privileges to the executable.

```
chmod +x /usr/local/bin/zwallet
```

4. Navigate to extracted directory path .

```
cd /usr/local/bin
```

5. Run the zwallet executable using the command below.

```
./zwallet
```

On successful installation you will see a help section similar to response below :&#x20;

<pre><code><strong>Use Zwallet to store, send and execute smart contract on 0Chain platform.
</strong>            
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
</code></pre>

**Note:** The above response is shortened for formatting purposes.&#x20;

&#x20; 6\. [Configure zwallet network](#configure-zwallet-network)

&#x20; 7\. [Create Wallet](#creating-a-wallet)

## Building ZWallet

### **Building zwalletcli for WIndows**

Windows 64bit (tested with Windows 11)

1. Installing msys2 from [here](https://github.com/msys2/msys2-installer/releases/download/2023-05-26/msys2-x86_64-20230526.exe).
2. Open MSYS2 MINGW64 shell from the windows start menu. The MINGW64 shell window will be similar to screenshot below.

<figure><img src="/files/rki3aNPLSTIaBsmHuRvX" alt=""><figcaption></figcaption></figure>

3. Install the following libraries:

```
pacman -S base-devel git gcc make
```

4. Install clang, go for mingw64 and unzip

```
pacman -S  mingw-w64-x86_64-clang mingw-w64-x86_64-go unzip
```

&#x20; **Note:** Restart mingw64 shell for Go to make changes.

5. Set environment variables

   ```
   export GOROOT=/mingw64/lib/go
   export GOPATH=/mingw64
   export PATH=$PATH:$GOROOT/bin

   # use clang as a default compiler for CGO
   go env -w "CC=/mingw64/bin/clang.exe"
   ```
6. Clone zwalletcli

```
git clone https://github.com/0chain/zwalletcli.git
```

7. Navigate to zwalletcli and run the following command :

<pre><code><strong>cd zwalletcli
</strong><strong>make install
</strong></code></pre>

8. Download necessary dll files as zip from [here](https://github.com/0chain/zboxcli/files/11840033/windows.dll.s.zip).
9. Unzip and copy dll's to zwalletcli directory. The zwalletcli directory will be available at the following path `C:\msys64\home\<windows_username>\zboxcli` if cloned under mingw64 shell.
10. &#x20;Now run the `./zwallet` command under zwalletcli directory .

```
./zwallet
```

&#x20;      On a successful build you will see a help section

&#x20;  11\.  [Configure zwallet network](#configure-zwallet-network)

&#x20;  12\.  [Create Wallet](#creating-a-wallet)

### Building zwalletcli for Mac and Linux

#### GoLang Binaries

Installation instructions for Go can be found[ here](https://go.dev/doc/install).

#### Build-Essential(For Linux Only )

The build essential package is required to build and make zwallet 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(For Linux Only )

Git is required to retrieve and clone the Zbox repository. Install Git by using the command

```
sudo apt install git
```

1\. Clone the zwallet repository using the command

```
git clone https://github.com/0chain/zwalletcli.git
```

2\. Navigate to zwallet 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:

![](/files/-MaVTCjPQx3Pb2Q5GBHQ)

4. Start the zwallet by typing

```
./zwallet
```

&#x20; On a successful build you will see a help section.

&#x20;8\.  [Configure zwallet network](#configure-zwallet-network)

&#x20;9\.  [Create Wallet](#creating-a-wallet)

## Configure ZWallet network

Configuration for the Züs network by default is stored in `network/config.yaml` file of the [zwallet github repo ](https://github.com/0chain/zwalletcli/blob/staging/network/config.yaml)which we will copy to a new `config.yaml` file in our local system .&#x20;

1. Open terminal and make a new .zcn folder in the home directory of your system using the command below:

```
mkdir $HOME/.zcn
```

**Note:** For windows create a  folder named .zcn at \``C:\Users\<windows_username>`\`path

2. Copy[ config.yaml](https://github.com/0chain/zwalletcli/blob/staging/network/config.yaml) from network directory in zwalletcli repo to `.zcn` directory.

```
cp network/config.yaml $HOME/.zcn/config.yaml
```

3. Open the `config.yaml` file located at `$HOME/.zcn` path of your system.The contents should be similar to the file below.

```
---
block_worker: https://demo.zus.network/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 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:** In case you are configuring zwallet network for [setting up blockchain locally](/guides/setup-a-blockchain.md) the `block_worker`should be set to <http://198.18.0.98:9091/>

## Creating a Wallet

&#x20;ZWallet CLI provides a long list of commands to use. Lets begin with creation of wallet on Züs decentralized network.

For creating a wallet using ZWallet. Simply run `create-wallet` command and this creates a wallet at default location`~/.zcn/wallet.json`

Sample Command&#x20;

```sh
./zwallet create-wallet
```

Sample Output

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

Here is a sample with `faucet` command which will create a wallet with test tokens at default location`~/.zcn/wallet.json`

To add tokens to the wallet run zwallet `faucet` command.&#x20;

```
./zwallet faucet --methodName pour --input "new wallet"
```

### 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 `faucet`command:

```
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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-old.zus.network/guides/zwallet-cli/get-started.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
