DeFi Subgraphs
Blockchain2023

DEFISUBGRAPHS

Production subgraphs for 6 DeFi protocols. 100+ institutional clients. Sub-2% error rate.

6
DeFi protocols shipped
100+
Institutional downstream clients
<2%
Reconciliation error budget
SCROLL
Client
Messari
Domain
Blockchain / Open Source
Platform
The Graph Protocol
Duration
Jan — Nov 2023
Core Stack
TypeScript · AssemblyScript · The Graph
The Brief

THE
PROBLEM

Production subgraphs for GMX, Livepeer, Mummy, Ellipsis, Level, and Ribbon protocols serving institutional clients.

TypeScript/AssemblyScript subgraphs with on-chain validation, reconciliation, and open-source SDK reducing dev lifecycle 40%.

Core Engineering Challenge

Normalise heterogeneous protocol events into standardised schema for cross-protocol analytics at sub-2% error rate.

6
Protocols
100+
Institutional Clients
2<
Error Rate
40%
SDK Improvement
Extended stack
frontend
TypeScript
blockchain
AssemblyScript
blockchain
The Graph
Protocol Subgraphs
Protocol Subgraphs
How we built it

THE ARCHITECTURE

01
Schema mapping

Pick Messari schema families (AMM, yield, perps, generic) per protocol and lock entity boundaries early.

The GraphGraphQL
02
Handler implementation

AssemblyScript handlers decode ABIs, normalize decimals, and emit financial snapshots.

AssemblyScriptSolidity
03
Multi-network manifests

Mustache-templated configs for addresses, start blocks, and RPC endpoints per chain.

TypeScriptDevOps
04
Validation

Compare subgraph totals to on-chain explorers and internal spreadsheets before client-facing release.

QADeFi
05
SDK contributions

Upstream reusable helpers for shared patterns (e.g., forked perp protocols) to speed sibling subgraphs.

Open SourceTypeScript
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

6

GMX, Livepeer, Mummy, Ellipsis, Level, and Ribbon each shipped with Messari-standard entity shapes so downstream analysts could compare perp volume, staking flows, and AMM liquidity with one mental model.

6
Protocols

GMX, Livepeer, Mummy, Ellipsis, Level, and Ribbon each shipped with Messari-standard entity shapes so downstream analysts could compare perp volume, staking flows, and AMM liquidity with one mental model.

100+
Institutional Clients

Messari’s paying desks consumed these subgraphs through the same GraphQL contracts as the rest of the catalog — uptime and schema drift were treated as product issues, not one-off integrations.

2<
Error Rate

On-chain reconciliation scripts and manual spot checks held financial metrics within institutional error budgets before manifests promoted to production networks.

40%
SDK Improvement

Open-source SDK and template work shrank the average subgraph iteration loop — less copy-paste across forks meant more time on protocol-specific edge cases.

Engineering decisions

TECH
DEEP DIVE

ASM
AssemblyScript on Graph Node

WASM handlers stay close to chain semantics while TypeScript tooling supports codegen and tests.

Schema-first work prevented six protocols from diverging into six custom JSON blobs.

MUST
Mustache manifests

Parameterized deployments scaled to many networks without maintaining duplicate subgraph.yaml trees.

Error budgets stayed sub-2% because promotion gates included on-chain reconciliation, not just CI green.

Next Case Study
Blockchain
ComposableSubgraphs

Protocol Composition Layer

TypeScriptAssemblyScript
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