rackhaelNEAR STAKING
Updated 2023-06-15
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
›
⌄
-- select distinct action_name
-- from near.core.fact_actions_events
-- delegate
-- stake
WITH base AS (SELECT tx_receiver,
min(block_timestamp) AS stake_date
FROM near.core.fact_transactions
WHERE tx_hash IN (SELECT tx_hash FROM near.core.fact_actions_events WHERE action_name = 'Stake')
GROUP BY 1
HAVING stake_date >= '2022-01-01')
SELECT date_trunc('day', block_timestamp) AS day,
date_trunc('week', block_timestamp) AS week,
date_trunc('month', block_timestamp) AS month,
count(distinct(tx_hash)) AS stake_events,
sum(stake_events) over (ORDER BY day) AS cum_staking_events
FROM near.core.fact_transactions a
JOIN base b ON a.tx_receiver = b.tx_receiver AND b.stake_date = a.block_timestamp
WHERE day >= '2022-01-01'
GROUP BY 1,2,3
Run a query to Download Data