Rodolfo-LimaInformations Between Blocks - Last 30days
Updated 2022-07-28Copy Reference Fork
999
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
›
⌄
⌄
/*What is the average time between blocks on Polygon?
What was the maximum and minimum recorded time between two blocks?
How many transactions are done in a block on average?
How do these numbers compare to L1 such as Flow or Solana, or other L2 such as Arbitrum or Optimism?*/
---------------------------------------Polygon--------------------------------------------------------------------------
WITH POLYGON_PERFORMANCE AS (
WITH BLOCKCHAIN_TX AS (
SELECT
BLOCK_ID,
COUNT(DISTINCT(TX_ID)) AS TX_AMOUNT,
MIN(BLOCK_TIMESTAMP) AS BLOCK_TIME
--SUM(FEE_USD) AS TOTAL_FEE_USD
FROM
flipside_prod_db.polygon.transactions
WHERE DATE_TRUNC('day',BLOCK_TIMESTAMP) >= CURRENT_DATE - INTERVAL '30days'
--AND SUCCESS = TRUE --EXPLAIN IT IN CONSTRAINTS AND FILTERS SECTION
GROUP BY 1
ORDER BY 2 ASC),
BLOCK_TIME_TAB AS (
SELECT
*,
LAG(BLOCK_TIME) OVER(ORDER BY BLOCK_TIME) AS PREVIOUS_BLOCK_TIME,
COALESCE(DATEDIFF('second',PREVIOUS_BLOCK_TIME,BLOCK_TIME),0) AS BLOCK_TIME_DIFF
FROM BLOCKCHAIN_TX
ORDER BY 1)
SELECT
'L2' AS LAYER,
'POLYGON' AS BLOCKCHAIN,
AVG(TX_AMOUNT) AS AVG_TX_AMOUNT,
MAX(TX_AMOUNT) AS MAX_TX_AMOUNT,
MIN(TX_AMOUNT) AS MIN_TX_AMOUNT,
AVG(BLOCK_TIME_DIFF) AS AVG_TIME_DIFF,
PERCENTILE_CONT(0.5) WITHIN GROUP(ORDER BY BLOCK_TIME_DIFF) AS MEDIAN_TIME_DIFF,
Run a query to Download Data