Skip to content

Fixes for Indexing Section #971

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions website/src/pages/en/indexing/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -708,42 +708,6 @@ Note that supported action types for allocation management have different input

Cost models provide dynamic pricing for queries based on market and query attributes. The Indexer Service shares a cost model with the gateways for each Subgraph for which they intend to respond to queries. The gateways, in turn, use the cost model to make Indexer selection decisions per query and to negotiate payment with chosen Indexers.

#### Agora

The Agora language provides a flexible format for declaring cost models for queries. An Agora price model is a sequence of statements that execute in order for each top-level query in a GraphQL query. For each top-level query, the first statement which matches it determines the price for that query.

A statement is comprised of a predicate, which is used for matching GraphQL queries, and a cost expression which when evaluated outputs a cost in decimal GRT. Values in the named argument position of a query may be captured in the predicate and used in the expression. Globals may also be set and substituted in for placeholders in an expression.

Example cost model:

```
# This statement captures the skip value,
# uses a boolean expression in the predicate to match specific queries that use `skip`
# and a cost expression to calculate the cost based on the `skip` value and the SYSTEM_LOAD global
query { pairs(skip: $skip) { id } } when $skip > 2000 => 0.0001 * $skip * $SYSTEM_LOAD;
# This default will match any GraphQL expression.
# It uses a Global substituted into the expression to calculate cost
default => 0.1 * $SYSTEM_LOAD;
```

Example query costing using the above model:

| Query | Price |
| ---------------------------------------------------------------------------- | ------- |
| { pairs(skip: 5000) { id } } | 0.5 GRT |
| { tokens { symbol } } | 0.1 GRT |
| { pairs(skip: 5000) { id } tokens { symbol } } | 0.6 GRT |

#### Applying the cost model

Cost models are applied via the Indexer CLI, which passes them to the Indexer Management API of the Indexer agent for storing in the database. The Indexer Service will then pick them up and serve the cost models to gateways whenever they ask for them.

```sh
indexer cost set variables '{ "SYSTEM_LOAD": 1.4 }'
indexer cost set model my_model.agora
```

## Interacting with the network

### Stake in the protocol
Expand Down
7 changes: 6 additions & 1 deletion website/src/pages/en/indexing/tooling/graph-node.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ When it is running Graph Node exposes the following ports:
| 8030 | Subgraph indexing status API | /graphql | --index-node-port | - |
| 8040 | Prometheus metrics | /metrics | --metrics-port | - |

> **Important**: Be careful about exposing ports publicly - **administration ports** should be kept locked down. This includes the the Graph Node JSON-RPC endpoint.
> **WARNING: Never expose Graph Node's administrative ports to the public**.
>
> - Exposing Graph Node's internal ports can lead to a full system compromise.
> - These ports must remain **private**: JSON-RPC Admin endpoint, Indexing Status API, and PostgreSQL.
> - Do not expose 8000 (GraphQL HTTP) and 8001 (GraphQL WebSocket) directly to the internet. Even though these are used for GraphQL queries, they should ideally be proxied though `indexer-agent` and served behind a production-grade proxy.
> - Lock everything else down with firewalls or private networks.
## Advanced Graph Node configuration

Expand Down