How to determine whether I own a diversified address?

I periodically print out QR codes for cryptocurrency addresses. When I do this for ZEC, if I were to use a diversified address, how would I know later by looking at the QR code whether I ‘owned’ that address?

I can send ZEC to it and see if it comes back to me, I guess. But I’m hoping for something more direct.

For example, maybe one of the rust crates out there offer an API that, given a sapling or orchard receiver, can ‘decrypt’ the diversifier to see if it resolves to a diversifier index that I could use to regenerate the address.

If there isn’t an API to do this today, it sure seems like there should be one. Basic wallet functionality IMO should include a view that can tell you whether a QR code you’ve scanned (or a manually input address) is your own, even if it isn’t your default (i.e. ‘undiversified’) address.


I found it – for orchard. The orchard crate includes the IncomingViewingKey.diversifier_index function which can test a given Orchard receiver directs ZEC to the spending authority behind a given incoming view key:
IncomingViewingKey in orchard::keys - Rust (

I’m still looking for the sapling version of the function.

1 Like

This should work (untested):

    ivk.to_payment_address(a.diversifier().clone()) == Some(a);

Dunno if there is something more idiomatic.


The sapling function I found for this is DiversifiableFullViewingKey.decrypt_diversifier:
DiversifiableFullViewingKey in zcash_primitives::zip32::sapling - Rust (

With these two functions (this, and the orchard one linked to earlier) I’m able to detect ownership of any orchard or sapling receiver for a given zcash account.

My pull request to expose these functions in the Nerdbank.Zcash .NET assembly:
Add functions to test orchard/sapling receiver for ownership by an account by AArnott · Pull Request #37 · AArnott/Nerdbank.Cryptocurrencies (

@hanh your approach is surprisingly simple. I think it would work. But the approach I took feels a bit better because I’m using a function designed for the job. And I expose the decrypted diversifier to the caller in case they want it.

1 Like