I would like users to be able to perform a one time action on a web app, i.e. claiming one physical item per NFT owned, what would be the best way to keep track of tokens that have already claimed ownership? I have thought of constructing a list of addresses in the web app code but think this may have security issues. Is it possible to do it in a public way so that users can verify themselves?

Thank you!

2 Answers 2

  1. Integrate with a browser wallet (Nami, ccvault, ...) so users can log in with their wallet on your web-app.
  2. Let the users sign a message to prove they really own the wallet. Check on server side if the signature is correct.
  3. Get all NFTs owned by the wallet from the blockchain. Don't trust the user input here as it could be manipulated. You can run your own node, use https://blockfrost.io or something similar.
  4. Keep track of which NFTs have already been used to claim your physical goods. The address of the owner is not relevant, since the NFT can be sold after redeeming. You can do this in a simple database if you want. Or you could do it on-chain, e.g. by minting a "redeemed" token for each NFT or even updating the NFT metadata (if the policy is not locked yet).

The only two ways would be to keep a database of tokens and their redemption status, or an easier way to do it would be to update a data attribute inside of the NFTs metadata directly. That way everyone can know (even on the secondary market) whether the redemption has been spent or not. This, however, would require an open policy ID.

  • interesting, i had not considered modifying the nft its self, i will definitely be taking a look at this !
    – kannastor
    Feb 11, 2022 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.