Complete Guide: Analyzing the Top 10 Ethereum NFTs Using Dune API

In this tutorial, we’ll explore the digital landscape of Ethereum NFTs by volume using Dune.

Dune is a powerful platform that enables users to access and analyze blockchain data through custom SQL queries. In this tutorial, we’ll explore the digital landscape of Ethereum NFTs by volume using Dune. You’ll learn how to create, execute, and visualize a custom SQL query on the platform, followed by using a Python script to pull and further visualize that data.

Preparing the Field

Ensure you have Python and access to Dune. Create and safely store an API key, as it’s the passport to this data journey.

You can download or clone the project from here: GitHub repository

To run the script, you will need to install the following dependencies:

  • dune-client: A Python client library for interacting with the Dune API.
  • dotenv: Loads environment variables from a .env file.
  • seaborn: Python visualization library based on matplotlib.
  • matplotlib: Python plotting library.
  • pandas: Data manipulation and analysis library.

pip install dune-client python-dotenv seaborn matplotlib pandas

Crafting a Custom SQL Query on Dune

Before we dive into the script, we need to create a new query on Dune:

Step 1: Create a New Query

Log into your Dune account and navigate to the “Queries” section. Click on “New Query.” 

Step 2: Paste the SQL Code

After creating a new query, paste the SQL code into the text area. 

Step 3: Fullscreen View for Better Editing

Click on Fullscreen to have a better view of the SQL query editor. 

Step 4: Set up the Date Parameters

Adjust the Start_Date and End_Date parameters to define the date range for your analysis. 

Ensure the date format is correct by using the calendar tool under the Date parameter. 

After setting the parameters, click on Save to store your query. 

Step 5: Save and Execute Your Query

To execute your saved query, click on Run. This will process your SQL code and return the results. 

Step 6: Check the Visualization

View the results produced by your query in the Table View. You can create additional visualizations like bar charts or line charts as needed. 

Step 7: Create an API Endpoint

Click the API icon to access code snippets for API integration, allowing for programmatic query access.

Choose Python as the programming language to fetch the query results using the API. 

Understanding the SQL Query

The SQL query is a set of instructions that tells Dune what data we want to gather from the Ethereum blockchain. It’s like a shopping list for data. We use this list to get information from a table called nft.trades, which records every NFT sale.

In this list, we are asking for things like the name of the NFT collection, how many times NFTs from that collection have been sold, and the total amount of money these NFTs have brought in, both in USD and Ethereum’s currency, ETH. We make sure to skip over any data that’s not useful, like sales from addresses that aren’t actually selling NFTs we’re interested in. Our list also asks to arrange our final information so that the collections with the highest sales come out on top.

For more details on how to build SQL queries in Dune, check the official documentation on SQL Query Syntax.

Data Tables Demystified

Dune structures blockchain data into tables that can be queried using SQL. The nft.trades table is particularly useful for our analysis as it contains detailed information about each NFT transaction, such as the contract address, the timestamp of the trade, and the amount paid in both cryptocurrency and USD.

When querying nft.trades, we are essentially sifting through all the recorded NFT transactions on Ethereum to find those that are most relevant to current market trends. By carefully selecting and aggregating data from this table, we can identify which collections are currently leading the market in terms of trading volume.

Find out more about the data tables in Dune Documentation.

The Python Script: Your Data Shovel

Let’s turn our attention to src/ This script is where you call upon the SQL query you've saved in Dune.

The flowchart below outlines the process of the Python script designed to retrieve and display Ethereum NFT data from Dune, starting from loading the API key to graphing the trading volumes.

Loading the DUNE API Key

Place your API key in the dune-api-key.env file like so:

Securely retrieve your Dune API key from the .env file:

Connecting to Dune with the Client

Create a DuneClient instance using the API key to facilitate our data requests:

Executing the Dune Query

Run the Dune query by passing in the parameters entered by the user:

Interacting with the User

Ask for the date range from the user, ensuring the format is correct and the end date is after the start date:

Visualizing the Data

Use Seaborn and Matplotlib to craft visual representations of the data for both USD and ETH volumes:

Horizontal bar plot showing the top 10 NFT collections by USD volume:
Horizontal bar plot showing the top 10 NFT collections by ETH volume

This visual arrangement helps in quickly identifying leaders in the market and comparing relative sizes.

For the 1st January to 29th March 2024 period (89 days), the visualizations of top NFT collections by ETH and USD volumes reveal a diverse and dynamic market. Bored Ape Yacht Club notably leads in both, signaling strong market presence. Collections like LilPudgys and Milady exhibit higher USD rankings, hinting at variable ETH prices or collection-specific demand dynamics.

The variety in the top 10 indicates a robust market with multiple successful entities and investment avenues. Discrepancies between ETH and USD rankings could reflect underlying economic factors or specific collection events, offering investors a nuanced view of market movements and potential strategies.

Overall, these charts illustrate the vibrant ecosystem of NFT trade, marked by brand recognition and diverse collector interest.


After going through this tutorial, you now know how to use Dune to query specific NFT data and how to turn that data into easy-to-understand charts. This is a handy skill because it means you can now spot trends and see which NFT collections are getting the most attention. For more tutorials and documentation on using Dune, visit: Dune Documentation.

This guide was created by Dune community Wizard, Toufik Bahammou. If you would like to contribute to Dune blog, please contact [email protected].

Ready to bring your Blockchain to Dune?

Schedule a call with our partnership team to learn more about the best option for your chains

Dune Catalyst

Integrate your blockchain and tell your story.

Ready to get started?

Individuals + Small Teams

Create and explore queries, dashboards and trends with 500,000+ data analysts.


Tailored solutions designed for the largest crypto teams and premier organizations.