The Graph — Making ServerLess Decentralized Applications

KingSuper
10 min readNov 22, 2020
The Graph Astronaut

I want to talk today about why the graph is so valuable and how the graph is actually making decentralized applications possible

So a few facts about building applications is basically you have to query data anytime you want to show anything really in an application and usually when someone’s building a web 2 application they’re building an indexer they’re running their own server and their own database and they’re indexing that data themselves and similarly for applications built on web 3.

So any blockchain today usually dev developers will build their own indexer and run their own server but what we quickly realized is that’s actually not sustainable it’s not really decentralized it creates a lot of security risk for app users even you know investors and Defi apps or those that are using Defi apps to invest and increase a lot of centralization risk around a single front-end application versus you know actually fulfilling this decentralized vision it also requires the engineers to write a lot of code which is something that we don’t necessarily want going forward.

And so I think Vitalik summarizes the vision best:

and that’s exactly what the graph is building, so the graph is an indexing and querying layer for blockchain data for open and decentralized api’s we’re agnostic to any blockchain although our contracts are built on ethereum and currently we support EVM based chains we’re actively expanding to support different blockchain so any developer can query any blockchain data and easily build an application.

We can build serverless dapps and that’s awesome for me as a user as well but what’s most interesting to me as a consumer is that now we can have access to api’s in an open market that we couldn’t before and so for example if I’m trying to do analysis on market data you know I have to either pay a Bloomberg or I have to pay another gateway to access those api’s and they are also paying other centralized entities like in AWS or whoever their server or database providers might be and what the graph does is sort of disband those monopolies and allows anybody to use the api’s and also anybody to benefit so people can uphold the network and actually earn from it by contributing to the decentralized data network and so by enabling a market where people can actually earn from the querying that occurs, the querying of data from blockchain that isn’t only earned by one centralized party we can actually create this decentralized market where anybody can participate even if you’re not a developer.

So the graph vision more technically is creating better developer experience so by not having to build your own proprietary code to build your own indexer that saves a lot of engineering time and it also saves sort of this like intangible engineering time of you know how long does it take them to maintain the code what about things like block reorgs and all of that is handled when you just build a subgraph. By enabling service applications we can actually insure apps are decentralized really I don’t think you can say an application is decentralized unless it’s serverless because then it’s you know relying on the the server of the developer who built that front-end for everybody to have access to it versus if you can build these you know open API s and allow front-ends to run on them then we’re not actually relying on any single user anymore or a single point of failure.
we’ve gotten a lot of feedback that by using sub-graphs anyone is a lot more performance, because it takes quite a lot of you know computation to query the blockchain and using a subgraph kind of abstract side and makes it a lot easier.

Again the one I keep reiterating the global centralized API so there’s no single owner no single access point anybody can use it anybody can pay for it and then disrupting data markets.
My favourite sort of visionary that aligns with this is Jaron Lane yay who talks a lot about how these data markets that were currently victims to. It’s not a problem that they exist it’s a problem that we don’t benefit from them and so if we can create markets where anybody can be an index or a curator or earn some kind of reward for you know their data that they’re contributing or the work they’re contributing then it actually makes it okay and so that is exactly what we’re working towards.

So we’re already becoming a critical part of the stack here’s an excellent visual that I like as a non dev to visualize what exactly is happening so you know you build smart contracts and what’s cool about you know a theory um or any blockchain community is that you don’t have to be the one that built the smart contracts to also build a front-end application and that’s where something like a subgraph becomes really valuable because you know one engineer can build this sub graph that indexes data from uniswap (let’s say), so all the transaction data from uniswap contracts and not only does the uniswap team get to use that sub graph and query that data but really anybody and that’s the sort of vision of like communal api’s data, open data, the idea that not a single developer has access to that API or is controlling that API.
So when we think about what it is that you can use the graph for more tangibly really can be any application the ones that are most you know usable today and ethereum are largely around defi so wallets exchanges other investing apps identity solutions and cross app usernames so we actually launched a project registry called Everest which essentially uses a sub graph of project identities and that can then be referenced by other applications and we’re excited to see where that could go you know games, marketplaces, block explorers, price feeds and data aggregators are probably the you know common sources of querying data and the more fruitful that our ecosystem becomes the more important that’ll be.

So here’s just a few stats on what our current query volume breakdown is as you can see Defi is definitely up, DAOs also.
There’s quite a few Dapps that are sort of like DAO factories things. On the games and entertainment front quite a few games and gaming marketplaces are using sub graphs to query that transaction and trade volume from the blockchain identity while it’s many more the ones I’m personally excited about are seeing how scalable scaling solutions are able to integrate it now that OVM is up and also POA scale being able to query you know information from different side chains and different block chains will be super exciting

