yasmindaily 2 tx
    Updated 2025-08-14
    -------------'base','avalanche'
    WITH
    standard_chains AS (
    SELECT
    BLOCKCHAIN as blockchain,
    BLOCK_TIMESTAMP_HOUR::date AS date,
    SUM(TRANSACTION_COUNT_SUCCESS) AS transactions
    FROM
    crosschain.stats.ez_core_metrics_hourly
    WHERE
    BLOCK_TIMESTAMP_HOUR::date >= DATEADD(DAY, -{{period}}, CURRENT_DATE )
    AND BLOCKCHAIN IN ('arbitrum', 'polygon', 'ethereum')
    GROUP BY blockchain, date
    ),
    ronin_data AS (
    SELECT
    'Ronin' AS blockchain,
    block_timestamp::date AS date,
    COUNT(DISTINCT TX_HASH) AS transactions,
    COUNT(DISTINCT FROM_ADDRESS) AS users
    FROM ronin.core.fact_transactions
    WHERE block_timestamp::date >= DATEADD(DAY, -{{period}}, CURRENT_DATE )
    AND TX_SUCCEEDED = true
    GROUP BY blockchain, date
    ),
    -------------------- GUN blockchain data (from Avalanche API) with multiple API calls -------------------------
    gun_transactions AS (
    WITH base_data AS (
    SELECT
    live.udf_api('https://metrics.avax.network/v2/chains/49321/metrics/txCount?startTimestamp=1726272000&timeInterval=day&pageSize=2160') AS response
    ),
    flattened_data AS (
    SELECT
    to_timestamp(tx.value:timestamp)::date AS date,
    tx.value:value::integer AS daily_transactions
    FROM base_data,
    Auto-refreshes every 24 hours
    QueryRunArchived: QueryRun has been archived