How To Query Ethereum Balances Using SQL and FlipsideCrypto
mawutor
Posted on June 23, 2023
I recently published a post on how many people own Ethereum (ETH), the cryptocurrency that has revolutionized how the world sees money, and broken the geo-political borders of international finance. I supported the post with recent blockchain data which indicates that over 84.2 million people own more than 0.0001ETH
.
Now, I wish to describe to the process I went through to get such blockchain data to back the post, and how anybody can also query blockchain for free using FlipsideCrypto and some knowledge of SQL.
Pre-erequisites
I assume you have a computer with regular internet connection to start with. And you'll need some basic knowledge of SQL to begin with, but if you don't, that's fine. You can copy the code and follow along for the meantime.
FlipsideCrypto
We'll be using flipsidecrypto's studio to query the blockchain information so let's head to htts://flipsidecrypto.xyz. Flipside is a blockchain data provider that gives access to multiple blockchains (20+) at no cost, and their studio is just like a Jupiter Notebook but for blockchains.
Now, create an account on Flipside, comfirm your email, click on "studio" and let's get started with the code.
Ethereum Holders
Now, once inside the studio, paste this code block inside the ext editor and click on run at the upper-right corner of the dashboard.
select
count(distinct user_address) as holders
from ethereum.core.ez_current_balances
where symbol = 'ETH'
and contract_address is null
and current_bal >= 0.0001
So this is what the code does. It selects every unique wallet address from the ethereum.core.ez_current_balances
table, where the symbol of the currency is ETH
, the contract_address
is null
, and the balance is greater than or equal to 0.0001ETH
. This is to make sure that only genuine ETH holders are counted, and users with very tiny balances are left out. After executing the script, you should see the results in the right pane.
That is all for querying Ethereum user balances using FlipsideCrypto and SQL, you can definitely play around with the query and checkout other supported tables you can play with on the left side of the studio. Have fun!
Posted on June 23, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.