-- Parts of this query are forked and inspired from https://flipsidecrypto.xyz/optimus_prime/aptos-built-for-a-billion-people-rEKoh9 By Optimus_Prime
SELECT
DATE_TRUNC('day'
, block_timestamp) AS day
, COUNT(DISTINCT tx_hash) AS transactions_per_day
, SUM(transactions_per_day) OVER (ORDER BY day) AS cummulative_tx
FROM
kaia.core.fact_transactions
WHERE block_timestamp > '2023-12-01'
GROUP BY
DATE_TRUNC('day'
, block_timestamp)
ORDER BY
1 DESC
--LIMIT 100