KaskoazulUsers df (social, signed, received)
    Updated 2023-01-21
    WITH first_social_txs AS (
    SELECT
    tx_signer AS user_name
    , MIN(block_timestamp) AS first_social_tx
    FROM
    near.core.fact_transactions
    WHERE
    tx_receiver = 'social.near'
    GROUP BY
    user_name
    )

    , users_signed_txs AS (
    SELECT
    ft.*
    FROM
    near.core.fact_transactions ft
    RIGHT JOIN
    first_social_txs fst
    ON
    ft.tx_signer = fst.user_name
    WHERE
    tx_status = 'Success'
    )

    , user_signed_txs_stats AS (
    SELECT
    nt.tx_signer AS user_name
    , MIN(nt.block_timestamp) AS first_signed_bc_tx
    , COUNT(DISTINCT nt.tx_hash) AS signed_txs
    --, SUM(nt.transaction_fee / POW(10,24)) AS total_near_fees
    FROM
    users_signed_txs nt
    GROUP BY
    user_name
    )
    Run a query to Download Data