binhachonL1 Unique Users - Transactions
    Updated 2022-03-12
    with transaction_table as (
    select
    'Ethereum' as blockchain,
    date_trunc('day', block_timestamp) as time,
    count(distinct origin_address) as "Number of unique users"
    from ethereum.udm_events
    where block_timestamp >= '2022-02-01 00:00:00.000'
    group by blockchain, time
    union all
    select
    'Terra' as blockchain,
    date_trunc('day', block_timestamp) as time,
    count(distinct tx_from) as "Number of unique users"
    from terra.transactions
    where block_timestamp >= '2022-02-01 00:00:00.000'
    group by blockchain, time
    union all
    select
    'Solana' as blockchain,
    date_trunc('day', block_timestamp) as time,
    count(distinct tx_from_address) as "Number of unique users"
    from solana.transactions
    where block_timestamp >= '2022-02-01 00:00:00.000'
    group by blockchain, time
    ),
    first_week as (
    select
    *,
    row_number() over (partition by blockchain order by time) as rank
    from transaction_table
    qualify rank = 1
    )
    select
    transaction_table.*,
    transaction_table."Number of unique users" * 100 / first_week."Number of unique users" as percentage
    from transaction_table
    Run a query to Download Data