Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

TestNet addresses are NOT created #113

Open
gesker opened this issue Feb 9, 2023 · 1 comment
Open

TestNet addresses are NOT created #113

gesker opened this issue Feb 9, 2023 · 1 comment

Comments

@gesker
Copy link

gesker commented Feb 9, 2023

Current Behavior

Mainnet addresses generated instead of Testnet when communicating with lightwalletd where lightwalletd is communicating with zcashd where zcashd is configured to operate and communicate on testnet.

Expected Behavior

Creattion of zecwallet-light-wallet.dat and TESTNET addresses when zecwallet-cli is run for the first time.

Steps to Reproduce

zcashd part:

1. remove ~./zcash/testnet3 (start from scratch)
2. restart zcashd
3. confirm that ~./zcash/testnet3 is recreated including the files one would expect to see e.g. see wallet.dat. *.log, blocks, etc.
4. wait for synchronization 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

the last curl rest call (id:curltest5) returns:

http://127.0.0.1:18232
{"result":[{"source":"mnemonic_seed","transparent":{"addresses":["tm..."]},"sapling":[{"zip32KeyPath":"m/32'/1'/2147483647'/0'","addresses":["ztestsapling...","addresses":[{"diversifier_index":4,"receiver_types":["p2pkh","sapling","orchard"],"address":"utest1..."}]}]}],"error":null,"id":"curltest5"}

This looks normal as tm, ztest, and utest1 accounts are returned and in conjunction with logs at ~./zcash/testnet3/debug.log confirms zcashd is properly configured and operating on testnet.

lightwalletd part:

6. Launch lightwalletd

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

Note: just letting lightwalletd use the default /var/lib/lightwalletd directory as lightwalletd was not started using the --data-dir switch.

lightwalletd launches without error, no errors or warnings are reported in the logs, and as expected there are many getblock and getbestblockhash entries visible in the zcashd testnet logs; tail -f ~./zcash/testnet3/debug.log.

The appended getblock and getbestblockhash entries in ~./zcash/testnet/debug.log seems to confirm that lightwalletd is communicating with testnet via zcashd.

zecwallet-cli part:

6. Initialize zecwallet-light-wallet.dat

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

At this step is where the errant behavior is first visible as this command returns u1/zs/t1 addresses and does NOT return tm/ztest/utest addresses as expected.

Note: New zecwallet-light-wallet.dat file was created at ~./zcash/testnet3

Creating a new wallet
{
  "ua_addresses": [
    "u1..." <- **This should be utest1... ???**
  ],
  "z_addresses": [
    "zs1..." <- **This should be ztest1... ??**
  ],
  "t_addresses": [
    "t1..." <- **This should be tm... ??**
  ]
}

7. Run zecwallet-cli in interactive mode to confirm communication on testnet

./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 is a UI indicator that zecwallet-cli is confirmed to be communicating on testnet by communicating with lightwalletd which is also confirmed to be communicating on testnet as lightwalletd is communicating with zcashd which is confirmed to be communicating on testnet as above.

There is an “Invalid address” error in Step 7 because the newly created zecwallet-light-wallet.dat is populated with mainnet addresses at Step 6 above. In Step 6 in this procedure testnet address should have been generated.

Environment

  • Debian Bullseye
    • Linux 5.10.0-21-amd64
  • Zcashd 5.3.2
    • 5.4.0 had been released as of this report but was not yet in the apt repository
  • lightwalletd
    • branch: Main
    • hash: 07fd6a966a136a751b37b8c54a6679499def0caa
  • zecwallet-light-cli

Comments

Had some help working this issue from Autotuanfish in the Zcash Forums and it was concluded that this is errant behavior.

@danielvladco
Copy link

Is there any progress on this issue or is there an alternative wallet for testnet?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants