PolygonScan and Web3 API count mismatch

During testing we checked the NFT Owners endpoints for our Polygon contract 0x8f2f3c149bf1cd8d2deb95564ccaedd4a36d2ac7 e.g.

https://deep-index.moralis.io/api/v2/0x8f2f3c149bf1cd8d2deb95564ccaedd4a36d2ac7?chain=polygon&format=decimal

{
    "total": 197464,
    "page": 0,
    "page_size": 500,

However it doesn’t show the same number of tokens as Polygon scan

unnamed (1)

Please advise?

Thanks

I don’t know the real number, now I see a total of 200k+ in our API output

Hi, yes the screenshots were taken yesterday, but our issue still stands, the number Moralis are reporting is still different to what PolygonScan is reporting.

e.g. Moralis is now saying: 200,145 but Polygon scan is showing 199,564, even the transfers number is different.

Please advise

You can try to iterate over all ~200k token ids to see how many it returns that way. You can use cursor for that.

Being your contract, is there a way to get the real number of tokens directly from the contract?

Iterating over all tokens does seem very slow and prone to hitting rate limits which is why we wanted to avoid that.

As it happens we’ve got 3 contracts. So 200k x 3 contracts :frowning:

I run a script in the past for 100k tokens, if you add a delay of 1 second between requests it should be fine. But, yes, it will take some time, few minutes.

That’s like 7 days for 1 sec delay sync at 600,000 calls :frowning: don’t think that’s feasible to run on a regular schedule :joy:

every call will return 500 results, you have to make only 600.000/500 calls

But that assumes the moralis data is accurate right? Which takes me back to my original question.

The polygonscan data doesn’t match the moralis data. So we don’t know what to make of it

I tested now on 0x8f2f3c149bf1cd8d2deb95564ccaedd4a36d2ac7 to iterate over all the pages and I got 199564 unique token ids, same number as in polygon scan

it looks like we have some duplicate data now in those results and that is why that number is bigger then the real number of token ids

Right okay, so we’d need to loop over everything, then run a unique/de-dupe on the data to be more accurate?

In particular for unique token ids, yes. At least for now until we fix it so it is not returning duplicates. We don’t have an ETA for that fix.