WITH miners AS (
SELECT distinct miner
FROM ethereum.core.fact_blocks
where BLOCK_TIMESTAMP <='2022-09-14'
)
SELECT
BLOCK_TIMESTAMP::date as date,
sum (AMOUNT) as ETH_amounts,
case
when ORIGIN_FROM_ADDRESS IN (SELECT * FROM miners) then 'Miners'
else 'Others'
end as type
from ethereum.core.ez_eth_transfers
where BLOCK_TIMESTAMP >='2022-06-01'
group by 1,3