Multipartite2022-04-15 RUNE distribution across recently-active accounts
    Updated 2022-04-16
    /*
    "What is the distribution of RUNE held by accounts that have been active in the last week/1 months/3months/6months?"
    Not including network modules or treasury addresses.

    For latestblock:

    SELECT MAX(block_id) AS latestblock
    FROM thorchain.transfer_events

    Assumptions:
    14400 blocks per day. (Mimir 'Churninterval'/3 and 'FullImpLossProtectionBlocks'/100)
    30 days per month.

    A single entity can split RUNE between multiple addresses (as in a Sybil attack),
    so the representation used for RUNE distribution is
    'amount of RUNE in addresses over a certain balance'.

    Keep in mind that Flipside tables still have some rows missing (where identical rows should be present),
    here giving the impression of some negative current balances.
    */

    WITH
    detailstable AS
    (
    SELECT
    5140274 AS latestblock
    ),

    networkmodules AS
    (
    SELECT
    'thor1v8ppstuf6e3x0r4glqc68d5jqcs2tf38cg2q6y' AS minter_module,
    'thor1g98cy3n9mmjrpn0sxmn63lztelera37n8n67c0' AS pool_module,
    'thor17gw75axcnr8747pkanye45pnrwk7p9c3cqncsv' AS bond_module,
    'thor1dheycdevq39qlkxs2a6wuuzyn4aqxhve4qxtxt' AS reserve_module,
    'thor1lj62pg6ryxv2htekqx04nv7wd3g98qf9gfvamy' AS standby_reserve,
    Run a query to Download Data