ekx-thegraphlisted
Install: claude install-skill Ekinoxis-evm/claude-skills
# The Graph
Onchain indexing for our lending work, via the `graph-subgraph` and `graph-token-api`
MCP servers.
---
## When you need it
Direct RPC reads answer *"what is the state now?"*. They are bad at
*"what happened over the last six months?"* — `eth_getLogs` caps at ~10k blocks per
call ([`../ekx-alchemy/SKILL.md`](../ekx-alchemy/SKILL.md)), and paging a year of blocks is
slow, expensive in compute units, and fragile.
Reach for a subgraph when you need: historical event feeds, aggregations (total
volume, per-user totals), sorting and filtering across many entities, or relations
between entities.
Do **not** build one for current state — a single `readContract` is faster and always fresh.
---
## Environment
```bash
GRAPH_GATEWAY_API_KEY= # SECRET — querying the decentralised network
GRAPH_TOKEN_API_JWT= # SECRET — the hosted Token API
```
---
## Subgraph shape
```yaml
# subgraph.yaml
dataSources:
- kind: ethereum
network: base-sepolia
source:
address: "0x…"
abi: AuctionManager
startBlock: 12345678 # ← the DEPLOY block, not 0
mapping:
eventHandlers:
- event: BidPlaced(indexed address,uint256)
handler: handleBidPlaced
```
**Set `startBlock` to the contract's deploy block.** Leaving it at 0 makes the
subgraph scan the entire chain history — hours of sync for zero extra data.
```graphql
# schema.graphql
type Bid @entity {
id: ID!
bidder: Bytes!
amount: BigInt!
timestamp: BigInt!
aucti