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.
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.
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/
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.
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:
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.
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.
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:
Among the multiple Indexers, users select which Indexer is proving the best data at the best cost and choose them.
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 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.
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.
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://https://xord.solutions/contact/