From 41becf4742fe507ff485b392bce825ad48143f60 Mon Sep 17 00:00:00 2001 From: Tomasz Kopacki Date: Tue, 21 Jan 2025 16:43:15 +0100 Subject: [PATCH] docs(readme): include query examples --- README.md | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 113 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6426d18..83fd568 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ ### Prerequisites - [Git](https://git-scm.com/) +- [Postgres](https://www.postgresql.org/) + - Minimal supported version: `>=14` - [Node.js](https://nodejs.org/) - It's recommended you install Node.js through [nvm](https://github.com/nvm-sh/nvm) (see link for installation instructions). - To ensure you're running the expected version of Node.js run `nvm install` in the root of the repository (after you clone it). @@ -19,8 +21,8 @@ Clone this repository: ``` -git clone git@github.com:namehash/ens-multichain-indexer.git -cd ens-multichain-indexer +git clone git@github.com:namehash/ensnode.git +cd ensnode ``` Install dependencies: @@ -34,8 +36,9 @@ cp .env.local.example .env.local ``` then review the docs inside your .env.local file for configuration instructions. -- `ACTIVE_PLUGIN` — set the plugin name you’d like to activate (`eth`, `base.eth`, or `linea.eth`). The activated plugin determines which contracts and chains are indexed. Currently only a single plugin can be activated at a time. Soon we will remove this constraint to allow multiple plugins to be activated concurrently. +- `ACTIVE_PLUGINS` — a comma-separated list of plugin names. Available plugin names are: `eth`, `base.eth`, `linea.eth`. The activated plugins list determines which contracts and chains are indexed. Any permutation of plugins might be activated (except no plugins activated) for single-chain or multi-chain indexing. - `RPC_URL_*` — optional, but you can use private ones to speed the syncing process up +- `RPC_REQUEST_RATE_LIMIT_*` — optional, you can change the rate limit for RPC requests per second. - `DATABASE_SCHEMA` is arbitrary, with the limitations mentioned in the linked documentation - `DATABASE_URL` is your postgres database connection string @@ -45,11 +48,111 @@ Once your `.env.local` is configured, launch the indexer by running: To learn more about those commands, go to https://ponder.sh/docs/api-reference/ponder-cli#dev -## Overview +### Query index + +The ENSNode exposes two GraphQL endpoints to query: +- `/` uses a Ponder-native GraphQL schema +- `/subgraph` uses a subgraph-native GraphQL schema + +#### Examples + +Fetching data about most recently-created domains while skipping some initial records. + +
+ Ponder-native query + + ```gql + { + domains( + orderBy: "createdAt" + orderDirection: "desc" + after: "eyJjcmVhdGVkQXQiOnsiX190eXBlIjoiYmlnaW50IiwidmFsdWUiOiIxNjM5ODk1NzYxIn0sImlkIjoiMHhkNTczOGJjNGMxYzdhZDYyYWM0N2IyMWNlYmU1ZGZjOWZkNjVkNTk4NTZmNmYyNDIxYjE5N2Q0ZjgxNmFkZTRjIn0" + limit: 3 + ) { + items { + name + expiryDate + } + pageInfo { + endCursor + } + totalCount + } + } + ``` + +
+ Ponder-native response + + ```json + { + "data": { + "domains": { + "items": [ + { + "name": "cdkey.eth", + "expiryDate": "1963241281" + }, + { + "name": "threeion.eth", + "expiryDate": "1710785665" + }, + { + "name": "humes.eth", + "expiryDate": "1710785665" + } + ], + "pageInfo": { + "endCursor": "eyJjcmVhdGVkQXQiOnsiX190eXBlIjoiYmlnaW50IiwidmFsdWUiOiIxNjM5ODk1NzYxIn0sImlkIjoiMHgyZWFmNmQ1YjU1YjdhZWI0NmNiZmRiMjVkN2VjOGY4MWYxNDg2YmFmNWFiNjhkZTM5M2YzYTcyNjM1ZDdmN2FkIn0=" + }, + "totalCount": 982390 + } + } + } + ``` +
+
+ +
+ Subgraph-native query + + ```gql + { + domains(orderBy: createdAt, orderDirection: desc, skip: 40, first: 3) { + name + expiryDate + } + } + ``` + +
+ Subgraph-native response + + ```json + { + "data": { + "domains": [ + { + "name": "🐧🐧🐧🐧🐧🐧🐧🐧🐧.eth", + "expiryDate": "1710785244" + }, + { + "name": "rebelteenapeclub.eth", + "expiryDate": "1679228224" + }, + { + "name": "[b4201276b6f7ffe5a50b0c3c1406c21295ab9f553107ddc9c715be2f9a6f6e90].[e5e14487b78f85faa6e1808e89246cf57dd34831548ff2e6097380d98db2504a].[dec08c9dbbdd0890e300eb5062089b2d4b1c40e3673bbccb5423f7b37dcf9a9c]", + "expiryDate": null + } + ] + } + } + ``` +
+
-### `eth` plugin +## Overview -estimated mainnet-only backfill time @ <=500rps = **~13 hours** on M1 Macbook (>10x speedup vs subgraph) ## goals @@ -87,6 +190,10 @@ estimated mainnet-only backfill time @ <=500rps = **~13 hours** on M1 Macbook (> - eth registry is ERC721, has many controllers (), no knowledge of pricing — delegated to registrar controllers - eth old registry & new registry migration due to security issue, new then fallback to old, therefore ignore all old evens on domains that have been seen by new registry +### `eth` plugin performance + +estimated mainnet-only backfill time @ <=500rps = **~13 hours** on M1 Macbook (>10x speedup vs subgraph) + ## ENSIP Ideas - unable to automatically identify subname registries via onchain event, CCIP standard dosn't include any info about data source, so we'll need to encode manually for now