kiwiengoBitcoin Hash Rate & Difficulty - Halving
Updated 2024-10-14Copy 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
›
⌄
-- forked from Ario / Bitcoin Hash Rate & Difficulty - Halving @ https://flipsidecrypto.xyz/Ario/q/3pTHBySQRjG2/bitcoin-hash-rate-difficulty---halving
-- forked from Bitcoin Hash Rate & Difficulty @ https://flipsidecrypto.xyz/edit/queries/a5c72e4c-d7a9-42c4-9f89-6be0bf29c48b
SELECT
DATE_TRUNC('week', BLOCK_TIMESTAMP) AS week,
AVG(difficulty) AS avg_difficulty,
AVG(CAST(difficulty AS DOUBLE) * (interval / 600)) / POWER(10, 11) AS hash_rate
FROM
(
SELECT
BLOCK_TIMESTAMP,
difficulty,
DATEDIFF(
'SECOND',
LAG(BLOCK_TIMESTAMP, 1) OVER (
ORDER BY
BLOCK_TIMESTAMP
),
BLOCK_TIMESTAMP
) AS interval
FROM
bitcoin.core.fact_blocks
)
where BLOCK_TIMESTAMP::date >= '2020-05-11'
GROUP BY
1
ORDER BY
1 DESC
QueryRunArchived: QueryRun has been archived