Skip to content

Commit

Permalink
docs(readme): include query examples
Browse files Browse the repository at this point in the history
  • Loading branch information
tk-o committed Jan 21, 2025
1 parent 37a0d6c commit 41becf4
Showing 1 changed file with 113 additions and 6 deletions.
119 changes: 113 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -19,8 +21,8 @@

Clone this repository:
```
git clone [email protected]:namehash/ens-multichain-indexer.git
cd ens-multichain-indexer
git clone [email protected]:namehash/ensnode.git
cd ensnode
```

Install dependencies:
Expand All @@ -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

Expand All @@ -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.

<details>
<summary>Ponder-native query</summary>

```gql
{
domains(
orderBy: "createdAt"
orderDirection: "desc"
after: "eyJjcmVhdGVkQXQiOnsiX190eXBlIjoiYmlnaW50IiwidmFsdWUiOiIxNjM5ODk1NzYxIn0sImlkIjoiMHhkNTczOGJjNGMxYzdhZDYyYWM0N2IyMWNlYmU1ZGZjOWZkNjVkNTk4NTZmNmYyNDIxYjE5N2Q0ZjgxNmFkZTRjIn0"
limit: 3
) {
items {
name
expiryDate
}
pageInfo {
endCursor
}
totalCount
}
}
```

<details>
<summary>Ponder-native response</summary>

```json
{
"data": {
"domains": {
"items": [
{
"name": "cdkey.eth",
"expiryDate": "1963241281"
},
{
"name": "threeion.eth",
"expiryDate": "1710785665"
},
{
"name": "humes.eth",
"expiryDate": "1710785665"
}
],
"pageInfo": {
"endCursor": "eyJjcmVhdGVkQXQiOnsiX190eXBlIjoiYmlnaW50IiwidmFsdWUiOiIxNjM5ODk1NzYxIn0sImlkIjoiMHgyZWFmNmQ1YjU1YjdhZWI0NmNiZmRiMjVkN2VjOGY4MWYxNDg2YmFmNWFiNjhkZTM5M2YzYTcyNjM1ZDdmN2FkIn0="
},
"totalCount": 982390
}
}
}
```
</details>
</details>

<details>
<summary>Subgraph-native query</summary>

```gql
{
domains(orderBy: createdAt, orderDirection: desc, skip: 40, first: 3) {
name
expiryDate
}
}
```

<details>
<summary>Subgraph-native response</summary>

```json
{
"data": {
"domains": [
{
"name": "🐧🐧🐧🐧🐧🐧🐧🐧🐧.eth",
"expiryDate": "1710785244"
},
{
"name": "rebelteenapeclub.eth",
"expiryDate": "1679228224"
},
{
"name": "[b4201276b6f7ffe5a50b0c3c1406c21295ab9f553107ddc9c715be2f9a6f6e90].[e5e14487b78f85faa6e1808e89246cf57dd34831548ff2e6097380d98db2504a].[dec08c9dbbdd0890e300eb5062089b2d4b1c40e3673bbccb5423f7b37dcf9a9c]",
"expiryDate": null
}
]
}
}
```
</details>
</details>

### `eth` plugin
## Overview

estimated mainnet-only backfill time @ <=500rps = **~13 hours** on M1 Macbook (>10x speedup vs subgraph)

## goals

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 41becf4

Please sign in to comment.