Here’s a list of just a few of the taps that are already using us there’s quite a few more and you can actually visit our website the https://thegraph.com/explorer/ to see a lot of the high quality ones the ones that are being used by taps themselves and also any of the other sub graphs that have been deployed by really anybody.

For example synthetics exchange is using a sub graph to power their app, the transactions that are made whenever someone pays for a Forbes subscription with eth, those are being captured in an unlocked protocol sub graph that’s deployed on mainnet , all their data for insurance and options trading is being queried from a sub graph and decentraland asset marketplace as well.

Now one of the coolest things I keep reiterating this sort of decentralized global open API and the the cool use case that’s really tangible today is that the uniswap sub graph is being used by both uniswap and rainbow wallet

As I mentioned the graphics explorer is where you can find all these and we also have a playground so if you click on one of these cards you can go to the playground of that specific sub graph you can see the API endpoint and you can actually make you know fake queries here just to play around so you know what’s going on it’s really cool data sometimes even if I you know am unsure about what might have happened in Moloch or something else and I don’t particularly want to go to etherscan I will go here and maybe query like “Oh what was the last vote” and so that’s been pretty cool

So really this becomes a self-sustaining model where developers build sub graphs other developers use those sub graphs and you know point to them and then those developers create other sub graphs and so everybody’s sort of you know using the same resources and piggybacking off them and that’s really something that was never really possible like web 2 api’s are pretty gated. Centralized authorities making all the money you know gating it based on a certain fee and this creates a new paradigm of sharing:

and here’s one of my favorite quotes by Adam and engineering live peer
once you start using the graph you quickly realize the folly of building for web 2 which forces you to recreate the wheel server and database learn a new set of proprietary api’s and assume liability of user data with every new application.

and I think this summarizes it’s so so well like when we think about what the value of block chains are: with the graph we actually create a new use case which is being able to create serverless applications which just weren’t possible before and so I’m really excited that that’s a new use case that we haven’t fully explored and haven’t even necessarily tested the limits of a lot of developers are starting to get it too.

so right now all of our users are you know querying their sub-graphs and those transactions and queries are being processed by our hosted service and at the moment we’re building out our decentralized network that will be launching later this year in the next few months

basically the way the graph network works is you have these indexers who run these graph nodes in the graph CLI and they process queries to sub graphs they compete based on which sub graphs they want to quick process queries for based on things like curation signal and I’ll get to that in a minute and then they also have query fees that they earn for processing those queries and inflation rewards. So this creates this incentivized market of maintaining queries and indexing that otherwise might have been earned by you know an AWS or other centralized servers and database providers so that’s really exciting because that means you and I or really anybody can be an indexer or delegate their stake to an existing index or to then earn benefits from this data marketplace
And curators as I mentioned are basically also users who get to stake their GRT on sub graphs to dictate: I think this sub graph is actually higher quality than another, and that’s a good way for indexers to realize which sub graphs they should be indexing so maybe a more tangible example is you know somebody’s built a uniswap subgraph and then the uniswap team also deployed one and maybe users trust in uniswap team more and so they’ll signal more on the uniswap subgraph and that shows the indexers know that this is probably the sub graph you want to prioritize when indexing

So a little more in depth on the crypto economics so indexers stake there GRT tokens as collateral against their indexing activity they earn fees in either a eth or dai and also inflation rewards and they choose which sub graphs to signal on. Their inflation rewards naturally are proportional to the state the total stake
And similarly curators stake their GRT on the sub-graphs that they think are the highest quality have the greatest integrity it might be the most useful and they earn a portion of query fees as well.

So this creates an incentive ecosystem not only for indexers who might be funds or nodes or you know really hardcore developers but also curators who could just be users who understand the value of the data they’re getting and want to you know earn from that marketplace

and so basically the graph network allows us to create these three new paradigms:

1) curated and open api s that are fully decentralized
2) A decentralized marketplace where multiple parties are able to benefit
3) Query volume incentivization of usage of our applications because the query volume drives the value.
and so you know I as a user if I’m trying to bootstrap the ethereum ecosystem I’m probably going to use more of the dapps knowing that i might be able to benefit from it and really that’s the value proposition of a lot of our decentralized protocols is us all benefiting from our own usage and

so i’m really excited to see how these three sort of new pillars in you know web 3 and also web 2 can change fundamentally how we see api’s and data access
and that’s it I’d love for you guys to join the decentralization movement with us you can deploy a subgraph, you can visit the https://thegraph.com/docs to go through.
You can also visit https://thegraph.com/explorer/ to see which sub graphs are existing so you can also become an indexer.
To reach out if you’re interested in that and you can also join our community on discord.

Here are links again, thank you.

https://t.me/graphprotocol
https://www.reddit.com/r/thegraph/
https://medium.com/graphprotocol

--

--