Testnet (Unified) Address zecwallet-light-cli

Is there a switch on the zecwallet-light-cli so that when it is first called and the zecwallet-light-wallet.dat is created the initial (and subsequent address(s) are testnet addresses?

I know that my zcashd is communicating and fully synced on testnet and believe that my lightwalletd is also communicating on testnet as it is populating a subfolder “testnet” under its db folder.

I’m launching zecwallet-light-cli by issuing:

rm -rf my-test-wallet
./zecwallet-cli --server 127.0.0.1:9067 --data-dir ./my-test-wallet balance 

But, I’m getting a ‘u1’ address instead of a ‘utest’ address.

2 Likes

Crawling around it explicitly sets mainnetwork in the code so I don’t know if there’s an option. There was a conversation recently on discord about using testnet in a similar way if not the same so I’ll ask over there see if I could find it

2 Likes

I added this question as an issue on the project yesterday but I’m now thinking that was not the place to ask.

Thank you for relaying the question. Much appreciated!

3 Likes

Zingo’s zingo-cli works with testnet!

3 Likes

Depending on what you’re trying to test, zingo-cli --regtest may be even more convenient than testnet.

2 Likes

Zecwallet light can work on test net by first opening a new instance and starting a new wallet.
Then from the ‘server info’ page on in the ‘wallet’ tab, change your server address to your testnet server.
It’s presumably internal on your internal lightwalletD on your internal testnet node and would be by default the address imaged (so as not to make it clickable)

It will prompt you to close the wallet before changes take effect so close the wallet.
Then delete (or remove) the newly created ‘zecwallet-light-wallet.dat’ and ‘zecwallet-light-wallet.debug.log’ from the ‘/.zcash’ folder.
Restart zecwallet lite and it should again prompt to create a new wallet. After that it should display TAZ on the dashboard.


The ‘/.zcash’ folder will now contain a ‘/testnet3’ folder with new wallet.dat and debug.log files

I’m assuming the cli’s use these same files and probably the same method for setting testnet functionality

Hi @Autotunafish

I’m not quite there.

I’ve confirmed my zcashd is on testnet. Everything synced up.

Starting lightwalletd

./lightwalletd --no-tls-very-insecure --zcash-conf-path ~/.zcash/zcash.conf --log-file /dev/stdout --rpcuser XXX --rpcpassword YYY --data-dir ~/Storage/lightwalletd

Lightwalletd connects to zcashd and I can see logs at

~/.zcash/testnet3/debug.log

Launching lightwallet-cli

./zecwallet-cli --server 127.0.0.1:9067 --data-dir ./zcash

DOES create zecwallet-light-wallet.dat and zecwallet-light-wallet.debug.log but NOT under ~./zcash/testnet3 but rather ~./zcash

The addresses command in interactive mode returns

status: Unknown, message: “-5: Invalid address”, details: , metadata: MetadataMap { headers: {“content-type”: “application/grpc”} }

and the addresses are NOT testnet addresses but rather mainnet addresses

issuing

./zecwallet-cli --server 127.0.0.1:9067

WITHOUT a data directory switch DOES create the zecwallet-light-wallet.dat and zecwallet-light-wallet.debug.log under

~./zcash/testnet

however the addresses command still returns:

status: Unknown, message: “-5: Invalid address”, details: , metadata: MetadataMap { headers: {“content-type”: “application/grpc”} }

and the addresses are again NOT testnet addresses and again mainnet addresses.

Same behavior with

./zecwallet-cli --server 127.0.0.1:9067 --data-dir ./zcash/testnet3

and just for the heck of it

./zecwallet-cli --server 127.0.0.1:9067 --data-dir ./my-new-wallet-dir

Again, mainnet addresses instead of testnet, just with wallets in a different location; the my-new-wallet-directory.

./zecwallet-cli --help;

Doesn’t seem to have seem to have an option to force testnet addresses creation in the wallet. Didn’t jump out at me anyway.

BTW, thank you for the pointer to the zingo-cli @AloeareV and @zancas. If I can’t get zecwallet-cli going on testnet I will give zingo-cli a look.

I hope I’m missing something obvious in launching zecwallet-cli.

In the GUI example that @Autotunafish provided the switch to the testnet server is happening in the gui not at launch. I’m wondering if there is step happening behind the scenes in the GUI version of the zecwallet related to testnet wallet creation but I would guess that the ~./zcash/zcash.conf file is just being updated to testnet = 1 and perhaps the addnode entry being updated, too, to point at testnet.z.cash. Just a guess there on my part about the GUI version having an extra step in wallet creation. Pure guess.

Something else I might try or did I stumble upon an issue that needs reporting?

Dennis

Yes, setting the testnet server setting persists after removing the wallet.dat and debug.log file, it lives elsewhere perhaps in the bin, idk
It does not require any zcash.conf I dont think. After setting it you can remove those files and it will remember i.e. at launch. You must remove those mainnet files or it will assume mainnet regardless and err out.
Yes, the testnet3 folder is a subfolder of .zcash (clearly seen in the pic) and in there is where the testnet wallet.dat and debug.log files live, they have the same names as the mainnet files. I havent tried the CLI versions and just assumed that they call the same files from the default data-dir in which case, presuming its a new wallet with no pre-existing data or files, then it should derive the testnet automatically when you set the --server flag pointed at a testnet. Again, thats an assumption based on the method I tested, I havent tried the cli’s.
Whats your testnet blockheight?

One particular nuance is that you have to remove the testnet folder and restore the wallet from seed every time you start it after you set it to testnet. Interesting but it works at least. That could be actionable here

Ill try zecwallet lite cli and then zingo cli after (its breaking cargo build with an openssl error right now… i got it. I think the machine its on was a minimum installation and so didn’t have required libssl-dev)

Okay yes same method; you jusy have to delete all of the previous files and then start pointed at testnet. It will automatically set it to testnet and create a new wallet.
And after you turn it off it will start back up w/o needing to import the seed every time like the gui.

Zingo describes a modifying the pub const coded in the zingolib/zingoconfig/src/lib.rs on line 26 DEFAULT_SERVER to the internal 127 0 0 1:9067
I havent gotten to that one yet


However zingo is a fork of zwl and is stated that this is hard coded in the zecwallet config so it may not be necessary to change the pub const in zingo for that reason, idk I haven’t tried yet

@Autotunafish in that image those addresses don’t look like testnet addresses.

Were you able to get zecwallet-cli to return utest1XXXX… addresses?

Here are my exact steps…

zcashd part:

1. remove ~./zcash/testnet3 (starting from scratch just to be sure)
2. restart zcashd
3. confirm that ~./zcash/testnet3 is recreated included the files one would expect to see e.g. see wallet.dat. *.log, blocks, etc.
4. wait for syncronization to finish

5. Confirm rpc to zcashd and see the addresses created by zcashd

curl --user XXX:YYY --data-binary ‘{“jsonrpc”: “1.0”, “id”:“curltest1”, “method”: “z_getnewaddress”, “params”: }’ -H ‘content-type: text/plain;’ http://127.0.0.1:18232
curl --user XXX:YYY --data-binary ‘{“jsonrpc”: “1.0”, “id”:“curltest2”, “method”: “z_getnewaccount”, “params”: }’ -H ‘content-type: text/plain;’ http://127.0.0.1:18232
curl --user XXX:YYY --data-binary ‘{“jsonrpc”: “1.0”, “id”:“curltest3”, “method”: “z_getaddressforaccount”, “params”: [0] }’ -H ‘content-type: text/plain;’ http://127.0.0.1:18232
curl --user XXX:YYY --data-binary ‘{“jsonrpc”: “1.0”, “id”:“curltest4”, “method”: “z_getwalletinfo”, “params”: }’ -H ‘content-type: text/plain;’ http://127.0.0.1:18232
curl --user XXX:YYY --data-binary ‘{“jsonrpc”: “1.0”, “id”:“curltest5”, “method”: “listaddresses”, “params”: }’ -H ‘content-type: text/plain;’ http://127.0.0.1:18232

Last RPC call returns…

http://127.0.0.1:18232
{“result”:[{“source”:“mnemonic_seed”,“transparent”:{“addresses”:[“tmAZaBXXWPbUCcwmg5TB5dayk8PavVf5WSQ”]},“sapling”:[{“zip32KeyPath”:“m/32’/1’/2147483647’/0’”,“addresses”:[“ztestsapling1yl2rctrdjj2fgmlalq30karyc59mmgs7fn95fg9wc5549f277fdzpydac5xygy4k9gka28f9xxf”]}],“unified”:[{“account”:0,“seedfp”:“7613e2c79ce72698c650c3dfb0b1a65471e904ccb110ea080781ce31f1585324”,“addresses”:[{“diversifier_index”:4,“receiver_types”:[“p2pkh”,“sapling”,“orchard”],“address”:“utest1ycg5ncs8djy6q7vtkgdmp72k7fsg9eu6xhlfgxxy078fxz0f9kmwr24ptgkyke0wzy2ajwda5k86p354pq0dnrrqatrtycjv5akz7hzlmrl0kjfdepkypc4232uzw75syda4hhr4hxxquehumczacfq9qzc8x4m4dff99s7mr6uqs9humt8gg3teqkkrmkcjeq8ztjsnfjr8umawlzg”}]}]}],“error”:null,“id”:“curltest5”}

This looks normal: tm, ztest, and utest1 accounts returned.

lightwalletd part:

  1. start lightwalletd

./lightwalletd --no-tls-very-insecure --zcash-conf-path ~/.zcash/zcash.conf --log-file /dev/stdout --rpcuser XXX --rpcpassword YYY

Just let lightwalletd use the default /var/lib/lightwalletd directory

lightwalletd returns logs no errors and as expected there are many many getblock and getbestblockhash entries visible; tail -f ~./zcash/testnet3/debug.log

zecwallet-cli part:

  1. Create new wallet and addresses

./zecwallet-cli --server 127.0.0.1:9067 addresses;

u1 address is returned NOT utest1 address as expected

Creating a new wallet

{
“ua_addresses”: [
“u1xxxx…” ← expected this to be utest1 ???
],
“z_addresses”: [
“zs1xxx…” ← expected this to be ztest1xxx… ???
],
“t_addresses”: [
“t1Ve15QhKXK2a2WZuLiPCn2caJTcEiEvXF2” ← This to be tmxxx… ???
]
}

  1. run zecwallet-cli in interactive mode

./zecwallet-cli --server 127.0.0.1:9067

Lightclient connecting to http://127.0.0.1:9067/
status: Unknown, message: “-5: Invalid address”, details: , metadata: MetadataMap { headers: {“content-type”: “application/grpc”} }
Ready!
(test) Block:2223020 (type ‘help’) >>

The prompt indicates “test” which leads me to believe that zecwallet-cli is on testnet and communicating with lightwalletd which is on testnet because lightwalletd is communicating with zcashd which is confirmed to be communicating on testnet.

There is an “Invalid address” error because the newly created zecwallet-light-wallet.dat is populated with mainnet addresses at step 6. In step 6 in this formula testnet address should be expected???

What do you think? Stumbled on a problem?

Dennis

I havent gotten any test coins yet to see if theyre valid or not

I just can’t seem to generate utest addresses using the zecwallet-cli. I “think” I’ve confirmed that zecwallet-cli is not behaving as expected in the steps above.

If you think, @Autotunafish, that I have confirmed it I’ll add an issue on github.

1 Like

Ok zingo cli will work, I changed that line first to the internal server

You should add the issue though currently the project is transitioning ownership and there hasn’t been any work done on it for a little while

Verify the the faucet works!


Yeah crawling around through the zecwallet light code it only ever seems to specify mainNet everywhere I can’t find where that option is nested right now. Anyways zingo for the win!

2 Likes

Will do. I’ll try to get that issue opened little later today or tomorrow AM.

1 Like

New issue #113 filed at github

1 Like

You can hop onto https://matrix.org/ and there’s a pretty vibrant community that will rapidly get you up and running with zingo-cli.

1 Like

Thanks @zancas I will check it out.

Inside the zcash ecosystem what software is considered the “reference implementations” for various functionality?

I had hoped to use the zecwallet-cli for some integration testing tasks - just wrapping it a Staeful k8s pod until we can make an internal design decision - but, as above, I ran into some issues using this implementation on testnet. I got a bunch of help from @Autotunafish (Thank you very very much, BTW!) but now I’m kind of wondering if I had simply started down the wrong road by selecting the wrong project for wrapping/mocking some capabilities via a few cli interactions.

Are the zecwallet repositories the RI for wallets connecting to lightwalletd?
Or, has zecwallet-cli been supplanted by zingo-cli?
Or, is there a completely different RI project with which I should have started?

And, more generally will zcashd be ultimately be supplanted by a zebra/lightwalletd combination? Will zebra “fold in” lightwalletd capabilities? From here in the cheap seats splitting wallet and chain operations seems to make sense. But, I (we) have been building our application around the REST calls available zcashd where we’ve been exploring incorporating zec.

Dennis

1 Like

Full nodes <-> lightwalletD <-> lightwallet like zingo cli or zecwallet lite cli.
For interfacing directly with the full node there are less options mainly because the ligjtwalletD model was chosen over the fullnode “companion” model which zecwallet fullnode made use of. There just hasn’t been as much deveolpment there since lightwallets came out.
Zecwallet fullnode is a gui (looks just like zwl) and should still work if you start zcashd manually (I’ve heard and have seen pics but my personal experience is no-go). For testnet? Not sure if it will produce the incorrect addys like how zwl did but maybe.
Zenith is a good fullnode zcash-cli interface that makes using the zcashd internal wallet much easier. For testnet? I’ll have to look but I think it does more of what youre looking for. I made one called zclimate as well. Theres was also a web ui one based on cockpit but idk if it still works. Its kind of roll-your-own still with some of that stuff.

There’s a regex match here at line 340 that looks like it could maybe (?) cause an issue but it looks like everything else the program does is specific to just what it gets from the wallet without discerning networks and assuming the json input and output formatting is the same then it might work. @pitmutt whatdya think?