adriaparcerisasterradash1 2
    Updated 2022-12-08
    --Average Transaction Fee per txn per week
    --Total Transaction Fees per week
    --Total number of transactions per week
    --Average transactions per second (TPS) per week
    --Average block time per week
    --Wallets
    --Total number of new wallets per week
    --Total number of active wallets per week
    --Cumulative number of new wallets per week
    with daily as (
    SELECT
    trunc(block_timestamp,'day') as days,
    count(distinct tx_id) as txs,
    txs/84600 as tps,
    sum(txs) over (order by days) as cum_txs,
    count(distinct tx_sender) as active_users,
    sum(active_users) over (order by days) as cum_active_users,
    sum(fee) as total_fees,
    sum(total_fees) over (order by days) as cum_fees,
    avg(fee) as avg_tx_fee
    FROM terra.core.fact_transactions
    WHERE tx:body:messages[0]:amount[0]:denom = 'uluna' -- LUNA 2.0 ACTIONS
    AND block_timestamp > '2022-05-28' -- LUNA 2.0 LAUNCH
    AND tx_succeeded = true
    group by 1
    order by 1
    ),
    blocks as (
    select
    block_id as block_number,
    min(block_timestamp) as block_debut,
    LAG(block_debut,1) IGNORE NULLS OVER (ORDER BY block_number) as last_block_time
    from terra.core.fact_blocks
    where block_timestamp > '2022-05-28'
    group by 1
    --order by 1 asc
    Run a query to Download Data