Get up and running with Dune Analytics quickly – learn how to write queries, construct data visualizations, and more!

⚡️ What language is Dune Analytics in?

Fortunately, Dune is compatible with the PostgreSQL standard query language. Even if you've never written SQL before, it's simple enough to use. The most useful place to start is with dashboards and queries created by others, as they often contain more information than your own code.

⚡️ Does dune Analytics have a token?

No, Dune Analytics does not have a token as of now. The company focuses on providing the best cloud-based analytics platform for its users, so tokens are not necessary for their business model. However, the team is open to exploring different options in the future that may involve a token.

⚡️ What cryptocurrency is not tracked?

The notion of anonymity and privacy has long been linked with bitcoin and other cryptocurrencies. The original 2008 white paper that introduced blockchain technology through bitcoin promoted the concept of technological invisibility.

https://youtu.be/S-cctFmR828
How Dune Analytics Works

With Dune Analytics, exploring Ethereum data has never been easier! Extracting, searching and creating visuals out of immense amounts of blockchain information is a breeze. This article will show you just how simple it can be to discover the facts you need – the possibilities are virtually limitless! You'll wonder why you ever used another resource for your blockchain research.

Where does dune Analytics get its data from
Is dune Analytics free?

All information may be found in public blockchains like Ethereum. All you have to do is look for it. So far, answering questions such as the project's user count or daily DEX volume through a specialized program would most likely be required. Running the script will entail going through the blocks, evaluating the data, correctly sorting it, and extracting the answer to the question.

Dune Analytics makes studying data easy by letting you write SQL queries that are automatically run on their servers. The data is then straightforward to see in graphs, which allows you to discover valuable insights quickly.

Does dune Analytics have a token
With Dune Analytics, users can now easily access and interpret data from the Ethereum blockchain.

Accessing data from a large collection can be quite arduous and time-consuming. Although scripts tend to retrieve information related to one specific project, if you want the same results across multiple projects, it may require some modifications on your end.

Dune Analytics is a straightforward way to access Ethereum data. With its pre-built databases and web-based platform, extracting information from the blockchain has never been easier. Whether you need raw facts or statistical analysis of cryptocurrency transactions, simply query with Dune and obtain your desired results in no time!

To the rescue comes Dune Analytics

Dune Analytics is the ultimate tool for swiftly extracting data from Ethereum. It's a user-friendly web platform that offers prebuilt databases to simplify your search and make it easier than ever to unlock the power of the blockchain!

What is dune Analytics and how does it work
Dune Analytics guide

This tutorial teaches you how to search, write, and visualize basic queries in Dune so that you can go from zero to blockchain expert in a matter of minutes. Even if you've never written SQL before, a few simple examples will suffice.

How does Dune analytics work?

Dune analytics unifies raw data from the blockchain into SQL databases that may be readily examined. For example, there is a table for examining all Ethereum transactions, which are neatly divided into columns. The sender, recipient, and amount are examples of the columns.

DeFi Deep Dive - Exploring Dune Analytics
Does dune Analytics have an API?

After a few minutes, the data from the blocks is processed and input into the Dune database. In addition to raw blocks and transactions, Dune also contains asset price information and specialized tables such as all matching addresses for the UNI token

Let's hone our skills even further and explore how we can harness the power of Dune without coding, while also brushing up on essential SQL capabilities.

Don't wait any longer, take charge and get started with Dune Analytics today!

Once you open your account, this is what the homepage will look like:

how to use dune analytics
What is dune cryptocurrency?

The first thing you'll see is a list of all the available databases. Currently, Dune supports four:

  • Ethereum Blocks
  • Ethereum Transactions
  • Uniswap V21 Events
  • Kyber Network Proxy Trade Events

Each database is essentially a SQL table. To write queries, you must select a specific database to use. We'll be using the Ethereum Transactions database for this tutorial.

How is data analytics changing the world
What are Ethereum traces?

Upon selecting your database, you will be directed to the query builder. Therein lies a powerful tool that allows you to construct SQL queries with ease–so much so that even visualizing data does not require any knowledge of SQL coding!

On the left of the query builder is a list of all available database columns – ready for you to use in order to filter, group and sort your data. Make sure to take advantage of these powerful tools and get better insights into your datasets!

As you navigate the query builder on the right side of your screen, take a peek at its generated output. By default, Dune will display up to 100 results for each search inquiry!

If you're eager to access all of the results from your query, simply hit the “Download” button. This will download everything in a CSV file for future reference.

What is dune analytics tutorial used for
Where does dune Analytics get its data from?

Make your data come alive by clicking on the “Visualize” button. Dune offers two types of user-friendly visualizations, line and bar graphs, to help you gain insights from your data in an instant!

If you're looking to illustrate data that is continuous, line graphs are the ideal way to go. On the other hand, if your goal is to showcase discrete values like counts or categories, utilize bar graphs for optimal results.

