binhachonFlipside Algorand Wallet Behavior - Wallet's bounty distribution
    Updated 2022-04-08
    with bounty_hunter_list as (
    select
    receiver,
    sum(amount) as total_received
    from algorand.payment_transaction
    where sender = 'TLR47MQCEIC6HSSYLXEI7NJIINWJESIT3XROAYC2DUEFMSRQ6HBVJ3ZWLE'
    and amount < 10000
    group by 1
    ),
    account_balance as (
    select
    address,
    balance,
    total_received,
    case when total_received > balance then 100 else 100 * total_received/balance end as percent_from_bounty
    from algorand.account
    inner join bounty_hunter_list on (address = receiver)
    )
    select
    round(percent_from_bounty, -1)::string as rounded_perc,
    count(distinct address) as number_of_addresses
    from account_balance
    group by 1

    Run a query to Download Data