Dune Analytics and AI to extract data from EVMs

in STEMGeeks12 days ago

image.png

Since we launched GifmeBeer project I have been willing to track the data the project is creating out of the transactions generated on the blockchain. We are using Optimism, an EVM-based blockchain, and a great data tool can be used for that purpose Dune Analytics.

The tool fetches data from the blockchain and creates a database with it, you can use SQL language to search for the data you need and generate a chart with it. Using several charts you can create dashboards.

I am not a coder but I feel familiar with code. A couple of years ago I created my account in Dune and played around to fetch some data, I was testing then, but now, with the real data on GifmeBeer I wanted to have an easy-to-read dashboard to check the results after the actions we do. I knew I would have to go over some SQL language to learn how to create the corresponding Querys but I found a nice surprise that helped me with the job.

First, Dune has many users open queries to look for, so if you search for something similar to what you are trying to accomplish, you might find out the code you need to start with, tweak it a bit, and find the results you are looking for. On top of that, they have added an AI prompt to type what you are looking for and get the query code for you.

It is not perfect, you need to have some knowledge to use it and get the results you are looking for, but it is a great way to start as you do not need to know any code at all and as you learn from other examples, you can end up getting a pretty nice dashboard.

I was trying to get a chart where I could see the total NFTs claimed per token ID on our NFT ERC1155 contract. Here's the first result I got. It seemed the columns had no order at all, but they are sorted by name, only that in the code language, name "12" is smaller than name "2" as it is text not numbers.

image.png

After some college help, I ended up getting the result I wanted, sorting the columns by their Id number

Screenshot 2024-04-27 at 08.22.16.png

After some more research, I was able to add the NFT name instead of the i on the X-axis

As some of the names are too long and they get shortened in the chart, I want to add a legend so I am working on that. But so far I've been able to create a pretty nice dashboard with the info I want to track for the moment.

Screenshot 2024-04-27 at 08.27.12.png

All this with a free account where you need to run the queries to update the data and consume credits for that, but you get a nice amount of free monthly credits which should be enough in most cases unless you want real-time data continuously. A great analytics tool for anyone willing to fetch chain data.