[BUIDL Asia 2022] Understanding The Graph Network
BUIDL Asia 2022 · August 2022 · 18:48
Pranav Maheshwari, an engineer at Edge & Node, explains how The Graph Network works and why reading from a blockchain matters as much as writing to it. The talk covers decentralizing a centralized indexing product, how the protocol is governed by The Graph Foundation with independent core developers, the pros and cons of this model, and the growth of subgraphs and query fees as the network goes multi-chain.
Speakers
Topics
From BUIDL Asia 2022, hosted by Kryptoplanet.
Transcript
hello guys how are you so if you do guys don't cheer up i'm gonna make you guys do gangnam style okay so be a little more like you know attestive to this we're gonna have a lot of fun i'm gonna talk about the graph network uh basically uh it's more about decentralizing a centralized mvp and seeing how the pros and cons of the whole ecosystem and this kind of a product works i'm sure some of you know what the graph is but we are still gonna go in deep aesthetics understanding how it works right so i hope uh like you come along with me i would suggest you guys to take some kind of a notes to understand
things and yeah let's let's let's do it so basically engine node is the company i work for but the graph is a in general is a protocol and there are certain core devs to that and i believe that's one of the great ways to making a protocol work it's not like you have a centralized infrastructure or a company which has been governing everything it's rather all the independent like organizations working together to make a protocol so basically the graph foundation is the the one governing the protocol and there are different core devs and individual contributors working on that some of them namely engine node which was the initial team behind it and then so on and so forth it like you know progressed so why the graph basically i know like
you know uh being in korea for two or three days i can tell you some of you guys are all living on your mobiles and you must be using instagram right so how many times you read from instagram versus how many times do you write into instagram what i mean is that how many times you are reading different different posts you are seeing different different posts versus how many times are you actually uh giving a post it's like one versus thousand you're writing one time you're posting a picture one time and you are getting the information thousand or ten thousand times right so basically writing inside a blockchain is an important thing and we have lots
of l ones and l twos and some great presentations over there but i believe reading from a blockchain is as much or sometimes even more of an important thing than just writing inside a blockchain if you don't make that efficient that then i'm sure you will not be able to have a decent life blockchain protocol to make that like you know the next web3 to have different kind of developer ecosystems developed on it right and the graph makes you read from the blockchain blockchain is a security first model in which you have blocks which are giving different different like you know informations and data types but you need that information like you know sequenced and
wire apis to your different different applications and that's something which is not possible without the use of certain kind of infrastructure one is that you create your own indexer and make it work and i would say that's not the most efficient as well as decentralized way to do it the second way is to keep on having yeah a listener listening to a particular block and keep on going from one place to another one place to another listening to different data types in the block that's again a very inefficient as well as lagging term to like you know get that information out and that's why you have the graph so if you need any kind of an information from a blockchain this is the number you have to query this is the
total number of blocks you will have to query to get a single information for example like you know somebody created a maker world back in 2019 or something you want to get that kind of an information you'll have to query every block in the blockchain which is like 15 lakh or something which is like 1.5 million some blocks just to get that one particular information just imagine the amount of server requests will you will be throwing into an ethereum blockchain to get that information if you want that whole information in the right manner why are not like rupturing your servers i believe you guys have to use the graph
so uh so this is a uni swap sub graph basically whatever information is stored inside the uni swap like you know whenever you trade let's say you do a swap on uni swap right and you need to get some kind of information outside uh so either the first way that uni swap could have done it is have their own indexer run the servers and get that information which is again not efficient or build a sub graph and that's what they did a sub graph is basically telling the graph node that this is the kind of information you will have to keep in touch to get that information for me right and this is how you do it you create a sub graph you deploy it on
the hosted servers or the network which is something we are going to talk about in some time once you get that particular thing inside then the graph node does all the work for you at the end you get this simple uh graphql api which you can query to get all the information and that's why i believe sub graphs are a important part of the web3 stack if you're building a web 3d app then you have two choices one is you build it on a centralized infrastructure and call it ethereum server based application right or you will have to use a web 3 stack to make that happen and i believe with the graph this is something we are moving forward with decentralization and
believe me there are lots and lots of black swamp events that happen and there is a very famous quotation i would like to like again you know release around that that decentralization matters until it does not a decentralization matter does not matter until it does right and for those kind of events you need to rely on something like the graph to get the information outside again so this is the dashboard they created with the api why are the sub graph they have and i think everybody in the crowd must have used uniswap right now so basically every dapp i think most of the dapps in web 3 which call them decentralized do use sub graphs to get information from the blockchain
how does the subgraph fit in a particular use case right your smart contracts from that smart contracts you have events you're putting that like you know information inside the smart contract getting into the ui but you need something in between for the information to be traveling to the ui either you can listen to events which is again not sustainable or use or create sub graphs and that's why we need sub graphs all right so we are live on 39 chains right now and uh you can we are a big believer of like multi-chain world near all the evm most of the evm chains and some non-evm chains like even cosmos and uh near so
definitely you guys should check it out but we believe that like you know there is something that if we are building web3 infrastructure it has to be decent life there does not have to be any centralized point through which you can get certain kind of failures and that was the reason we build subgraphs that's why that was the reason we built the graph network right so initially back in 2019 when the graph launched the hosted service it was with a vision to index blockchains right and to get that information in a decentralized manner was the second phase of progressively decentralizing the mvp which was really something that was useful for the
industry and that's why in 2021 we launched the graph network which is the decentralized version of the graphs hosted service which we can see right now so what's the difference between the graphs hosted service versus the decentralized network the hosted service is a sas kind of a product in which the whenever you deploy a sub graph that's being running on the servers of a particular place just a single place also that's why there is single point of failures and if there is a big event that's happening that there is a chance that that single server fails and if you believe in decentralization
there is no way or no possibility that any infrastructure which is decentralized will ever stop there is a chance that google.com will crash but there is no chance that https protocol will ever crash so if you're building on a protocol there is no chance that is it has single points of failures and that's why we launched the graph network the hosted service is a sas product where you can go it was a kind of nice mvp to make sure that what we used is something which is required by the industry and we wanted to decentralize it to make sure that there is a product market fit once we found that we launched the graph network the graph network is the way to
decentralize uh the querying of information and we are going to learn how do we do that so there are different participants in the graph network it's not like a sas product in which you just log in via google get the information via api and you're like happy that's not how it works in the graph network there are different different participants and i believe if you are like you know if you are very techy you can have a role in the graph network if you are a little techy as in you understand some kind of subgraphs what are different different apps that uh exist in the industry you can again go on a particular uh you can be one of the participants if you're not you just want to be like you
know a part of the big mission that we are then also you can be a participant in the network and that's what we are going to learn now so the first participant in the network is the curator the curator tells the whole graph marketplace that okay this is an info important sub graph that you should index right so basically whenever a sub graph is posted on the graph network then there is curation signal that happen on that sub graph to tell the different participants that yes this is an important sub graph and you should index it just imagine a d5 protocol versus a social protocol i
believe the d5 protocol would require much more decentralization than the centralized then like you know something like a social protocol that's what i believe and that's why i believe there should be more ways to make that decentralization happen and that's what curators do curators make sure that there is an important very very important piece which is deployed on the graph network that people are querying and it should have even less single points of failure it should have more people being a part of it and that's the role of curators right so what's the second part and the most technical and the most important piece of the whole infrastructure the indexers the indexers index the whole sub graph
for you if you are making a decentralized application you would want uh uh to be indexed getting your information whatever subgraph information you told to be put or being portrayed via an api and the indexers are the ones which are indexing that blockchain information that you need for you guys so indexers are one of the most important piece of the infrastructure i would say the most one of the most technical piece of the infrastructure as well as well as i would say they are the ones which make your life easier because you don't have to run your own indexers these people actually run the whole infrastructure they give your sub uh give whatever
query you want to the world but only if there is curation on a sub graph if you deploy like you know a very test network kind of a sub graph on the network there will be less curation if there is less curation there will be less indexing on your particular subgraph the third one is delegators you can say they are like you know a kind of passive income people on the network if you have the uh the the graph token then you want to like you know passively earn from that you can delegate to a particular indexer so that you can get rewards the fourth one are like maybe the dab lab developers also known as consumers of the graft network those people who want to query the the uni swap ui they need to get that
information right uh for example there is some some somebody known as coin gecko right they need the information there are different different dashboards as well i'm sure uh you might have heard about crypto fee dot info very very famous uh application to check uh different different stats they use the graph those kind of dashboards and the dap itself with their info page do want to have the graph information or a specific information and those are the consumers of the graph network so just revise indexers that index the subgraph curators that make sure in the whole market a particular subgraph is signaled so that indexers can index it delegators who are like you know allocating their
uh tokens to the indexers and the last ones are the consumers which for which the index are indexing the whole information so how does it work basically the graph is a query market where you get all the information right it's a whole query market curate you first of all as a consumer or a developer deploy a subgraph to that query market curators actually see whether that information or whatever you have posted might be something of value you actually give your curation signal to that particular sub graph right and if you are somebody who has been the first one to curate on that
particular subgraph there is a bonding curve and you get really good rewards for that after that there are indexers based on the amount of curation let's say you have done 10 kgrt curation on a particular subgraph yeah there might be six to five indexers not taking like you know any uh specific hard code but based on that there might be six to seven indexers indexing it if there is a 100k curation then there is a chance that 25 plus indexers will be indexing that particular subgraph and that's how you decentralize the whole space instead of one believing in one person you're believing in 15 people if it's even more important thing then you're believing in 25 indexers so on and so forth right and the delegators just are taking information from the indexers cost of the service so basically once
the information is indexed the consumers would like to take that index and information into their ends right and they have to pay for the queries if you are deploying a smart contract on ethereum you have to pay the gas cost right and that's going to the validators of the ethereum network similarly in this particular stack in which you are reading the information from the blockchain you would need that kind of information as well and for that you need to pay a query fees right so basically if you're a consumer you are paying the query fees right and ninety percent of it goes to an indexer ten percent of it goes to uh uh the curator who told that this sub graph is important so this is how you sustain
these models of the decentralized infrastructure so as of now there are 165 indexers on the graph 10 000 around delegators uh 2 500 around curators and about 400 subgraphs deployed on the graph network and this has been just a one year growth if i tell you the stats this is how it looks and this is not our start this is written by masari one of the very reputed uh crypto reporters right if you can see the query fees has jumped like anything when you are building a sas like you know free of cost model people are like okay yeah we will use it because it does
not cost us but but when you move to the decentralized infrastructure where people have to understand how the graph works how the curation works how do we query the information from grt that's a little tough thing but if still because there is a product market fit if people are moving to the graph network and querying and seeing this kind of like you know adoption then i believe it's kind of a standard like you know what we call as evm standards we have created subgraph standards so that eventually we can query blockchains in a really nice kind of an information way and i think subgraphs or the subgraph standard is the way to do that and to decentralize this whole space we have the graph network
i think in all the web 3 networks accruing value we are the second rv is the first and like the second one is the graph and i believe this is very important right right now we don't look at like these investment fundamentals and stuff like that but if your protocol is has to sustain it has to accrue a value right and the graph i believe has been successfully able to do that and i think as we go multi blockchain as of now you can only deploy a subgraph on the ethereum network if you are indexing ethereum when we go to other chains like i told hosted service has 39 chains when you go multi-chain we can do the same with the graph that that that will increase the query fees as well as adoption of the whole
decentralized querying model via the graph network as well the number of subgraphs deployed on the graph network it's like a thousand three hundred percent yoy increase which is insane i i don't think any like you know startup in the web to world or the web three world has got that kind of an adoption especially moving from uh incentivized zero fee model to a query fees model which is highly sophisticated so i would encourage you guys all to join the moment like you know be a part of the decentralized space be a part of the decentralized infrastructure join the mission bridle on the graph and please please don't give up decentralization thank you
