The new, better future — almost always you need fight for it. And if you think that the war for a new future will take place with the help of starships and blasters, you are wrong. This war is going already — on laptop screens.
The concept of Web3 has been questioned and criticized for a long time. Decentralized applications will never be widespread — was the dominant opinion. But there were persistent stubborn believers, continuing their work despite the tough times.
And we can witness the New Era is coming. The more and more developers and common users start to realize that Web 2.0 is the Internet of corporations and monopoly. Due to being overly centralized it is vulnerable, manipulative, and prone to manipulation. Reliable, secure, private dApps emerge every day; the decentralized internet, where third parties have less control over user interaction and value transfers began to form. But there is still a lot of work ahead and many problems await for solutions.
It’s obvious that the totally new Web 3.0 deserves a totally new data access protocol. Let me outline the problem. Globally the blockchains and databases are quite close in their concept, but querying databases feels like something really different compared to querying blockchains. Anyone who’s ever tried to build dApps on the Ethereum blockchain would admit: while some data is easily queryable from a blockchain like Ethereum, with the increase in the amount of data it becomes literally impossible, at least very time-consuming.
Data in blockchain is kept in a decentralized network of nodes and they constantly change and copy records among themselves. Comparing to centralized database , it is not so easy to access the data. Data in blockchain usually encrypted, so it takes efforts and time to interpret it. And finally, it is simply hard to navigate in blockchain because of its structure of sequential group of blocks.
There are technologies that solve some of these problems, but it is time to unite all the solutions of these large-scale queries together.
The Graph and its subgraphs provide the solution to the problem. The Graph is an indexing protocol for organizing and efficiently accessing data from blockchains and storage networks. As the Graph team mentioned they realize that the indexing and query layer is completely missing from the Web3 nowadays.
The Graph offers a way to index and query data stored on blockchain efficiently using GraphQL. GraphQL is a query language for APIs, invented and open sourced by Facebook company. Since then GraphQL has taken a life of its own, it’s gaining in popularity and being used to access databases. Because of this elegant language, the clients can request exactly what data they need and get back only the data that they’re requesting, nothing else. GraphQL is going to be the preferred query language and database of the decentralized Web3. A lot of companies have already switched to GraphQL (GitHub, Twitter, Yelp are among them).
The main idea behind The Graph is to solve the mentioned problem by building a decentralized protocol which will be enabled by Graph Nodes processing Ethereum events and storing them as indexed data which dApps can query through an API endpoint. The mission of The Graph is to enable internet applications that are entirely powered by public infrastructure.
Let’s illustrate how The Graph protocol actually works in simple words. dApps using their smart contracts create Ethereum transactions, which emit events. Graph Nodes scan Ethereum blocks looking for events and if they find events for your subgraph in Ethereum, they run the mapping function provided. This mapping decides how data gets stored and updated in Graph Nodes. A subgraph basically defines how to do this indexing work in a way that can eventually run on a decentralized network. The Graph provides a standardized way of indexing.
Developers (especially Curators, certainly) have already deployed a bunch of subgraphs for popular protocols and dApps. They can be browsed using the Graph Explorer. Finally, one can query data using a playground in Graph Explorer (it uses GraphQL syntax)
One of the most important challenges of Web 3.0 is successfully solved by The Graph team.