jackguyBTC Genrall
Updated 2023-07-30
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 tab1 as (
SELECT
DISTINCT tx_id
FROM bitcoin.core.fact_inputs
WHERE PUBKEY_SCRIPT_TYPE LIKE '%taproot%'
AND block_timestamp > '2022-01-01'
)
SELECT
date_trunc('week', block_timestamp) as week,
'taproot_tx' as tx_type,
count(DISTINCT PARSE_JSON(outputs::STRING)[0]['scriptPubKey']['address']) as users,
count(DISTINCT TX_ID) as transactions,
sum(fee * price) as fee_usd,
avg(fee * price) as avg_fee_usd
FROM bitcoin.core.fact_transactions
LEFT outer join (
SELECT
date_trunc('day', hour) as day,
median(price) as price
FROM crosschain.core.fact_hourly_prices
WHERE token_address LIKE lower('0x2260fac5e5542a773aa44fbcfedf7c193bc2c599')
GROUP BY 1
) on day = date_trunc('day', block_timestamp)
WHERE block_timestamp > '2022-01-01'
AND tx_id in (SELECT * FROM tab1)
GROUP BY 1,2
UNION
SELECT
date_trunc('week', block_timestamp) as week,
'other_tx' as tx_type,
count(DISTINCT PARSE_JSON(outputs::STRING)[0]['scriptPubKey']['address']) as users,
Run a query to Download Data