-- credit to Ali3N
with maintable as (
select 'FLOW' as blockchain,
date_trunc(month,block_timestamp) as date,
proposer,
count (distinct tx_id) as TX_Count
from flow.core.fact_transactions
where block_timestamp::date >= current_date - 90
group by 1,2,3
union ALL
select 'Ethereum' as blockchain,
date_trunc(month,block_timestamp) as date,
from_address,
count (distinct tx_hash) as TX_Count
from ethereum.core.fact_transactions
where block_timestamp::date >= current_date - 90
group by 1,2,3
union ALL
select 'Solana' as blockchain,
date_trunc(month,block_timestamp) as date,
signers[0],
count (distinct tx_id) as TX_Count
from solana.core.fact_transactions
where block_timestamp::date >= current_date - 90
group by 1,2,3
union ALL
select 'Binance Smart Chain' as blockchain,
date_trunc(month,block_timestamp) as date,
from_address,
count (distinct tx_hash) as TX_Count