FI for Zingo-cli: The power of Zcash on the command line!
ZCASH

Zingo-cli: The power of Zcash on the command line!

"Zingo-cli: La potencia de Zcash en la línea de comandos!"

November 28, 2022· 3 min read
900 score

Zingo-cli: the power of Zcash's lightwalletd on the command line!

Hello fellow Zcash enthusiasts, in this post I want to show you this nice tool I've recently discovered, the zingo-cli by ZingoLabs.

Originally forked from adityapk00's zecwallet-light-cli, zingolib is both a library for zingoproxyclient and zingo-mobile, as well as an included cli application to interact with zcashd via lightwalletd. [1]

This tool makes interaction with a Zcash lightwalletd server extremely easy, as I'll demonstrate in this post.

Building from source

The first step for using zingo-cli is to build it.

I'm using Linux Mint 19.2 Tina. But compilation should be the same in any other platform.

Install/update rust and rustfmt:

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh or $ rustup update$ rustup component add rustfmt

Also, instal linux build tools

$ sudo apt install build-essential gcc

Make sure you have the latest version of Protobuf Compiler installed!

$ sudo apt-get install protobuf-compiler

Then clone zingolib git repository and build zingo-cli:

Clone the git repository:

$ git clone https://github.com/zingolabs/zingolib.git

Change the dicrectory

$ cd zingolib

And finally build it using cargo

$ cargo build --release

This process will take a few minutes!

After compilation is finished, just change into directory ./target/release/ and run zingo-cli

$ cd target/release$ ./zingo-cli

Using zingo-cli

If you invoke zingo-cli without any parameters, it'll start into interactive mode.
On the first start, zingo-cli will automatically create a wallet for you:

Creating a new wallet2022-11-28T19:34:37.536840Z  INFO zingo_cli:     2022-11-28T19:34:37.536883Z  INFO zingo_cli: Starting Zingo-CLI    2022-11-28T19:34:37.536910Z  INFO zingo_cli: Light Client config ZingoConfig { server_uri: RwLock { data: https://mainnet.lightwalletd.com:9067/, poisoned: false, .. }, chain: Mainnet, reorg_buffer_offset: 4, monitor_mempool: true, data_dir: None }    Lightclient connecting to https://mainnet.lightwalletd.com:9067/**Batch** Current:    0 Total:    1   Blocks Loaded:    0 TrialDecrypted:    0, Witnesses Updated:    0, Total:  100, {  "result": "success",  "latest_block": 1894670,  "total_blocks_synced": 100}Ready!(main) Block:1894670 (type 'help') >> 

And you'll get the interactive prompt, where you can type commands. You can type help to see all available commands.

In this post, I'll show a few examples of how easy is to interact with a lightwalletd server, creating a new address and checking my balance.

Getting server info

By default, if no server is specified, zingo-cli will try to connect to https://mainnet.lightwalletd.com:9067.
Let's get some info about the server and the network, at the prompt, type info:

(main) Block:1894717 (type 'help') >> info{  "version": "v0.4.13",  "git_commit": "2d3943b8e995a3b2c5648ec9859dccc67c535386",  "server_uri": "https://mainnet.lightwalletd.com:9067/",  "vendor": "ECC LightWalletD",  "taddr_support": true,  "chain_name": "main",  "sapling_activation_height": 419200,  "consensus_branch_id": "c2d6d0b4",  "latest_block_height": 1894717}

Here we can see info like version of lightwalletd, vendor, chain name, the latest block, etc ...

Creating new addresses

By deafult, zingo-cli automatically creates a Orchard Unified Address for you. You can check you addresses by typing addresses at the prompt:

(main) Block:1894722 (type 'help') >> addresses[  {    "address": "u1a46x2alsk03g9a5es455ypwcrj2surayhpp8kmku3mvd95gt0dnzxw2ss46ljcvxelvwunew9dg8cl8qcdqtm3mj2xd6swr66nz6nsd6ldwhltwnxxymgsaya683f5m49cfkym6wgsfch2dm80uz99muq8zd0e0m8d6q9a9dg2a7es8fd6uc6mfn3geazj4fmx8jcjrmg7f0x7fj9av",    "receivers": {      "transparent": "t1bLiCWbLBJ6W9tzV1HQoMxEGuXospWcwwx",      "sapling": "zs1uec0lqywclhkynkdupakvxq7yrlnldda58p0fea4evzgln2m6z7tljq3q83c7kszsharxmdcmpc",      "orchard_exists": true    }  }]

But let's create a new Orchard address just for the sake of it. It's as simple as typing new o at the prompt:

(main) Block:1894723 (type 'help') >> new o[  "u1e8ug2mdje47l86xvq9242esee6mgu0a6k527vuelp7ucdl820dr2nvlyq8ya6xzm3x556sca7mu26t5gv7nx5csp6xac5ddr0vek2sc5"]

Checking your balance

I've sent myself a few Zats to my newly created orchard address, we can check our balance with the command balance:

(main) Block:1894740 (type 'help') >> balance{  "sapling_balance": 0,  "verified_sapling_balance": 0,  "spendable_sapling_balance": 0,  "unverified_sapling_balance": 0,  "orchard_balance": 101000,  "verified_orchard_balance": 101000,  "spendable_orchard_balance": 101000,  "unverified_orchard_balance": 0,  "transparent_balance": 0}

My orchard_balance shows my Orchard balance expressed in zatoshis, divide it by 10^8 and we'll get 0,00101 $ZEC.

Seed

Be sure to awayls keep your seed phrase stored in a safe place!
To retrieve zingo-cli seed phrase, just type seed at the prompt:

(main) Block:1894760 (type 'help') >> seed{  "seed": "your seed phrase will appears here (You really thought I would leave my seed here for everyone to see? >_<)",  "birthday": 1894570}

Never share your seed with anyone you don't trust, and for that matter, with anyone at all!

Closing words

As you can see, zingo-cli is an easy-to-use tool, but very powerful. I've only covered the basics on this post, but if you guys liked it, I can expand and make a new post show advanced usage of the zingo-cli.

References

[1] zingolib on github

Related Articles