Skip to content

Cypher Query Guide

Query the graph database using Cypher — the graph query language used by Memgraph.

Overview

ChainGraph stores address relationships in a Memgraph graph database. Each address is a node and each transfer creates an edge between nodes. You can write Cypher queries to explore these relationships using the Power Mode query editor.

Read-only. Only MATCH/RETURN/WITH/WHERE/ORDER/LIMIT/UNWIND queries are allowed. Write operations (CREATE, DELETE, SET, MERGE) are blocked.

Graph schema

Node labels

:Address {
  chain_id: Int,      // 1 = Ethereum
  address: String,    // lowercase hex
  labels: [String],   // known labels (e.g., "Binance Hot Wallet")
  created_at: Int     // timestamp
}

Relationship types

:TRANSFER {
  tx_hash: String,
  value_wei: Int,
  block_number: Int,
  type: String        // "eth_transfer", "erc20_transfer", "internal"
}

Example queries

Find all counterparties

MATCH (a:Address {address: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045"})
      -[t:TRANSFER]-(b:Address)
RETURN b.address, count(t) AS transfers, sum(t.value_wei) AS total_value
ORDER BY transfers DESC
LIMIT 20

Find path between two addresses

MATCH path = shortestPath(
  (a:Address {address: "0xabc..."})-[:TRANSFER*1..6]-(b:Address {address: "0xdef..."})
)
RETURN path

Detect circular flows

MATCH path = (a:Address)-[:TRANSFER*3..6]->(a)
WHERE a.chain_id = 1
RETURN path
LIMIT 10

Most connected addresses

MATCH (a:Address)-[t:TRANSFER]-()
RETURN a.address, count(t) AS connections
ORDER BY connections DESC
LIMIT 25

Large transfers from a specific address

MATCH (a:Address {address: "0xabc..."})-[t:TRANSFER]->(b:Address)
WHERE t.value_wei > 1000000000000000000  // > 1 ETH
RETURN b.address, t.value_wei, t.tx_hash, t.block_number
ORDER BY t.value_wei DESC
LIMIT 50

Rate limits

TierCypher queries/dayCustom queries
Free10Templates only
Pro200Full custom
EnterpriseUnlimitedFull custom

Tips

  • Always include a LIMIT clause to avoid scanning the entire graph
  • Use chain_id = 1 to filter for Ethereum mainnet
  • Addresses are stored in lowercase — use lowercase in your queries
  • The query editor has a 30-second timeout
  • Use the AI assistant to generate Cypher from natural language
Cypher Query Guide — ChainGraph Docs