TheLaughingManNEAR User Types By Txn Complexity
Updated 2023-08-29
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
›
⌄
with txn_types as (
SELECT COUNT(DISTINCT ACTION_ID) as totals,
MAX(CASE WHEN ACTION_NAME = 'Transfer' THEN 0 ELSE 1 END ) as txn_type,
TX_HASH
from near.core.fact_actions_events
WHERE block_timestamp>='2022-03-01'
GROUP BY tx_hash
),
user_types as (
SELECT
TX_SIGNER,
MAX(totals) as max_actions, MAX(txn_type) as txn_type,
date_trunc('day', block_timestamp) as ddate
from near.core.fact_transactions t
LEFT JOIN txn_types tt ON t.tx_hash = tt.tx_hash
WHERE
block_timestamp>='2022-03-01'
GROUP BY ddate,tx_signer
)
SELECT
COUNT(DISTINCT TX_SIGNER) as users,
CASE WHEN (max_actions>=3 AND txn_type!=0) THEN 'Sophisticated User' ELSE 'Casual User' END as cat,
ddate
from user_types
GROUP BY cat, ddate
Run a query to Download Data