<aside> 🚨 Status: this document is now outdated. For the latest version see: ‣

</aside>


---
GIP: 0068
Title: Subgraph Service - A subgraph data service in Graph Horizon
Authors: TBD
Created: 2024-06-02
Updated:
Stage: Draft
Discussions-To: <https://forum.thegraph.com/t/><xxxx>
Category: Protocol Logic, Protocol Interfaces, Economic Parameters
Depends-On: GIP-0066
Implementations: <https://github.com/graphprotocol/contracts/pull/944>
Audits:
---

Abstract

This GIP describes the Subgraph Service, a data service designed to work with Graph Horizon that supports indexing subgraphs and serving queries to consumers. We also propose a safe path for indexers to transition from managing their subgraph operation on the current staking contract to the new Subgraph Service contract without service disruption. Note that this GIP depends on the changes proposed by GIP-0066 (<link to GIP>).

Motivation

With the introduction of Graph Horizon we proposed transforming the protocol layer of The Graph Network into a data services protocol, expanding it’s capabilities horizontally to support more use cases and extracting subgraph functionality from it’s core. This GIP introduces how subgraphs would work within this data services protocol.

Prior Art

The design of the Subgraph Service is based on the original implementation of subgraphs functionality in The Graph. The Subgraph Service presents a new implementation of the ideas that have been battle tested for almost 4 years, adapted to work with Graph Horizon and following the Data Service framework specification. We suggest reading GIP-0066 and becoming familiar with the changes proposed there before continuing.

High-Level Description

The main purpose of the Subgraph Service contract is to allow indexers to collect payment for the service they provide which is indexing subgraphs and serving subgraph queries. In order to do so indexers need to provide stake as collateral in the form of a Graph Horizon provision; funds in this provision are subject to being slashed by a dispute mechanism in the event the work they provided is found to be incorrect or fraudulent. A quick note on terminology, the term “indexer” has historically been used to refer to the entity providing subgraph indexing services. In the context of the Subgraph Service this term is used interchangeably with “service provider” which is the generic term used by Graph Horizon.

The Subgraph Service’s main purpose is to facilitate on chain coordination of subgraph indexing and serving operations in accordance with the flows described by the Data Service framework. These can be summarized as: