glxyresearchMEV + Tips (For Lambda Function) copy
    Updated 2024-08-14
    -- forked from MEV + Tips (For Lambda Function) @ https://flipsidecrypto.xyz/studio/queries/1ec9ea8b-8477-4805-a733-4d55c37673e0

    WITH blocks AS (
    SELECT
    block_number,
    miner
    FROM ethereum.core.fact_blocks
    WHERE miner = LOWER('0x810346BD5f860ceEB47133FEf6E33Aed92218178')
    ),

    transaction AS (
    SELECT
    block_number,
    from_address,
    to_address,
    value_precise
    FROM ethereum.core.fact_transactions
    WHERE origin_function_signature = '0x'
    ),

    transactions_filtered AS (
    SELECT
    block_number AS block,
    block_timestamp AS timestamp
    FROM ethereum.core.fact_transactions
    GROUP BY block, timestamp
    ),

    joint_data AS (
    SELECT
    b.block_number AS block,
    t.value_precise AS mev_reward_for_block,
    tf.timestamp AS block_time,
    b.miner
    FROM blocks b
    JOIN transaction t ON b.block_number = t.block_number AND t.from_address = b.miner
    QueryRunArchived: QueryRun has been archived