GMX Substreams
Blockchain2024

GMXSUBSTREAMS

Sub-100ms TimescaleDB queries on GMX protocol events. 87% faster deploys via Rust CI/CD engine.

<100ms
PnL / horizon queries
87%
Faster deploys (Rust CI/CD)
60%
Hot-path IO reduction
SCROLL
Client
Stealth Startup
Domain
Blockchain / Analytics
Platform
Rust Service
Duration
Jun — Oct 2024
Core Stack
Rust · Substreams · TimescaleDB
The Brief

THE
PROBLEM

GMX protocol indexing for a user-facing trading dashboard with PnL and Horizon Analysis at production query speeds.

Substreams pipeline in Rust with TypeScript DB sink, TimescaleDB hypertable partitioning, and a Rust/Axum engine coordinating 5 GCP services.

Core Engineering Challenge

Index GMX Substreams into TimescaleDB with sub-100ms responses, plus a CI/CD orchestration engine cutting deploy time 87%.

100ms<
Query Response
87%
Deploy Time
60%
Latency Reduction
Extended stack
backend
Rust
blockchain
Substreams
database
TimescaleDB
devops
GCP
Substreams Pipeline
Substreams Pipeline
How we built it

THE ARCHITECTURE

01
Substreams pipeline

Rust module consumes GMX vault, position, and swap events; TypeScript sink batches writes into Timescale.

RustSubstreamsTypeScript
02
Timescale tuning

Hypertables by time and market; continuous aggregates for horizon curves; retention policies for raw vs rollup tiers.

TimescaleDBHypertables
03
Trading dashboard feeds

Expose pre-aggregated endpoints aligned to the stealth desk’s PnL and leaderboard widgets.

SQLAnalytics
04
Rust CI/CD engine

Axum/Tokio service orchestrates GCP APIs for build, deploy, and task fan-out with auditable run logs.

RustGCPCI/CD
05
Operational hardening

Health checks, rollback hooks, and artifact pinning so reorgs or RPC drift could be replayed safely.

DevOpsGCP
System Data Flow
Ingestion
CrawlerContent Hash10K+ pages
Processing
ChunkerDeduplicatorEmbedding API
Storage
pgvectorPostgreSQLRedis Cache
Auth
Identity ProviderJWT BridgeSessions
Query
HNSW SearchRe-rankerLLM Stream
Delivery
Web AppMobile AppUsers
What we delivered

THE RESULTS

100ms<

PnL and Horizon Analysis charts stayed interactive on multi-terabyte Timescale datasets because continuous aggregates and tuned chunk intervals replaced full scans for every dashboard interaction.

100ms<
Query Response

PnL and Horizon Analysis charts stayed interactive on multi-terabyte Timescale datasets because continuous aggregates and tuned chunk intervals replaced full scans for every dashboard interaction.

87%
Deploy Time

Rust/Axum CI/CD engine coordinating Cloud Build, Artifact Registry, Cloud Run, and Cloud Tasks cut release cycles from roughly two hours to fifteen minutes — fewer manual handoffs between consoles.

60%
Latency Reduction

Hypertable partitioning plus compression policies reduced hot-path IO enough that traders saw consistent sub-second rollups even during volatile funding windows.

Visual documentation

SCREENS &
INTERFACES

Trading Dashboard
Trading Dashboard
Engineering decisions

TECH
DEEP DIVE

TS
Timescale over vanilla Postgres

Native time-series chunking and continuous aggregates matched trading-window queries without bolting on a second OLAP store.

Compression policies paid for themselves once raw swap rows crossed the TB mark.

RS
Rust orchestration layer

Strong typing and async IO for coordinating five GCP services from one binary with fewer shell scripts.

Cut deploy time 87% by replacing click-ops with idempotent Cloud Tasks workflows.

Next Case Study
Blockchain
UniswapSubstreams

Price Jump Detection

RustSubstreamsClickHouse
Start a project

LET'S
BUILD
SOMETHING.

We take on a small number of projects at a time. If the problem is hard, we're interested.

Email
hello@techmusketeers.com
Response time
Within 24 hours
Availability
Open for new projects · 2025