SELECT
DATE_TRUNC('day', block_timestamp) AS day,
COUNT(*) AS total_transactions,
SUM(CASE WHEN success THEN 1 ELSE 0 END) AS successful_transactions,
SUM(CASE WHEN success THEN 1 ELSE 0 END) * 100.0 / COUNT(*) AS success_rate
FROM aptos.core.fact_transactions
WHERE block_timestamp >= DATEADD(day, -30, CURRENT_TIMESTAMP)
GROUP BY day
ORDER BY day;