mamad-5XN3k3Ordinal Types Daily copy
    Updated 2023-07-25
    -- forked from alitaslimi / Ordinal Types Daily @ https://flipsidecrypto.xyz/alitaslimi/q/2QzMlPiZwewo/ordinal-types-daily

    with
    ordinals as (
    select
    /* block_timestamp,
    block_number,
    tx_id,
    fee, -- BTC
    input_value,
    output_value,
    size, -- Byte
    virtual_size, -- vByte
    fee * pow(10, 8) / virtual_size as fee_rate, -- sat/vB,
    outputs[0]:scriptPubKey:address as minter,*/
    hex,
    regexp_instr(hex, '0063036f72640101') as starting_point,
    substr(hex, starting_point + 16, 2) as bytes_pushed,
    ethereum.public.udf_hex_to_int(bytes_pushed) as content_length,
    substr(hex, starting_point + 18, content_length * 2) as content_hex,
    try_hex_decode_string(content_hex) as content,
    split_part(content, '/', 1) as content_type,
    split_part(content, '/', 2) as content_subtype
    from
    bitcoin.core.fact_transactions
    where
    block_number > 767429
    and block_timestamp::date < current_date
    and hex like '%0063036f726401%'
    )
    select
    -- block_timestamp::date as "Date",
    content
    /* count(distinct tx_id) as "Inscriptions",
    count(distinct minter) as "Minters",
    sum(fee) as "Fees",
    Run a query to Download Data