Once you've chosen the ideal visualization for your data, tailor it to fit your needs with a few clicks. Customize the x-axis and y-axis, as well as adjust its color palette and title; everything is in reach!

What language does dune Analytics use
Is dune Analytics free?

When you have created the visualization to your desired effect, simply click “Save” and it will be stored for later use.

Now that you have a grasp of the fundamentals of how Dune operates, let's explore how to pen SQL queries.

Crafting SQL Queries to Drive Success

Structured Query Language (SQL) is a vital programming language used to communicate with databases and retrieve data.

Does dune Analytics have a token
What is dune's cryptocurrency?

Queries

If you're unable to find the answers you need from fellow Dune users, why not take matters into your own hands and create custom SQL queries to obtain solutions?

Before we start crafting any queries, gaining a complete understanding of the structure of a database is absolutely essential. In Dune, each database can be divided into tables with specific names and columns that house the data.

As an example, Ethereum Transactions holds a ‘transactions' table containing sender/recipient/amount info for each and every transaction registered.

What is dune Analytics used for
What language does dune Analytics use?

In order to collect data from a table, the SELECT statement is employed. As an example, if we need to choose all deals in the Ethereum Transactions database, then this query should be written:

Retrieve all data from the transactions table.

The asterisk (*) symbol is a wildcard, which stands for “all.” In other words, this query states: “Retrieve all columns FROM the transactions table.”

If we only desire to pick specific columns, simply provide the column names instead of using an asterisk symbol. For instance, if you only wish to select the sender, recipient and amount from every transaction record then your query would appear as follows:

Where does dune Analytics get its data from
Does dune Analytics have an API?

Utilizing the transactions database, I am able to pull information regarding senders, recipients and amounts of payment.

By leveraging the WHERE statement, we can easily filter our data. Suppose that we need to identify transactions with a value more than 100 ETH – then all you have to do is create the following query:

Retrieve all records from the transactions table where value is greater than one hundred quadrillion.

Using the “greater than” sign (>) indicates that a query is asking for data from the transactions table wherein the value surpasses 100 ETH.

To arrange our data, we can employ the ORDER BY statement. For example, if we need to view transactions with the biggest values first, then this query would do:

Querying Solana data in Dune Analytics
What is dune Analytics used for?

SELECT * FROM transactions ORDER BY value DESC

The ORDER BY statement sorts the data in ascending or descending order. The default is ascending, but we can use the keyword DESC to sort in descending order. So this query is saying “SELECT all of the columns FROM the transactions table ORDER BY value in descending order.

What language does dune Analytics use
Where does dune Analytics get its data from?

To view just the first 100 results, we can take advantage of the LIMIT statement. For example, to limit our query to only 100 records, type this command:

Retrieve the first one hundred rows of data from the transactions table.

This query is requesting all columns from the transactions table, with a max limit of 100 records. Great, now that you've got the basics of crafting SQL queries down pat, let's delve into how to utilize them in Dune.

Using SQL Queries in Dune

Are you keen to start crafting a SQL query in Dune? Just open the Query Builder, type your code into the text box, then hit “Run Query”. In no time at all, watch as your command springs to life!

”If your query is valid, you'll see the results in the table below. You can then click on the “Visual

Does dune Analytics have a token
What is dune's cryptocurrency?

Queries that are a little more difficult

that Dune data is only as reliable
Dune Analytics offers a paid service, too.

Now that you know the basics of writing SQL queries, let's learn how to write slightly more complex queries.

SELECT * FROM transactions

WHERE value > 1000000000000000000

AND to_address = ‘0x315e27aA99F682924Ae21CfD2281c682bC16E790′

This query is saying “SELECT all of the columns FROM the transactions table WHERE the value is greater than 100 ETH AND the to_address is 0x315e27aA99F682924Ae21CfD2281c682bC16E790.”

To view blockchain data, head to dune.xyz.
Dune doesn’t store the blockchain’s state data itself

To uncover the information you need about a certain address, check out the “Address” table for further details.

SELECT * FROM addresses

This statement is requesting to pick all the columns from the addresses table with an address of 0x315e27aA99F682924Ae21CfD2281c682bC16E790.

The “Blocks” table can be your go-to resource for discovering additional information about any particular block.

SELECT * FROM blocks

Example of a selected graph from a dashboard
Starting with Dune Analytics

WHERE number = ‘8943592′

This query is saying “SELECT all of the columns FROM the blocks table WHERE the number is ‘8943592′.

Data Visualization

Dune can turn your data into a visual feast with an impressive selection of line, bar and pie charts. Showcase your key findings in the most stunning way using our comprehensive suite of visualization options!

Visualizing the data
Dune Analytics has a powerful way to visualize it

To create a spectacular visualization, begin by choosing the type of visual that you desire. Subsequently, pick out the data to be represented in this graphic.

To create a line chart that displays the value of all transactions, we must select “Line Chart” as our visualization type and “Value” as our data.

