Yousefi_1994NETH - Account Creation Date
    Updated 2023-03-03
    with neth_account as (
    select
    actions:predecessor_id as wallet_account
    from near.core.fact_receipts
    where receiver_id = 'nethmap.near'
    and actions:receipt:Action:actions[0]:FunctionCall:method_name = 'set'
    and block_timestamp::date >= '2022-12-19'
    and status_value:Failure is null
    ),
    transactions_by_neth_account as (
    select
    receipts.block_timestamp,
    receipts.tx_hash,
    iff(account.wallet_account = receipts.receiver_id, receiver_id, actions:predecessor_id) as wallet_account
    from near.core.fact_receipts receipts
    join neth_account account on (account.wallet_account = receipts.receiver_id or account.wallet_account = receipts.actions:predecessor_id)
    join near.core.fact_transactions transactions on transactions.tx_hash = receipts.tx_hash
    where receipts.block_timestamp::date >= '2022-12-19'
    and receipts.status_value:Failure is null
    and transactions.tx_status = 'Success'
    ),
    account_creation_date as (
    select
    wallet_account as "Account",
    min(block_timestamp) as "Creation Date"
    from transactions_by_neth_account
    group by "Account"
    )

    select
    date_trunc('week', "Creation Date") as "Date",
    count(distinct "Account") as "Number of Account",
    sum("Number of Account") over (order by "Date") as "Cumulative Number of Accounts"
    from account_creation_date
    group by "Date"
    Run a query to Download Data