Design question - finding resource owner


I started to play with Flow and Cadence and need some help understanding the architecture.

I want create NFTs of type NoobieNFT and give it away to my friends, who will in turn give it to their friends etc.
At any given point of time I would like to check who’s the owner of a specific NoobieNFT. If my understanding is correct, resources (like NoobieNFT) can’t have a unique address so the best I can think of is:

  1. assign a unique ID to each NoobieNFT
  2. emit event whenever someone passes on NoobieNFT
  3. have an external application that tracks the events that were emitted and knows who has which NoobieNFT. Alternatively I could scan entire blockchain for the NoobieNFT transfer event and search for the ID that I’m interested in each time I want to know, but it sounds like it could be a very slow operation.

Is this approach feasible?

Another option inspired by the discussion here: Keep a decentralized database of all NFT ever minted

could be maintaining a dictionary ID → account within the blockchain. Would it be an antipattern (and if so - why)?

Every resource has a unique ID. It is available through the uuid field.

In addition, every resource also has an owner (the account in which the resource is stored, if any). It is available through the owner field.

You can read more about it in the language reference:


Thanks for pointing out that resources already have a unique ID.

Just in case I’m missing something obvious… is there a way to find and access a resource by its id, without externally tracking the address of the account that currently owns it?

Your initially proposed approach is the right way to go about it (specifically: tracking the events). If you don’t want to do all the event monitoring yourself, there are also third party event monitoring providers such as that can simplify this :slight_smile: