Is `z-addr` to `t-addr` a one-to-one or one-to-many mapping?

After I install the official ZCash client on a brand new Ubuntu machine, I run zcash-cli z_getnewaddress to generate a z-addr, actually it will also generate a t-addr. So a question comes to my mind, is z-addr to t-addr a one-to-one or one-to-many mapping?

I did an experiment, run zcash-cli z_exportwallet and import the wallet, then listed all t-addrs and z-addrs, I got two t-addrs and one z-addr, very weird, why woud there be two t-addrs ?

I continued to import this wallet repeatedly, and then run zcash-cli listreceivedbyaddress 0 true, it always showed two t-addrs and one z-addr, the number of t-addrs did’t grow anyway.

t-addrs get auto created for change addresses and things like that. Creating a new z-addr has nothing to do with how many t-addrs are in a wallet. I’d have to look at the code to see exactly when it makes new ones on its own.

z-addrs and t-addrs are completely independent:

  • zcash-cli z_getnewaddress only generates a z-addr. That is the only way to create a new z-addr in a wallet.
  • t-addrs are pre-generated by the internal Bitcoin mechanics we inherited, and are turned into “active” addresses either when zcash-cli getnewaddress is called, or a new change address is needed.
1 Like

Got it, thanks! Another question, given a z-addr, can I get its t-addr? I guess the answer is NO, since you said “z-addrs and t-addrs are completely independent”

Correct, there is no t-addr corresponding to a z-addr, or vice versa - they are completely separate constructs. In theory one might be able to use the same randomness to get both a t-addr and a z-addr, similar to how BIP32 generates many different addresses from the same seed, but there is no specification for this yet, and anyway is different to your question - that would be getting both a z-addr and a t-addr from a seed, rather than a z-addr from a t-addr.

2 Likes