August 13, 2020 Zainab Hasan

Introduction to The Graph Network [Part – I]

The Graph:

The Graph is an open-source network that decentralizes the query and API of Web 3.0 which uses a decentralized indexing protocol. The objective of The Graph is to empower internet applications so that they will run using public infrastructure. As the service vanishes when a service provider or business fails to keep intact which makes the users suffer. The protocols of The Graph tackles this vulnerability.

The paradigm of the businesses will shift as the consumers will not pay the centralized businesses or service providers, instead consumers will directly pay to the networks of decentralized service providers. In the ongoing version of The Graph, dApp developers can run a Graph node on their own infrastructure or they can use the host service which The Graph provides.

Problem solved by The Graph:

Ever since Blockchain technology made its debut, developers had to set up servers and storage systems of their own in order to interact with data lying on the Blockchain. This nullifies the main reason Blockchain was used for, i.e, decentralization. This requires that the users trust the developers in charge of the servers which again brings back the concept of centralization.

Major problem is that the middle party may modify the data for strategic reasons, get acquired, or simply make mistakes and so the end-user will get the altered data instead of the actual data. The other concern in this infrastructure is that the projects can go out of business anytime.

Therefore, for these reasons, a modern way to replace or modify this structure was much needed.

Subgraph:

Decentralized indexing protocols in The Graph are known as “Subgraphs”. Users can query Subgraphs with the help of standard GraphQL API. The Subgraphs are then deployed and they synchronize the data from the Blockchain. This synchronization by default will start from the genesis block. However, users can also declare the starting block (i.e from what block to start synchronization from) and then use it to query.

To deploy Subgraph locally you can use ganache CLI and graph nodes. However, to deploy it on a hosted service, you need to sign up using a GitHub account.
Uniswap, XIO, DAOstack, Maloch, DAOphoenix, and many more major Ethereum projects have already built Subgraphs for themselves.
You can see them here: https://thegraph.com/explorer/

Future of The Graph:

In the future, dApp developers will deploy their Subgraph to a registry hosted on Ethereum. They will also deposit GRT (Graph tokens) to assist that Subgraph. This curation will indicate the Indexers that this Subgraph needs to be indexed.

Protocol roles:

For the network to function accurately, there are certain behaviors that must be taken part in. These behaviors or roles that integrate the system are as follows:

  • Consumers:
    Consumers will pay the Indexers for querying the Subgraph. These Consumers will typically be end users but could also be web services or middleware that blends with The Graph.
  • Indexers:
    The node operators who fetch the query from The Graph are Indexers. They are given GRT as a reward for this service, which means they are financially motivated.
  • Curators:
    Curators are financially motivated people who are normally developers. The Curators use GRT to indicate the valuable Subgraphs for indexing.
  • Delegators:
    Delegators stake GRT on behalf of an Indexer. Their incentive is that they earn a portion of rewards and fees, without running The Graph node personally.
  • Fishermen:
    Fishermen are responsible for securing the network by validation of the query responses. The Graph will operate on the fisherman service as Fishermen are motivated altruistically.
  • Arbitrators:
    Arbitrators are responsible for resolving disputes and determining whether an Indexer should be canceled. Their motivation may be financial or they may be altruistic.

Query Engine: 

The query engine will allow the end-users to securely query the vast amounts of data stored on The Graph without the need to personally or manually do the work to compute and store that data. A query engine will run on the user’s machine for the purpose of querying the decentralized network.
This engine will either be in the browser as an extension or will be embedded in the dApp.

The query engine will also act as a trading engine, for the user’s to decide which Indexers to do business with and at what cost. Users can find these Indexers using the query market.

Query Market:

This is similar to cloud-based applications. The only difference in cloud-based application and query market is that a service provider fetches the data from cloud-storage to provide it to the user, The Graph consists of multiple decentralized Indexers who compete with each other. The more users ask them to fetch queries, the more rewards they earn.

Introduction to The Graph

Source: https://thegraph.com/blog/the-graph-network-in-depth-part-1

The advantage of the query market is it enables the user to query at all times as if an Indexer goes off, the other Indexers can take up the query.

When a single dApp uses multiple Indexers and multiple Subgraphs, the flow will be as follows:

  • Consumers refer to The Graph for information, which Indexers have the data they are interested in.
    The Graph Functionality

    Source: https://thegraph.com/blog/the-graph-network-in-depth-part-1

  • Among the multiple Indexers, users select which Indexer is proving the best data at the best cost and choose them.

    The Graph Functionality

    Source: https://thegraph.com/blog/the-graph-network-in-depth-part-1

  • Along with the price the Consumer is willing to pay, they will also send a query they need an answer to, to the Indexer. This transaction is locked for the time being.
    The Graph Functionality

    Source: https://thegraph.com/blog/the-graph-network-in-depth-part-1

  • The Indexer will then either accept or reject the offer. If the Indexer accepts, then they give a response to the attached query and proof that this query is correct as well. This proof will unlock the payment that the user made. This proof is attributed to the Indexer uniquely for verification and serves as a way to resolve disputes in the protocol.
    The Graph Functionality

    Source: https://thegraph.com/blog/the-graph-network-in-depth-part-1

Graph Token:

In order to support the functionality of the query market, The Graph Tokens will be introduced. Graph Tokens (GRT) settle all the payments in The Graph. However, users will be able to pay using ETH or DAI. 

Conclusion:

This article focuses on the main theoretical concepts of The Graph. 
In Part II we will be focusing on deploying the subgraph as well as how to query it, all by using The Graph hosting service.

Also Read: Hyperledger Indy – Layer of Trust [Part 1]

Xord will help you integrate your business processes with Blockchain technology. Follow the link to connect with us: https://xord.one/contact/

, , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *