I’m working on a project where I need to check if someone owns a specific NFT that was created on the Paras platform. From what I learned in NFT tutorials, I can usually verify ownership by calling a view function like this:
near view my-nft-contract.testnet nft_tokens_for_owner '{"account_id": "user.testnet"}'
However, I’m not sure what contract address to use when the NFT was minted through Paras. Do I have to loop through every Paras collection to find the right one, or is there a direct method to query a specific collection?
My goal is to build a game that only allows access to holders of a particular NFT collection. Any guidance on the correct approach would be really helpful.
paras has an indexer api that’s way easier than direct contract calls. just hit their endpoints to check ownership - you don’t need exact contract addresses. plus you’ll save on gas since you’re not hitting the blockchain every time. i’d cache the results for 10-15 minutes so you don’t spam their api.
Each Paras collection has its own smart contract address - just check the collection page directly. The address shows up in the URL or collection details. No need to loop through everything since they’re all independent.
For game access control, store the specific contract address you want to verify against. Then call nft_tokens_for_owner
on that contract. If you only need to check ownership without all the token details, use nft_supply_for_owner
instead - it’s way more efficient for access checks.
Just remember users can transfer their NFTs after getting access. You’ll probably want real-time verification instead of one-time checks, depending on what your game needs.
Cool project! Quick question - what happens if collections span multiple contracts? Some Paras collections got migrated or split across different addresses.
How often are you planning to verify ownership? Every login or just for specific actions? NEAR network calls could get expensive if you’re checking too frequently.
Have you looked into Paras having an API or indexer? Might be way faster than hitting the blockchain directly, especially for popular collections with tons of holders.
Testing on testnet first? What game mechanics are you tying to NFT ownership? Sounds awesome!