You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/src/pages/en/indexing/overview.mdx
-36Lines changed: 0 additions & 36 deletions
Original file line number
Diff line number
Diff line change
@@ -708,42 +708,6 @@ Note that supported action types for allocation management have different input
708
708
709
709
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.
710
710
711
-
#### Agora
712
-
713
-
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.
714
-
715
-
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.
716
-
717
-
Example cost model:
718
-
719
-
```
720
-
# This statement captures the skip value,
721
-
# uses a boolean expression in the predicate to match specific queries that use `skip`
722
-
# and a cost expression to calculate the cost based on the `skip` value and the SYSTEM_LOAD global
723
-
query { pairs(skip: $skip) { id } } when $skip > 2000 => 0.0001 * $skip * $SYSTEM_LOAD;
724
-
725
-
# This default will match any GraphQL expression.
726
-
# It uses a Global substituted into the expression to calculate cost
|{ pairs(skip: 5000) { id }}| 0.5 GRT |
735
-
|{ tokens { symbol }}| 0.1 GRT |
736
-
|{ pairs(skip: 5000) { id } tokens { symbol }}| 0.6 GRT |
737
-
738
-
#### Applying the cost model
739
-
740
-
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.
741
-
742
-
```sh
743
-
indexer cost set variables '{ "SYSTEM_LOAD": 1.4 }'
> **Important**: Be careful about exposing ports publicly - **administration ports** should be kept locked down. This includes the the Graph Node JSON-RPC endpoint.
88
+
> **WARNING: Never expose Graph Node's administrative ports to the public**.
89
+
>
90
+
> - Exposing Graph Node's internal ports can lead to a full system compromise.
91
+
> - These ports must remain **private**: JSON-RPC Admin endpoint, Indexing Status API, and PostgreSQL.
92
+
> - 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.
93
+
> - Lock everything else down with firewalls or private networks.
0 commit comments