Dune Analytics
Dune Analytics
Dune Analytics - How to analyse DeFi data in minutes with SQL on human-readable data
Dune Analytics (founded 2018) is a privately held organization which currently allows anyone to easily create analysis from smart contract data, visualize it, and share it with the world.[2]
There are several high profile Ethereum teams using Dune, but also various community members.
BackStory
Dune's co-founder Mats Julian Olsen
Dune's co-founder Fredrik Haga
Dune is the all-in-one platform to query, visualize, share, and explore human-readable smart contract data.
It is trusted and used by a lot of companies like Gnosis, Compound, and Bancor.
In an interview Fredrik revealed the inspiration behind Dune Analytics, he said
"After some time, we realized that crypto was probably a little too immature and risky for Schibsted to take a proper bet on it.
We were (and are:)) both firm believers in blockchain technology and figured it was time to dedicate ourselves to a blockchain future fully.
"[2]
"We had already built some smart contract proof of concepts and used a bunch of dApps, so we had a good idea of the various problems in the space.
Mats used to build machine learning products while I have a background in statistics and startup analytics, so we soon realized that the data realm was where our experience was most valuable."[2]
He also added
"We’ve always been very focused on building something useful, and we think customers are the very best attestation of that.
We delivered to Dharma as our first client only three months after we went full time, which was cool.
We have to give a shoutout to Nadav and Brendan at Dharma that took a bet on us and became our first customer so early.
"
"On the tech side, getting all the data correctly and consistently from the blockchain is much much harder than a lot of people think it is.
So a considerable part of the work is getting that right.
We’ve also gone through quite a few iterations to get our decoded data into the best possible format.
"
He also talked about their present accomplishment
"What we’re excited about now is the community version.
Allowing anyone to create any form of analysis with SQL easily, turn it into a dashboard, and then share it with others.
We think this will help a lot of discussions and decisions across the community going forward."
How to Use Dune Analytics
Dune's Queries page
To create queries an account is needed.
It is free to create an account and If you want direct API access or make private queries you’ll need to sign up for the premium solution.
After creating an account, on the main page, one can start exploring existing queries by clicking Queries on the top left.
There the latest public queries that were created by others can be seen.[3]
From this page, one can explore queries by the latest or choose a tag that seems interesting.
This query uses the raw log data to find out the ERC20 transfers of the BAT token.
To understand how this query works, the anatomy of a transfer event emitted by ERC20 contracts has to be understood.
The event looks like this:
event Transfer(address indexed from, address indexed to, uint256 value);
Which means that when the event is emitted during a token transfer There will be a log table row containing:
contract_address: the address of the ERC20 token
topic1: The hash of the encoded contract (Read here how it works) For ERC20 the hash is 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
topic2: the first indexed parameter from
topic3: the second indexed parameter to
data: The raw data of the event, in our case the last parameter which is the amount of token sent (value).
Note that in a lot of platforms the hash of the log is considered as topic0 but on Dune Analytics it is topic1.
About the Co-founders
Fredrik Haga is a 28-year-old Norwegian economist who had always had a great interest in technology.
According to him, he fell down the crypto rabbit hole in 2015 when he heard a podcast episode with Nathaniel Popper (author of Digital Gold) on EconTalk. The podcast had a lot of good conversations on all kinds of topics with domain experts.[2]
He is also a freestyle skier, hip-hop fan, and definitely a crypto geek.
Mats Julian Olsen was formerly the co-founder of The Data Science DAO and also worked as a senior data scientist with Schibste Media Group for almost 3 years before coming together to create Dune Analytics with Fredrick in 2018.
Top Teams using Dune Analytics
Ox
Argent
Gnosis
ENS
The Block
Bancor
AAVE