MadiTxs counter
    Updated 2023-02-01
    with df as (
    SELECT
    date_trunc('day', BLOCK_TIMESTAMP) as date,
    count (DISTINCT tx_id) as tx_count,
    count (DISTINCT TX_SENDER) as wallet,
    tx_count/86400 as txpersecond,
    sum(fee) as total_fee,
    sum(fee)/tx_count as avg_fee,
    count(DISTINCT BLOCK_ID) as total_blocks,
    tx_count/total_blocks as tx_block,
    tx_count/wallet as tx_wallet
    from terra.core.fact_transactions
    where TX_SUCCEEDED = 'TRUE' and fee_denom = 'uluna'
    group by 1)

    SELECT
    sum(tx_count) as tx_count,
    avg(txpersecond) as "Average",
    median(txpersecond) as "Median",
    sum(total_fee) as total_fee,
    avg(avg_fee) as avg_fee,
    avg(tx_block) as tx_block,
    avg(tx_wallet) as tx_wallet,
    avg(total_fee/wallet) as avg_fee_wallet
    FROM df
    where date >= DATEADD(day, -{{Period}}, CAST(GETDATE() AS date)) and date!= CURRENT_DATE
    Run a query to Download Data