The use of this site and the content contained therein is governed by the Terms of Use. When you use this site you acknowledge that you have read the Terms of Use and that you accept and will be bound by the terms hereof and such terms as may be modified from time to time.
All text, graphics, audio, design and other works on the site are the copyrighted works of nasscom unless otherwise indicated. All rights reserved.
Content on the site is for personal use only and may be downloaded provided the material is kept intact and there is no violation of the copyrights, trademarks, and other proprietary rights. Any alteration of the material or use of the material contained in the site for any other purpose is a violation of the copyright of nasscom and / or its affiliates or associates or of its third-party information providers. This material cannot be copied, reproduced, republished, uploaded, posted, transmitted or distributed in any way for non-personal use without obtaining the prior permission from nasscom.
The nasscom Members login is for the reference of only registered nasscom Member Companies.
nasscom reserves the right to modify the terms of use of any service without any liability. nasscom reserves the right to take all measures necessary to prevent access to any service or termination of service if the terms of use are not complied with or are contravened or there is any violation of copyright, trademark or other proprietary right.
From time to time nasscom may supplement these terms of use with additional terms pertaining to specific content (additional terms). Such additional terms are hereby incorporated by reference into these Terms of Use.
Disclaimer
The Company information provided on the nasscom web site is as per data collected by companies. nasscom is not liable on the authenticity of such data.
nasscom has exercised due diligence in checking the correctness and authenticity of the information contained in the site, but nasscom or any of its affiliates or associates or employees shall not be in any way responsible for any loss or damage that may arise to any person from any inadvertent error in the information contained in this site. The information from or through this site is provided "as is" and all warranties express or implied of any kind, regarding any matter pertaining to any service or channel, including without limitation the implied warranties of merchantability, fitness for a particular purpose, and non-infringement are disclaimed. nasscom and its affiliates and associates shall not be liable, at any time, for any failure of performance, error, omission, interruption, deletion, defect, delay in operation or transmission, computer virus, communications line failure, theft or destruction or unauthorised access to, alteration of, or use of information contained on the site. No representations, warranties or guarantees whatsoever are made as to the accuracy, adequacy, reliability, completeness, suitability or applicability of the information to a particular situation.
nasscom or its affiliates or associates or its employees do not provide any judgments or warranty in respect of the authenticity or correctness of the content of other services or sites to which links are provided. A link to another service or site is not an endorsement of any products or services on such site or the site.
The content provided is for information purposes alone and does not substitute for specific advice whether investment, legal, taxation or otherwise. nasscom disclaims all liability for damages caused by use of content on the site.
All responsibility and liability for any damages caused by downloading of any data is disclaimed.
nasscom reserves the right to modify, suspend / cancel, or discontinue any or all sections, or service at any time without notice.
For any grievances under the Information Technology Act 2000, please get in touch with Grievance Officer, Mr. Anirban Mandal at data-query@nasscom.in.
Whether you are building a dApp or you belong to the businesses and enterprises that consume blockchain data— you must be looking for an effortless way to access the blockchain data. The Graph, as one of the most preferred blockchain data indexing protocols, allows applications in the web3 space to easily query specific data from the blockchain’s decentralized database and utilize it for different purposes. If you want to learn about on-chain data querying on The Graph protocol, this article will show you how to query Web3 data using the Graph protocol, its custom APIs, and Subgraphs.
Understanding The Graph Protocol and its importance in the Web3 space
The Graph is a decentralized data indexing and query protocol that organizes complex blockchain data into simple, extractable format. The protocol allows data consumers like dApp developers and web3 businesses to efficiently and securely query specific data from a range of blockchains. Anyone can use Subgraph to index and query Web3 data. Let’s look at the example below to further understand The Graph protocol’s importance in Web3 space.
The prominent NFT project; Bored Ape Yacht Club, stores all of its data on the Ethereum blockchain, creating challenges for anyone to read the data directly. Like, you can query basic information about the owner of a certain NFT or Ape, fetch the content URI of Apes based on their unique ID, or check the total NFT supply. These operations are easy because they are supported directly on the smart contracts through programming. But, if we talk about more advanced and real-world queries, such as querying apes owned by some specific address and filtering Apes based on their characteristics– these operations are not directly enabled through smart contracts. To retrieve these types of data related to aggregation, search, and non-trivial filtering, you have to individually analyze each transaction and then use Token ID and IPFS hash to read the metadata, and finally, you can aggregate the data. This approach usually takes hours and sometimes even days for a dApp to retrieve data on their interface.
Additionally, businesses can set up their own server that processes bulk transactions, save information to the database, and build API endpoints for web3 data querying. However, this alternative is resource intensive, demands high maintenance, and is exposed to issues such as single point of failure and security vulnerabilities.
The Graph solves all of these challenges with its decentralized data indexing protocol that is designed to index bulks of blockchain data and allow for efficient querying of web3 data using Subgraphs. Since its inception, The Graph network has focused on removing all these tradeoffs that blockchain dApp developers and data consumers face till now. The Graph provides them with a core infrastructure that decentralizes the API and query layer in the decentralized web known Web3. With the Graph, any business can create Subgraphs to query data from various networks supported on the Graph protocol using the protocol’s query language– GraphQL.
That was all about Graph Network’s introduction. Now, to understand how to query web3 data using Subgraphs, you need to learn about multiple roles that uphold the Graph network. These roles allow the Graph ecosystem to facilitate efficient web3 data querying with Subgraphs and other services. Let’s learn more about these roles:
Indexers: Indexers are the backbone of The Graph’s proof-of-stake network. They operate nodes on the network through which data is indexed and served to the queries. Indexers choose to index Subgraphs based on their curation signal. To become indexers, they have to stake their GRT tokens, aggregate delegation from delegators, and they also should have end-to-end familiarity with how various roles work on The Graph Network and its indexing tech stack.
Curators: Curators are the community members, data consumers, or even Subgraph developers who use their intense Web3 knowledge to examine and signal the Subgraphs that Graph Network should index. To do this, Curators stake GRT in the Subgraph’s bonding curve and get their Graph Curation Shares (GCS). Curators can access various Subgraphs through the Graph Explorer, and from there, they make signaling decisions. Curators who are able to signal on high-quality Subgraphs are entitled to receive a certain share from query fees generated by that specific Subgraph.
Delegators: Delegators are the network participants on the Graph that delegate (or stake) their GRT for Subgraphs of their choice. Subgraphs with more delegators easily get attraction from the indexers, and hence Indexers prefer to index those subgraphs first. Delegators do not directly participate in the network. Hence, they do not need to run a Graph Node, still, they contribute to the network’s security and earn a certain portion of the rewards and query fees that a Subgraph receives. The total number of queries a Subgraph can process is highly dependent on its Indexer’s own stake plus delegated stake, which means a higher stake allows Subgraphs to process more queries.
How to query web3 data on The Graph Protocol
You can query on-chain data in various ways, including the do-it-yourself options available at The Graph Network or leveraging the managed services offered by a trusted Subgraph service provider. Let’s understand more about these options:
Do-it-yourself Method:
Subgraph development with Subgraph Studio:
The Graph Network offers ‘Subgraph Studio’, a platform allowing you to create and publish your Subgraphs on the decentralized Graph network in a permissionless way. Building your own Subgraph means you can customize the queries as required and allow other dApp consumers to query on-chain data from it. Once made live, your Subgraph will start extracting data from the blockchain network, process the raw data, and store the indexed data in a way that makes data querying extremely easy via GraphQL language.
To launch your Subgraph in Studio, you need to have all the prerequisites in place for Subgraph development and deployment. This includes scalable nodes, a web3 wallet, and certain prerequisites like Graph CLI and docker installed in your machine. Once you deploy the Subgraph, you can use it to pull data from the blockchain but to decentralize its infrastructure and make the Subgraph available to various dApps, the Subgraph, indexers, curators, and delegators will authenticate your Subgraph and decide if it should be published on the Graph or not.
With Subgraph Studio, you can publish Subgraph on limited blockchain networks, including Ethereum, Further, to deploy and maintain your Subgraphs in Studio, you must understand the tokenomics of the Graph protocol, which indexers, delegators, and curators uphold. Also, Subgraphs need to have their custom payment contracts through which micropayment happens on the data consumers’ side and is provided to the Subgraph provider. Creating and managing these GRT payment contracts is another challenge that Subgraph developers can face.
The Hosted Service Subgraphs:
Hosted Service is a Graph-owned service that allows for hosting of Subgraphs that are not supported on Graph decentralized network, but they are available on-demand. dApp developers can use hosted Service to deploy Subgraphs that can index a range of supported blockchain networks, index data from them, and make available for different queries via graphQL. Since the hosted Service is known as free Graph Node Indexer, developers do not need a dedicated Graph node or wallet to deploy their Subgraphs. Instead, they can use a GitHub account to create a hosted service account to get started.
As we know, Indexing a Subgraph on The Graph’s decentralized network is a complex process. For example, you need indexers to index your Subgraph, you need enough approval from the curators, and then you need delegators to delegate GRT for your Subgraph. Plus, you need to be well-versed with all the technical and programming aspects of Subgraph creation and deployment. Hence, projects that are new and they cannot attract indexers , curators, delegators for their Subgraph, Hosted Service will work. That’s because the Graph Network hosts these Subgraphs on its centralized infrastructure, handling indexing, delegation, etc., on their behalf.
Hosted service Subgraphs works like centralized servers, which may lead to issues like the single point of failure and privacy concerns. And, if you choose to migrate your Subgraph, there’s a set of challenges, such as you need to be familiar with Graph Studio, dedicated tech stack, and the whole concept of indexing, delegation, and curation that also includes GRT staking and running production-level nodes. Also, Hosted Service does not support Subgraph deployment for AppChains and dedicated indexers. Which means if you want to use Subgraph to query data from any standalone chain, then migrating from Hosted Service to decentralized Graph network is the only way to go.
Despite all these, Hosted Service is opposed to The Graph’s motive of decentralizing the data indexing process. Therefore, the Hosted Service on the Graph protocol is going to be deprecated soon, as announced by The Graph’s official documentation. Knowing this, a lot of dApps have already started to migrate their Subgraph from hosted Service to Graph’s decentralized network.
Web3 data querying with already published Subgraphs
The above two options are for projects that look for customized data queries and retrieval of very specific on-chain data from the blockchain network of their choice. Further, DApps that rely on general-purpose data querying can use the existing Subgraphs published on the Graph Explorer to fulfill their data requirements. For example, if you want to query data using Liverpool Subgraph, go to that project, click on the “Query” button, and fetch the unique query URL from there. The URL will look like below:
With this URL, you can query data from Liverpool Subgraph instantly. Similarly, you can do with other Subgraphs. As you can see, the URL requires an API. You can generate this API key in the Subgraph Studio. This will cost you certain fees you need to pay in GRT. Get more information about fees and billing.
Managed Services:
Managed service is another great way for businesses to leverage The Graph’s technology with or without GRT token delegation/staking and managing Subgraph infrastructure on their end. This refers to a solution provider that simplifies Subgraph creation and deployment with advanced tooling and stack, allowing developers to focus on building great applications with access to real-time data. Managed services offer everything required for Subgraphs– from reliable deployment infrastructure to plug-play dev tools and high-availability servers. This way, any business— whether technical or non-technical can rely on managed services to create their own custom Subgraphs.
About The Author
Dr. Ravi Chamria is co-founder CEO of Zeeve Inc, an Enterprise Blockchain company. He has an experience of 18+ years in IT consulting spanning across Fintech, InsureTech, Supply Chain and eCommerce. He is an executive MBA from IIM, Lucknow and a prolific speaker on emerging technologies like Blockchain, IoT and AI/ML.
Passionate About: Blockchain, Supply Chain Management, Digital Lending, Digital Payments, AI/ML, IoT
That the contents of third-party articles/blogs published here on the website, and the interpretation of all information in the article/blogs such as data, maps, numbers, opinions etc. displayed in the article/blogs and views or the opinions expressed within the content are solely of the author's; and do not reflect the opinions and beliefs of NASSCOM or its affiliates in any manner. NASSCOM does not take any liability w.r.t. content in any manner and will not be liable in any manner whatsoever for any kind of liability arising out of any act, error or omission. The contents of third-party article/blogs published, are provided solely as convenience; and the presence of these articles/blogs should not, under any circumstances, be considered as an endorsement of the contents by NASSCOM in any manner; and if you chose to access these articles/blogs , you do so at your own risk.
Zeeve is an enterprise-grade Blockchain Infrastructure Automation Platform. Join the growing list of clients that trust us with their Blockchain initiatives
Implementing blockchain development for a healthcare solution can be a substantial (de-fi wallet development) financial undertaking. The cost of blockchain development is influenced by several factors, including the complexity of the blockchain…
Introduction to Blockchain Technology
Blockchain technology, the backbone of cryptocurrencies, has transcended its origins and become a revolutionary force in various industries. At its core, blockchain is a decentralized and distributed ledger…
Introduction Blockchain Development
Blockchain development has emerged as a transformative force in the realm of digital transactions and decentralized systems. This technology, often associated with cryptocurrencies like Bitcoin, operates on a…
The Metaverse is on its way to enlarging the actual world via the application of advanced augmented and virtual reality technologies. It enables user interaction in both real and simulated surroundings. The limitless possibilities of the Metaverse…
The automotive industry is experiencing a rapid transformation with the advent of new technologies such as blockchain. Blockchain, a distributed ledger technology famous for its application in cryptocurrencies like Bitcoin, is now being explored by…
Insurtech, a convergence of insurance and technology, represents the application of technology-driven innovations to the insurance value chain. In India, it is transforming the way insurance is bought, sold, and managed. According to the ICICI…