Top Polygon NFT Collections

A straightforward NFT query and API.

Which Polygon NFT collections have the most transactions in the last 30 days?

Step 1: Select the table(s)

We must first locate what table has the data we need. The nft.polygon_trades table has the information we want, including transactions, collections, and time.

Step 2: Find the answer

The SQL query should look like this:

  COUNT(DISTINCT tx_hash) AS number_of_transactions,
  COUNT(DISTINCT buyer) AS number_of_buyers,
  SUM(amount_usd) as volume,
  coalesce(collection, nft_contract_address) AS label
FROM nft.polygon_trades
WHERE data_creation_date >= CURRENT_DATE - INTERVAL '30' DAY
ORDER BY number_of_transactions DESC

Unfortunately, not all collections have a collection name. We use the coalesce function to search first for the collection name, and if it does not exist, we can display the contract address.

We also grab the sales volume and the number of buyers. This gives us the ability to compare the number of sales with the number of buyers (signalling if NFTs have been traded between the same wallets many times).

Step 3: Explore the results

Once we run the query, we can see the results in a table view. At the time of writing, the top NFT collection on Polygon, based on the most transactions in the past 30 days, is NFT1.

Step 4: Create an API to access query results

Next, we can create an API to surface this data wherever we want, including your own applications or dashboards.

And that’s it! Creating the API takes one click, and it’s ready! You can choose what you want to index and how often you want the API to refresh.