To quickly and specifically answer your questions:
- you do not have to redeem NFTs
- you do not need a voucher or anything similar
- you can use the ReadApi to see what compressed NFTs an address owns (or even check an entire collection's owners)
With compressed NFTs, you will have to use an RPC provider that supports the new Digital Asset Standard Read Api (ReadApi for short). The ReadApi adds extra RPC endpoints you can send requests to in order to get tons of information on NFTs (both compressed and traditional/uncompressed NFTs). But these "extra" RPC endpoints won't work on non-supporting providers.
Right now, a few common providers have support. Like Helius, Triton, and SimpleHash.
You can use the ReadApi playground to see the current RPC methods available and the data you can get from them.
For your use case of trying to do some token gating, I would use either the
getAssetsByGroup endpoints on the ReadApi. These will return a list of assets that you can parse and determine how you want to set the access restrictions for your app.
An example asset response might look like this:
I would also recommend paying special attention to these values:
id - (aka
assetId) this is effectively your compressed NFTs address. sort of. see below.
grouping - can tell you the collection address that the NFT belongs to. The collection address will be the
ownership - gives you the NFT owner's address (and also if the NFT has delegated authority to another address)
compression - tells you if this NFT is actually using compression or not. This will also give you the
tree address that is storing the compressed NFT on chain. This could be useful for token gating, but would depend on your implementation.
NOTE: Some of the values will be empty if the NFT is not a compressed NFT. (such as many of the
compression fields). So keep that in mind.
If the asset returned is a traditional/uncompressed NFT, this value will be the actual NFTs address viewable via an explorer.
If the asset returned is a compressed NFT, the value is NOT an actual account. It is the leaf node's label within the tree. Due to how merkle trees work, this "address looking value" is not viewable using an explorer the same way a regular Solana address is.
The two are not the same. Once explorers add better support for compressed NFTs, I'm sure we will be able to better explore compressed NFTs.
(PS: this was written in March of 2023)
Example of these more useful data fields:
PS: This is from a devnet collection, tree, and NFT. You could lookup the account addresses on an explorer if you want.
Checkout this demo repo and code examples
You can also checkout this demo repo on the Solana Developers GitHub:
It has a bunch of example code on how to do quite a bit with compressed NFTs, and lots of comments to explain things throughout the files.