TheLaughingManStake Flows (Monthly)
Updated 2025-03-12Copy 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
35
36
›
⌄
with deposits as (
SELECT
date_trunc('month', block_timestamp) as dmonth
, 'validator_init' as label
, SUM(deposit_amount) as eth_amount --NOT always 32E
from ethereum.beacon_chain.ez_deposits
WHERE 1=1
GROUP BY 1, 2
)
, exits as (
SELECT
date_trunc('month', w.block_timestamp) as dmonth
, 'validator_exits' as label
, SUM(CASE
WHEN WITHDRAWAL_AMOUNT BETWEEN 20 AND 32 THEN -WITHDRAWAL_AMOUNT ---Slashed validators exiting
WHEN WITHDRAWAL_AMOUNT>32 THEN -32 ----Normal validator exit with possible rewards
END ---ignoring summing/taking into account other values - > staking reward withdrawals
) as eth_amount
from ethereum.beacon_chain.ez_withdrawals w
WHERE 1=1
GROUP BY 1, 2
)
, rewards as (
SELECT
date_trunc('month', w.block_timestamp) as dmonth
, 'rewards_withdrawal' as label
, SUM(CASE
WHEN WITHDRAWAL_AMOUNT <20 THEN -WITHDRAWAL_AMOUNT END
) as eth_amount
from ethereum.beacon_chain.ez_withdrawals w
GROUP BY 1, 2
)
QueryRunArchived: QueryRun has been archived