-- Vue des 100 derniers blocs compressifs
CREATE VIEW view_recent_blocks AS
SELECT
  b.block_id,
  b.timestamp_utc,
  b.vdf_tau_total,
  COUNT(e.event_id) AS events_in_block
FROM blocks b
LEFT JOIN events e ON e.block_id = b.block_id
GROUP BY b.block_id
ORDER BY b.block_id DESC
LIMIT 100;

-- Vue des derniers événements VOID
CREATE VIEW view_void_events AS
SELECT *
FROM events
WHERE payload->>'type' = 'void'
ORDER BY timestamp DESC
LIMIT 100;