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