Hosseinwallets holders by size
Updated 2022-09-08Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
›
⌄
with
list1 as (
select tx_receiver as wallet_address, sum(tx:actions[0]:Transfer:deposit / pow(10, 24)) as amount_sum
from near.core.fact_transactions
where tx_status = 'Success'
and tx:actions[0]:Transfer:deposit > 0
group by tx_receiver
),
list2 as (
select tx_signer as wallet_address, sum(tx:actions[0]:Transfer:deposit / pow(10, 24)) as amount_sum
from near.core.fact_transactions
where tx_status = 'Success'
and tx:actions[0]:Transfer:deposit > 0
group by tx_signer
),
list3 as (
select wallet_address, (list1.amount_sum - list2.amount_sum) as total_balance
from list1
join list2 using (wallet_address)
)
select (case
when total_balance between 1 and 100 then '1 - 100'
when total_balance between 100 and 1000 then '100 - 1000'
when total_balance between 1000 and 10000 then '1000 - 10000'
when total_balance between 10000 and 100000 then '10000 - 100000'
when total_balance between 100000 and 1000000 then '100000 - 1000000'
else '> 1000000' end
) as type, count(distinct(wallet_address)) as wallets_count
from list3
group by type
order by wallets_count desc
Run a query to Download Data