Skip to content

ExuraLabs/hecate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

149 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Hecate ๐Ÿ”ฎ

Current Epoch Python 3.12 uv Ruff Mypy pre-commit License: GPL-3.0-or-later

The magical gateway between Ogmios and Exura for Cardano blockchain synchronization

Overview

Hecate is an independent data relay service that connects through Ogmios and efficiently fetches both historical and real-time on-chain data.
Named after the Greek goddess of magic, crossroads, and keeper of keys, Hecate serves as a bridge between the chain and downstream processing systems via standardized interfaces, focusing exclusively on reliable data acquisition and transmission through well-defined API boundaries, enabling integration with any system that needs to track on-chain data. While its main use case is to forward data via Redis, it can also be configured to output to the command line interface (CLI) for debugging or testing purposes.

NOTE: This project is in early development and is not yet ready for production use. Please use at your own risk.

Architecture Overview

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                                   HECATE                                      โ”‚
โ”‚                                                                               โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚             โ”‚     โ”‚                            โ”‚     โ”‚                  โ”‚  โ”‚
โ”‚  โ”‚   Async     โ”‚     โ”‚  Core Processing           โ”‚     โ”‚  Data Sinks      โ”‚  โ”‚
โ”‚  โ”‚   Client    โ”‚โ—„โ”€โ”€โ”€โ–บโ”‚                            โ”‚โ—„โ”€โ”€โ”€โ–บโ”‚                  โ”‚  โ”‚
โ”‚  โ”‚             โ”‚     โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚     โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”       โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ”‚  โ”‚Historicalโ”‚ โ”‚Realtime โ”‚  โ”‚     โ”‚ โ”‚Redis   โ”‚       โ”‚  โ”‚
โ”‚         โ–ฒ            โ”‚  โ”‚Sync Flow โ”‚ โ”‚Sync Flowโ”‚  โ”‚     โ”‚ โ”‚Sink    โ”‚       โ”‚  โ”‚
โ”‚         โ”‚            โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚     โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜       โ”‚  โ”‚
โ”‚         โ”‚            โ”‚                            โ”‚     โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”       โ”‚  โ”‚
โ”‚         โ”‚            โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”       โ”‚     โ”‚ โ”‚CLI     โ”‚       โ”‚  โ”‚
โ”‚         โ”‚            โ”‚  โ”‚Periodic         โ”‚       โ”‚     โ”‚ โ”‚Sink    โ”‚       โ”‚  โ”‚
โ”‚         โ”‚            โ”‚  โ”‚Flows            โ”‚       โ”‚     โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜       โ”‚  โ”‚
โ”‚         โ”‚            โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜       โ”‚     โ”‚                  โ”‚  โ”‚
โ”‚         โ”‚            โ”‚                            โ”‚     โ”‚                  โ”‚  โ”‚
โ”‚         โ”‚            โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ”‚         โ”‚                        โ”‚                             โ”‚              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚                        โ”‚                             โ”‚
          โ–ผ                        โ”‚                             โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                 โ”‚                   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                โ”‚                 โ”‚                   โ”‚                      โ”‚
โ”‚    Cardano     โ”‚                 โ”‚                   โ”‚    Downstream        โ”‚
โ”‚    Node +      โ”‚                 โ”‚                   โ”‚    Applications      โ”‚
โ”‚    Ogmios      โ”‚                 โ”‚                   โ”‚    (e.g. Exura)      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                 โ–ผ                   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                           โ”‚                โ”‚
                           โ”‚    Prefect     โ”‚
                           โ”‚                โ”‚
                           โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Hecate consists of:

  1. Ogmios Client - Asynchronous client for the Ogmios WebSocket API
  2. Data Relay - Efficiently forward blockchain data with minimal transformation
  3. Prefect Flows - Orchestrate historical and real-time data fetching
  4. Redis Integration - Stream block data to downstream consumers via per-epoch Redis streams

Features

  • โšก Parallel Historical Fetching - Efficiently fetch the entire blockchain history in batches
  • ๐Ÿ”„ Real-time Data Relay - Stay current with the latest blocks and relay them to Redis or CLI
  • ๐Ÿ›ก๏ธ Reorg Detection - Catch chain reorganizations early and handle them gracefully
  • ๐Ÿ“Š Advanced Monitoring - Track connection status, latency, and throughput metrics via Prefect
  • ๐Ÿงฐ Flexible Deployment - Run as a standalone service with simple configuration
  • ๐Ÿ”Œ Optional Dependencies - Use only what you need - Redis is optional and can be installed separately

Demo

Hecate includes a demo script showcasing of some of the async client capabilities:

# Run the demo (assumes Ogmios on localhost)
uv run python -m demo

Demo script output

Prefect Flows ๐Ÿ”„

Hecate uses Prefect to orchestrate both historical and real-time data flows:

  • Historical Sync: Efficiently backfill all on-chain history in a resumable, concurrent manner
  • Periodic Tasks: Automatically update epoch metadata and other system constants
  • See detailed flows documentation

Installation

Prerequisites

  • Python 3.12+
  • uv (Python package manager)
  • Redis (Optional)
  • Ogmios node access

Setup

# Clone the repository
git clone https://github.com/ExuraLabs/hecate.git
cd hecate

# Install dependencies
uv venv -p 3.12

# Install one of the following:
# 1) Base installation (no Redis support)
uv sync

# 2) With development tools
uv sync --group dev

# 3) Complete installation (all features)
uv sync --all-groups

Project Structure

hecate/
โ”œโ”€โ”€ client/           # Ogmios WebSocket client
โ”œโ”€โ”€ data/             # Constant historical data
โ”œโ”€โ”€ flows/            # Prefect flow definitions
โ”‚   โ”œโ”€โ”€ historical    # Historical synchronization flows
โ”‚   โ”œโ”€โ”€ periodic      # Periodic flows for data updates
โ”‚   โ””โ”€โ”€ realtime      # Real-time synchronization flows
โ”œโ”€โ”€ sinks/            # Data sinks
โ”‚   โ”œโ”€โ”€ redis/        # Redis sink for downstream service(s)
โ”‚   โ””โ”€โ”€ cli/          # CLI sink for command line output
โ”œโ”€โ”€ constants         # Constant values and configurations
โ””โ”€โ”€ models            # Data models and type definitions

Development

Type Checking and Linting

# Run mypy for type checking
uv run mypy

# Run ruff for linting
uv run ruff check

# Run ruff for formatting
uv run ruff format

# Set up pre-commit hooks
uv run pre-commit install

License

This project builds on the ogmios-python client, which is distributed under GPL-3.0-or-later. As a result, this project is also shares the same license terms - see the LICENSE file for details.

Acknowledgements

  • Ogmios - WebSocket bridge that wraps Ouroboros' mini-protocols
  • ogmios-python - Original Python SDK for Ogmios
  • Koios - Distributed and open-source Cardano API
  • AdaStat - Advanced Cardano blockchain explorer and query layer

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages