kidaMultichain Active Users By Chain (timeout)
    Updated 2022-12-14
    with
    eth_vaults as (
    select distinct
    tx_json:to as vault_address
    from ethereum.core.fact_transactions
    where
    from_address = lower('0xfa9da51631268a30ec3ddd1ccbf46c65fad99251')
    and left(tx_json:input, 10) = '0x2ebe3fbb' -- init vault
    ),

    eth_users as (
    select
    trunc(block_timestamp, 'month') as date,
    'ETH' as chain,
    count(distinct iff(exists (select 1 from eth_vaults where vault_address = to_address), from_address, to_address)) as active_users,
    count(distinct tx_hash) as tx_count
    from ethereum.core.fact_token_transfers
    where exists (select 1 from eth_vaults where vault_address = to_address or vault_address = from_address)
    group by date
    ),

    bsc_vaults as (
    select distinct
    tx_json:to as vault_address
    from bsc.core.fact_transactions
    where
    from_address = lower('0xfA9dA51631268A30Ec3DDd1CcBf46c65FAD99251')
    and left(tx_json:input, 10) = '0x2ebe3fbb' -- init vault
    ),

    bsc_users as (
    select
    trunc(block_timestamp, 'month') as date,
    'BSC' as chain,
    count(distinct iff(exists (select 1 from bsc_vaults where vault_address = to_address), from_address, to_address)) as active_users,
    count(distinct tx_hash) as tx_count
    Run a query to Download Data