alitaslimiOptimism vs Arbitrum vs Polygon vs Ethereum
    Updated 2022-06-26
    -- Optimism
    SELECT
    INITCAP(blockchain) AS "Blockchain",
    COUNT(DISTINCT blocks.block_timestamp::date) AS days,
    COUNT(DISTINCT blocks.block_number) AS blocks,
    (blocks / days / 1440) AS "Blocks/Minute",
    COUNT(DISTINCT transactions.tx_hash) AS txn,
    (txn / blocks) AS "Transactions/Block",
    (txn / days / 86400) AS "Transactions/Second",
    AVG(blocks.difficulty) AS "Average Diffictuly",
    AVG(blocks.gas_used) AS "Average Block Gas Fees",
    AVG(blocks.size) AS "Average Block Size",
    AVG(tokenflow_eth.hextoint(blocks.block_header_json:baseFeePerGas)) AS "Average Block Base Gas Fee",
    COUNT(DISTINCT transactions.from_address) AS unique_users,
    (unique_users / days) AS "Users/Day",
    AVG(prices.price) as price_usd,
    (SUM(transactions.tx_fee) * price_usd) AS tx_fees,
    (AVG(transactions.tx_fee) * price_usd) AS "Average Transaction Fees",
    (tx_fees / unique_users) AS "Average Transaction Fees Paid By User"
    FROM
    optimism.core.fact_blocks blocks
    JOIN
    optimism.core.fact_transactions transactions
    ON
    blocks.block_number = transactions.block_number
    JOIN
    ethereum.core.fact_hourly_token_prices prices
    ON
    blocks.block_timestamp::date = prices.hour::date
    WHERE
    blocks.block_timestamp::date >= (CURRENT_DATE - 7) AND prices.symbol = 'WETH'
    GROUP BY
    "Blockchain"
    UNION
    -- Arbitrum
    SELECT
    Run a query to Download Data