tkvresearchInscriptions copy
    Updated 2023-12-20
    with

    A as (
    select 'Ethereum' as chain, block_timestamp, tx_hash, from_address, tx_fee, input_data from ethereum.core.fact_transactions union all
    select 'Arbitrum' as chain, block_timestamp, tx_hash, from_address, tx_fee, input_data from arbitrum.core.fact_transactions union all
    select 'Optimism' as chain, block_timestamp, tx_hash, from_address, tx_fee, input_data from optimism.core.fact_transactions union all
    select 'Avalanche' as chain, block_timestamp, tx_hash, from_address, tx_fee, input_data from avalanche.core.fact_transactions union all
    select 'Polygon' as chain, block_timestamp, tx_hash, from_address, tx_fee, input_data from polygon.core.fact_transactions union all
    select 'Base' as chain, block_timestamp, tx_hash, from_address, tx_fee, input_data from base.core.fact_transactions union all
    select 'BNB chain' as chain, block_timestamp, tx_hash, from_address, tx_fee, input_data from bsc.core.fact_transactions
    ),

    B as(
    select date_trunc('day',block_timestamp) as time, chain,
    case when substr(input_data,0,55) = '0x646174613a2c7b2270223a226173632d3230222c226f70223a226' then 'Inscription' else 'Non Inscription' end as type,
    count(distinct tx_hash) as txs
    from A
    where date(block_timestamp) > date('2023-11-01')
    group by 1,2,3),

    C as(
    select time, chain,
    sum( case when type = 'Inscription' then txs else 0 end) as Inscription,
    sum( case when type != 'Inscription' then txs else 0 end) as Inscription_non
    from B
    group by 1,2)


    select *, Inscription/(Inscription + Inscription_non) as "Inscription %"
    from C
    order by 1 desc




    QueryRunArchived: QueryRun has been archived