Once your data is chosen, click the “Visualize” button to craft an awe-inspiring visualization!

dune analytics nft is particularly useful
How do you use Dune Analytics?

If you need to make adjustments, simply hit the “Query” button; if it's all complete and ready to be preserved, tap on the “Save” button.

There are several visualization types to choose from
Slightly more advanced queries

Limitations

  • While Dune is a robust tool, it has certain boundaries. Specifically, the only type of database compatible with this software is SQLite – therefore your Ethereum data must be exported to an SQLite database prior to being used in conjunction with Dune.
  • Although Dune's supported SQL commands are limited, the most frequently-used ones are all available. You may not be able to perform each activity that you could with a full SQL program – yet you'll still have access to those commonly used functions.
  • Ultimately, there are certain data types that Dune cannot visualize. This could limit your capabilities to make the most of whatever data is queried.
Ethereum Gas Prices Dashboard
The source of Dune’s power is its community

What's next?

Now that you have a basic understanding of how Dune works, it's time to start utilizing it to dive deep into Ethereum data! In the upcoming section, we will be exploring how you can transport Ethereum details directly into an SQLite database and easily use Dune with all your acquired information. Keep up with us—you won't want to miss out on this amazing opportunity!

Exporting Ethereum data to an SQLite database

Unlock the potential of Dune by first exporting all your Ethereum data to an SQLite database. You'll need a dedicated tool for this task and you can rest assured that it will be both secure and efficient.

When it comes to exporting Ethereum data, Parity's SQLite exporter is the number one choice for users. This effective tool quickly converts information into an easily accessible SQLite database that can be utilized at any time. With a few simple clicks, you're able to export your most valuable data with confidence!

dune analytics nft app after sign in
Starting with Dune Analytics

Ready to get started with Parity's SQLite Exporter? Download and install the software then refer to instructions located in the “Exporting Ethereum Data” section of Parity's documentation. You'll be up, running, and exporting data in no time!

With Parity's SQLite exporter enabled, you're ready to transfer your Ethereum data. All that's necessary is a pinpointing of the destinations for both your Ethereum files and the target SQLite database. In no time at all, you'll be able to move forward with exporting your information!

Looking to export data? Head over to the “Exporting Data” section of Parity's documentation, where you'll find all the instructions needed.

Congratulations! Now that your Ethereum data is exported to an SQLite database, you are ready to begin working with Dune. In the following section, we’ll discover how to compose queries in this powerful platform. Get excited – let's go!

Writing queries in Dune

Now that you have your Ethereum data exported to an SQLite database, you're ready to start using Dune! In this section, we'll learn how to write queries in Dune.

dune analytics coin to the rescue
Dex Volume percentage (source)

Are you already familiar with SQL? If so, Dune's own dialect-SQLite Query Language (SQLiteQL)-should feel similar. Yet, it has distinct components that must be kept in mind when requesting data from your databases.

dune analytics nft introduction tutorial
Dune Analytics is a powerful tool for blockchain
  • One major distinction between SQLiteQL and other databases is that it requires case-sensitivity, so be cautious when authoring your queries to ensure they are in the correct upper or lowercase format.
  • When comparing SQL to SQLiteQL, one of the key distinctions is the syntax used for comments. Instead of a single ” — “, like in traditional SQL, you'll need to use “/*” at the beginning and “*/” at the end of each line when making comments with an SQLiteQL file.
  • A major distinction between SQL and SQLiteQL is the syntax for strings. While single quotes are used to identify strings in an SQL environment, double quotes must be inserted into a SQLiteQL string instead.
Dune Analytics is a powerful tool for blockchain
Dune Analytics is a powerful tool for blockchain

Now that you know the basics of how to write queries in SQLiteQL, let's try writing a few queries!

Adding Optimism to your gas fees

Power users of Perp will want to closely monitor the gas fees associated with Optimism.

Thankfully, we can use a chart to display the average gas prices for different trade executions and positions, as well as comparisons to regular ETH transfers and trading on Uniswap v3. We can accomplish this by mimicking msilb7's query and adding our own variation. We edit the code to get a longer-term view of gas fees over the past 5 months, only including trades on Perp, Uniswap, as well as ETH transfers. We can save the query and add data charts for gas fees in ETH and USD to our dashboard.

Using SQL Queries in Dune
Using SQL Queries in Dune

You can add your Trader PnL and Funding Payments by following these steps:

1. Go to the ‘Trader P&L' tab.

2. Click on the green ‘+ Add Payment button.

3. A pop-up will appear – select whether you're adding a funding payment or a trader p&l, then fill in all relevant details and click ‘Add'.

The Conclusion

By gathering these visualizations, LPs and traders can access all the information found on different Dune dashboards from one central location!

Rahul is a skilled freelance writer specializing in cryptocurrency and an expert in cryptocurrencies, blockchain technology, NFTs, and Web3.