Evaluating Public Subgraphs as a Curator for The Graph

James Blaha
7 min readNov 14, 2020

--

If you have been paying attention in DeFi you may have heard of The Graph, a data availability platform that makes it easier for dApps to access important on chain data quickly and easily. They recently launched their Curator Program, where they are engaging the community to learn how to become active contributors to The Graph’s growing decentralized data API.

Query volume for The Graph continues to climb as DeFi and the wider ETH ecosystem grows in TX volume

What is a Subgraph?

A subgraph defines what kind of data to look for on a blockchain like Ethereum, and how to map how it appears on the chain to how it is stored and accessed by front-ends (often made with React or Vue).

A subgraph defines which data The Graph will index from Ethereum, and how it will store it. Once deployed, it will form a part of a global graph of blockchain data.

A subgraph defines what data you are looking for on the network and how you transform that data into a more useful representation that can be accessed by anyone. Subgraphs are public, so when a product or company makes deploys a new subgraph to The Graph, anyone can use their Graph Explorer to examine and play with it.

What is a Curator?

So what exactly is a Curator?

Developers of decentralized applications need to rely on accurate and efficient APIs but since subgraphs are open-source and can be built by anyone, it can be difficult to identify which subgraphs are high-quality. To solve this, The Graph introduces Curation, to enable information sharing in The Graph ecosystem. Curators are vital to the protocol as they signal on specific subgraphs to indicate to Indexers which data should be indexed.

When I first became interested in becoming a Curator for The Graph, this was all a bit vague and confusing. What does Curation really mean in this context?

After receiving the first two missions, it became more clear what the team was envisioning: a decentralized group of people incentivized to understand the products built on Ethereum, the data those products need to consume, and the needs of the end-users. With this understanding, Curators can each contribute towards things like Everest, a project registry for crypto, by working together to produce the community’s best store of truth about often fuzzy and changing data.

What is the Subgraph Explorer?

Curators can also use the Subgraph Explorer to analyze deployed subgraphs to check them for accuracy, complexity, and completeness. Here is an example of Uniswap V2’s subgraph, deployed by the Uniswap team.

The first thing to do is check out the github link and look for docs. If the subgraph has documentation at the github link, you are lucky, as it makes it 100x easier to understand if you can read the instructions and review the code.

This subgraph actually has documentation, hooray!

Next, open up the project page and familiarize yourself with what the product does and what data it is consuming from its subgraph. Uniswap is a decentralized exchange (DEX) that uses subgraphs to display historical data and analytics for trades and LPing.

This is the sort of page that uses a Subgraph under the hood to retrieve data to display and interact with.

Next, go back to the subgraph page and go to the Playground. The Subgraph Explorer Playground allows you to view, edit, and create queries on the left column, see the response in the center column, and view the schema and properties in the right column. This is your first tool as a Curator, as it allows you to quickly and easily explore the data exposed by the subgraph.

The Curator’s most important tool: the Subgraph Explorer Playground

If a Curator sees that a particular subgraph could be more useful, they could find (or deploy!) a better version, and stake GNT on it with a bonding curve that returns fees to the Curator when the new subgraph is queried. If the Curator is correct that the improved subgraph will be queried more, then they will be rewarded a larger share of the fees for staking early and providing the signal that the new graph might be more useful to the community.

The opportunities for Curators who know what they are doing could be huge. There’s nothing stopping someone from deploying an improved Uniswap graph. If other people use the new one more than the official one, then Curators who stake on the alternative graph will earn a big payoff off of Uniswap’s volume. Uniswap is happy as writing subgraphs is not their primary business, and there is now a strong incentive for the community to improve on their (excellent) work.

Since Curator rewards pay out more for staking early, if you can see an opportunity, bet on it, and popularize it, you can get rewarded for your trouble.

How to Analyze a Subgraph

OK, now that we know the basics, how does a Curator actually curate? They curate subgraphs for Ethereum projects. So first, choose what contract, token, or product that you want to analyze. Search the Subgraph Explorer for all subgraphs exposing data for that project, and review each.

I was assigned the dahifi/pria as one of my five subgraphs. I chose to use it as an example because it is a very simple subgraph. It is the only contract exposing data about the PRIA ERC20 token.

Etherscan is the second major tool in the Curator’s toolbox

Here are the basic questions recommended by The Graph that a Curator should answer to determine if a graph is good or bad:

  1. How would you describe what the subgraph does? This is a very simple subgraph for displaying basic information about the ERC20 token, PRIA. The first step is to find the token’s address from the subgraph data, or directly from Etherscan. It is good to copy ETH addresses and transaction ids and look at them in Etherscan. The Token query shows basic tokens data, but all symbol and decimals are blank. Maybe they never needed that data and didn't complete it, but it would be best if that returned the correct value. The Transfers query shows toAddress, fromAddress, txId, and value for all PRIA transfers. This works like I’d expect, but could include a lot more metadata that might be useful.
  2. Does this subgraph look production ready? No, the token data and transfer data could be much more complete. this subgraph can only handle listing the transfers of the PRIA token and it would be hard for it to tell you anything else
  3. Does this subgraph look like it would be useful to others? This subgraph is moderately useful to others, but could be a lot more useful if the subgraph contained more data and summary statistics.
  4. What changes would you make to the schema including additions or modifications to entities, fields, field types, relationships, or any other improvements? Add userStats and tokenStats queries, with summary information like price, volume, number of trades, size of trades, number of users, activity of users, etc. this is a deflationary token, so add summary info about the deflation rate, and the other novel mechanics of the token
  5. Are there any other subgraphs that do similar things? How does this one compare? No, this is the only subgraph deployed for this token, by its developer, presumably. If the popularity of the token increased, it may make sense to make a new, better, subgraph and stake on it to provide a better source for querying data about PRIA.
  6. Identify the degree of completeness, complexity and accuracy of the implementation. Completeness: poor. Complexity: low. Accuracy: not quite there.

Why Curate?

The Graph has created a very interesting set of incentives for the different participants in the network. For Curators, if you can identify weak-but-popular subgraphs and improve on them, you could stand to make profit by being first to stake GNT on the new graphs and getting the community to switch over to them. It is a standing, open, job that anyone can take with the knowledge and skills to complete it.

If you have some programming ability and knowledge of DeFi, Curation may be for you.

By having a strong incentive for people to improve all subgraphs, they should get easier to use and more powerful. Exciting times!

--

--