Updated 2022-05-20
    -- Show the distribution of rewards among wallets.(Look at the total rewards column in the account column for the current rewards total distributed to each wallet)
    -- Do we see wallets that are more engaged in the ecosystem received more rewards?(Look at total number of transactions by wallet and plot that against total_rewards in a scatter plot)
    -- We should see a correlation between wallet size and total rewards received. Is this true? (Plot the wallets' current balance against total rewards received with a a scatter plot)

    WITH name AS (SELECT address as wallet, sum(rewards_total) as reward, sum(balance) as wallet_balance
    FROM algorand.account
    WHERE rewards_total != 0
    GROUP BY wallet
    ORDER BY wallet),

    tx AS (SELECT sender as wallet, count(tx_id) as no_of_transactions
    FROM algorand.transactions
    WHERE asset_id = 386195940 or 386192725
    GROUP BY wallet
    ORDER BY wallet)

    SELECT name.wallet as wallet, no_of_transactions, reward, wallet_balance
    FROM name JOIN tx ON name.wallet = tx.wallet
    ORDER by reward DESC
    LIMIT 1000
    Run a query to Download Data