Author: Pothu
Source: Twitter
Dune Analytics is probably one of the best tools for finding real-time data for free. There are thousands of free dashboards that display different encrypted data. Using Dune correctly, this data can give you a hand in the crypto market.
Dune Analytics makes it easy to view and understand on-chain data.
In this guide, I'll cover:
• Community Dashboard
• Extract data by query
• Create visualizations
• Create your own dashboard
1. Community Dashboard
The easiest way to use Dune is to look at the dashboards other people have created.
You can search for a specific dashboard and filter it using tags like DeFi, NFT, and Ethereum.
If you're looking for information about a specific item, the best way to do that is to look at other Dune users' dashboards and ask.
For example, to view all available Uniswap dashboards:
Let's take a look at the DEX metrics dashboard created by user @hagaetc. We can see some useful statistics about the DEX. There are also some charts and visualizations related to DEX volume and market share.
You can select an individual query in the dashboard to view detailed information about that query.
Let's look at the market share:
Now we can see details about the query. We can see the PostgresSQL code for the query. We can also see the views associated with the query.
You can run queries on the dashboard to get updated metrics. You can also fork the control panel. Forking will allow you to edit the query and fine tune it according to your requirements.
2. Extract data by query
Dune aggregates blockchain data into a SQL database. SQL is a common database system. This is a popular tool. Many large companies use it.
Users can query on-chain data using PostgreSQL (a simple coding language that allows you to access SQL databases). Here are some PostgreSQL basics:
SQL databases are divided into rows and columns (just like a spreadsheet).
Each row represents a different data record. For DEX, different lines can be Uniswap or Curve.
Columns are data values of a particular type, such as price or quantity.
Each query returns rows or columns of data.
Query columns are most common when creating visualizations.
Most queries are of the form:
With SELECT, we select some data from a table (collection of data) (here, we are selecting "columnName").
For Dune, each table contains information about a project, protocol or chain.
Alternatively, we can specify a LIMIT. This limits how many rows or columns are returned.
We can also specify conditions using WHERE. Only extract data records that meet the criteria.
It's basically a filter.
A common use of this function is to specify a contract address.
Note that names and values are case-sensitive in PostgresSQL.
Let's look at a simple query.
We will look at the DEX volume query over a 7-day period.
The query extracts the usd_amount column from the dex."trades" table.
Then, it applies the operation to the columns we selected.
It adds all the values in the column together.
Then convert it into billions. AS is used to specify a variable name for this value.
We narrowed down the data extracted by the query. Only last week's transactions are considered.
AND is used to specify the condition of the chain. Here, the second condition is the transaction category.
DEX transaction records only.
In a nutshell, this query is looking at the USD-denominated trading volume of all DEXs for the last week.
These are all added together, converted to billions, and shown as a single figure.
It's useful to know how queries work, but you'll rarely build them from scratch.
Often, you fork someone else's query and edit it.
Dune also keeps a summary list (custom table). These summaries give users access to more complex SQL operators.
All summaries are stored in a GitHub repository.
A repository is a huge collection of SQL scripts from which you can build a large number of scripts.
Here is the link to this repository:
https://github.com/duneanalytics/abstractions
PostgreSQL is really popular and offers a lot of good resources.
You can start by studying the official documentation:
https://www.postgresql.org/docs/12/index.html
3. Create the visualization
Query results are often difficult to analyze. Visualizations present query results in a way that is always intuitive and understandable.
Dune offers several visualization options:
• bar chart
• Area chart
• Scatterplot
• line chart
• pie chart
• Chess pieces
For a given query, you can create a visualization or edit an existing visualization. Let's look at monthly DEX volume queries by project.
It has two visualizations: bar chart and table. You can toggle these views by clicking on them.
You can also edit views here.
When creating a visualization, you can choose from several options.
Let's create a pie chart showing market share.
Now we edit the chart options.
The options below mean that we are creating a pie chart where each section represents transactions in USD for the project.
In the resulting visualization, we can see the market share of different DEXs over the specified time period.
This can be extrapolated. By changing a few variables, we can see the smart contract transaction volume on different chains.
As such, Dune has endless possibilities.
4. Create a custom dashboard
A dashboard is a set of queries.
By jointly selecting and displaying related queries, you can gain a better understanding of a project, protocol, or ecosystem.
If you already have queries, creating a custom dashboard is easy.
To get started, head to the Dune homepage and click on "New Dashboard":
From here, you can name your control panel and create a custom URL.
By default, the dashboard is public, but pro users can limit who can view their dashboard.
Click Edit, then click Add Visualization.
You can choose to add queries you create as well as queries created by other users.
I added some visualizations to the dashboard.
I created a dashboard to give you an overview of the Ethereum NFT market.
Dune makes the data on the chain open to everyone. You can do a lot of things with Dune. It's also a great collaboration tool. Dune can quickly create powerful visualizations.
Learn to use Dune well, combine the correct queries, and you can also become an expert in data analysis on the chain.