ETH Balance of a wallet
This Query yields the ETH balance of a wallet over time.
1
SELECT date_trunc('day', block_time) as day, sum(-value/1e18) as transfer
2
FROM ethereum."traces"
3
WHERE "from" = '\x99C9fc46f92E8a1c0deC1b1747d010903E884bE1' --optimism bridge
4
AND (LOWER(call_type) NOT IN ('delegatecall', 'callcode', 'staticcall') or call_type is null)
5
AND "tx_success" = true
6
AND success = true
7
GROUP BY 1
8
9
UNION all
10
11
SELECT
12
date_trunc('day', block_time) as day, sum(value/1e18) as transfer
13
FROM ethereum."traces"
14
WHERE "to" = '\x99C9fc46f92E8a1c0deC1b1747d010903E884bE1' --optimism bridge
15
AND (LOWER(call_type) NOT IN ('delegatecall', 'callcode', 'staticcall') or call_type is null)
16
AND "tx_success" = true
17
AND success = true
18
GROUP BY 1
19
20
UNION ALL --gas costs
21
22
SELECT
23
date_trunc('day', block_time) as day, -SUM(gas_price*"gas_used")/1e18 as transfer
24
FROM ethereum."transactions"
25
WHERE "from" = '\x99C9fc46f92E8a1c0deC1b1747d010903E884bE1' --optimism bridge
26
GROUP BY 1
Copied!
Original author: https://twitter.com/MSilb7
Last modified 1mo ago
Copy link