The Graph
用 GraphQL 查询以太坊等网络的索引协议
- 认证方式
- API Key
- HTTPS
- Yes
- CORS
- Unknown
- 分类
- 区块链
- 文档 / URL
- https://thegraph.com
简介
The Graph 通过 GraphQL 提供索引区块链数据——基于密钥(无效密钥返回 HTTP 200 带 auth error,已实测)。
快速开始
子图查询(替换 YOUR_KEY):
curl "https://gateway.thegraph.com/api/YOUR_KEY/subgraphs/id/SUBGRAPH_ID" \
-H "Content-Type: application/json" \
-d '{"query":"{ __schema { types { name } } }"}'
{ "errors": [ { "message": "auth error: malformed API key" } ] }
认证方式
- 在 thegraph.com 注册 → API 密钥。
- 放在路径(
/api/KEY/)或请求头中。
⚠️ 坑(已实测):无效密钥返回 HTTP 200 带
errors数组——请检查errors。
速率限制与注意事项
- 免费层带限额(看文档)。
- 子图查询。
常见问题
The Graph 免费吗? 免费层带限额;更多需要付费。
为什么 200 却带错误?
无效密钥返回 200 + errors(已实测)——请检查 errors。
认证风格是什么? 路径中的 API 密钥。
区块链 分类更多
| API | Auth | HTTPS | CORS | |
|---|---|---|---|---|
| Bitquery Onchain GraphQL APIs & DEX APIs | API Key | Yes | Yes | ↗ |
| Blockscout Multichain block explorer REST API (with Etherscan-compatible JSON-RPC) | API Key | Yes | No | ↗ |
| Chainlink Build hybrid smart contracts with Chainlink | No auth | Yes | Unknown | ↗ |
| Chainpoint Chainpoint is a global network for anchoring data to the Bitcoin blockchain | No auth | Yes | Unknown | ↗ |
| ClearTrace Cross-frontend DEX attribution and execution quality data across Ethereum and L2s | No auth | Yes | Yes | ↗ |