How to make bank with The Graph

Here's how you can earn by participating in The Graph ecosystem.

Level up your open finance game 5x a week. Subscribe to the Bankless program below.


Dear Bankless Nation,

The Graph is a protocol for organizing blockchain data.

Most of our favorite DeFi projects like Aave, Synthetix, and Uniswap use The Graph to power their interfaces.

Until recently The Graph has been fairly centralized. But that’s changing. A few weeks ago The Graph migrated to a decentralized mainnet, underpinned by the GRT token.

If you were tuned in, the launch of this token got pretty crazy ($3b market cap oh my!). But beyond the price hype, there’s some extremely valuable infrastructure here. And better yet, there’s ways for you to earn from it.

Here’s how you can make bank by participating in The Graph ecosystem.

- RSA


🙏 Sponsor: Aave—earn high yields on deposits & borrow at the best possible rate! 


We released episode 29 of State of the Nation!

📺 Watch State of the Nation #29 with Shapeshift’s Erik Voorhees

Discussing with a crypto OG on building Shapeshift’s new DEX aggregator, how regulation affects crypto companies, and more.

We’re now live streaming State of the Nation—join us at 2pm EST every Tuesday!


TACTICS TUESDAY

Tactic #74: How to make bank from The Graph

Guest Writer: GC23997, Bankless Community Member & The Graph Curator

The Graph is an Indexing Protocol for public networks such as Ethereum and IPFS. You can use it to build and publish open APIs, call subgraphs, and make data easily accessible for the crypto ecosystem.

DeFi protocols like Aave, Synthetix, and Uniswap currently leverage subgraphs from The Graph to power their interfaces. Today we’re going to break down the Graph protocol and learn why it’s crucial part of the Ethereum ecosystem. Then we’ll learn how to earn yield by contributing to the protocol.

  • Goal: Learn about The Graph & how to earn yield

  • Skill: Beginner to Advanced

  • Effort: ~1-2 hours

  • ROI: High


The Graph - Web3 Indexing Protocol

What are APIs and why are they important?

APIs or "Application Programming Interfaces" are a set of instructions and standards through which interactions can happen between an application or web tool and applications that use its assets. If APIs didn’t exist then every application would need to build their own interface. At the end of the day, APIs allow developers to save time and reduce the amount of code created.

Why the Web3 Stack needs an Indexing protocol and standard

There are vast amounts of raw data on Ethereum. This data needs to be stored in a format that can be easily and efficiently queried—this is essential for fast loading web applications and good user experience. The Graph makes querying blockchain data reliable, secure and fast as a subgraph sorts and indexes specific data for the applications that use them. It’s the indexing standard for the web3 stack!

How the Graph fits in the Crypto-ecosystem

The Graph is middleware for the Web3 stack. It allows applications to efficiently query blockchain data without relying on a centralized service provider and helps make fully decentralized applications a reality.

With open public networks like Ethereum and the proliferation of DeFi, The Graph is building the foundation for all crypto applications that utilizes open data. Here’s an example from everyone's favorite AMM.

The Uniswap subgraph is used here to query data directly from Uniswap smart contracts. The Graph indexes the useful data sets allowing the creation of infographics such as visualized forms of Uniswap data on token pairs. 

Breaking Down The Graph 

Now that we have a base understanding of The Graph and its role in the Web3 stack let’s break down the components and network participants in the protocol.

GRT token

GRT is the protocol’s native token. It’s a work token used to allocate resources in the network, including providing indexing, curation, and delegation services. All of the above participants can earn income from the network proportional to the amount of work performed and GRT staked. (We’ll show you how below)

Consumers require GRT to pay fees to indexers. The token aligns incentives and economic security within the network between all participants, rewarding healthy participation and punishing malicious behavior.

Indexers

Indexers are the node operators of the protocol. They run the physical infrastructure required to process indexing and query services. Indexers must Stake GRT in order to earn query fees and inflationary rewards. Indexers are compensated the most out of all other participants and can create a marketplace with their own pricing models and strategies.

Curators

Curators stake GRT against subgraphs. Their vote create market signals on what subgraphs are valuable, which helps indexers allocate resources. As a result, curators earn a portion of indexer rewards and fees.

Delegators

Delegators stake GRT to indexers in order to earn a portion of rewards and fees. This allows passive token holders to participate in network security and sybil resistance.

Consumers

Consumers of subgraphs—mainly Ethereum DeFi applications—need to access data on The Graph without having to do the work to compute and store that data. They leverage The Graph to securely and efficiently query data. Fees can be handled by Gateways (in progress) or by a query engine (this can be an extension or embedded into the dApp, abstracted from normal users) which makes decisions on which indexers to use from the fee market.

Consumers query the Indexers and paying for metered usage. This creates a supply and demand model which sustains the protocol.


How to Earn Yield with The Graph

There are three primary ways to contribute to The Graph network and earn GRT. We’ve listed them below from easiest (least technical) to hardest (most technical).


👉 The Graph Network has only just gone live. For now, only a few subgraphs have migrated from the hosted service to mainnet. Query fees are still low, but expected to grow as more subgraphs migrate to mainnet. 


Earn yield as a Delegator 

  • Skill: Easy (non-technical)

  • Risk: Low—Delegators do not get Slashed 

  • ROI: Positive, but dependent on performance of Indexer!

Any individual with GRT can contribute to securing the network without the need to run a Graph Node. This is the easiest way to participate in The Graph and allows you to put your GRT to work. Delegators also don’t need the higher technical knowledge that comes with Curating or Indexing. Delegators use their GRT to delegate to existing indexers and earn a portion of that Indexer's rewards and fees.

Here’s how you can delegate your GRT to Indexers:

  1. First, make sure Metamask is set to ‘Ethereum Mainnet’ and you have enough ETH to cover all the transaction fees.

  2. Add GRT token to Metamask

    • Token Contract Address: 0xc944e90c64b2c07662a292be6244bdf05cda44a7

    • Token Symbol: GRT

    • Decimals of Precision: 18


🧠 If using Ledger, ensure ‘Contract Data’ is allowed on Ethereum app. Also make sure you have the latest Ethereum application installed from the Ledger ‘Device Manager’.


  1. Head over to The Graph’s Network Site and connect your wallet. In this tutorial, we’ll use Metamask as our browser wallet!


🗒️ GRT Tokens delegated can only be withdrawn again after 28 days per the Indexer Thawing Period. Delegators are also subject to a 0.5% deposit tax in order to incentivize longer term commitments.


  1. Scroll down to view active Indexers.

As mentioned, Indexers are rewarded in GRT network Inflation and Query fees. The ‘Fee Cut %’ is the percentage of Query Fees that the Indexer will keep and ‘Rewards Cut %’ equals the Inflation rewards they’ll keep as well.

‘Stake Owned’ is the stake the Indexer put up and ‘Stake Delegated’ is the current amount of GRT delegated to that Indexer by other Delegators. You can also see the “remaining capacity” for the amount of GRT able to be staked to the node operator without the Indexer having to stake more.

Revenue Query Fees’ are the query fees earned to date by that Indexer while ‘Revenue Indexer Rewards’ is the amount of GRT inflation rewards earned to date.

Delegators should take the highlighted variables into account when choosing an Indexer that they’re willing to delegate to.

For example, an Indexer that shares a smaller percentage of rewards to Delegators but has less Delegated Stake than a competitor who shares more rewards might be more profitable to stake to as you could be entitled to a larger proportion of delegator rewards shared with less delegators. 


Once you have selected an Indexer, click on the icon to the far right of the row. This will bring up the option to ‘Delegate’ or ‘Undelegate

  1. Click on delegate and another window will appear. It’ll show you the reward cuts along with the cooldown periods and the remaining delegation capacity. If everything checks out, you can input the amount of GRT you wish to Delegate and then you’re ready to submit your transaction.

  1.  Click on submit transaction. This will open your Metamask. If it’s your first time using The Graph, you’ll have to approve contract on Metamask. Once that’s done, you can confirm the transaction.

Give it a few minutes to confirm on-chain and that's it! You are now a delegator on The Graph and you’re earning passive GRT depending on the performance of the Indexer.

You can manage and find an overview of your Delegations if you click on your address in the upper right corner of the Network Beta dApp.


Earn yield as a Curator 

  • Skill: Moderate (Semi-Technical)

  • Risk: Moderate, staking on poor subgraphs can result in negative return

  • ROI: Varies on market demand as Subgraph share tokens are minted and burned on a Bonding Curve. Curators get 10% of Query fees for a given subgraph proportional to GRT staked.

A Curator’s role in the network is to evaluate subgraphs and signal to Indexers which APIs should have resources dedicated to them.

Curators can stake GRT on any number of subgraphs of their choosing. When staking GRT, curators are depositing GRT into a Bonding Curve which will mint share tokens in return. These tokens can be used to redeem GRT from the curve at any point in the future (by burning the share tokens). In short, Curators are essentially locking up GRT in exchange for a Curator Reward, which is paid as a share of future query fees.


🗒️ There’s a UI for Curators to stake via the explorer slated for Q1 2021. This will make it drastically easier for users to participate as Curators!

Via the Graph Explorer https://thegraph.com/explorer with Metamask.


The decentralized explorer is expected Q1 2021, for now you can use the hosted service to explore the current Built/published subgraphs which have yet to migrate to mainnet. 

Side quest: A Primer on Bonding Curves 

A bonding curve creates a continuous token model where the purchase and sale of tokens is handled by a smart contract, without a party in the middle facilitating the trades. The tokens are traded for coins of a parent currency that are held in reserve by the smart contract.

Below is an example of a Bonding Curve using the Bancor Bonding Curve Formula.

Above, the Y axis represents the price of the token shares while the X axis is the amount of shares minted by the curve. The area under the curve is the reserve (pooled liquidity) where any depositor can get back more or less of their deposit—it’s all dependent on where the supply & demand of the curve lies at the time of redemption.

How this applies to The Graph

When staking as a curator, you are depositing funds into a reserve for a specific subgraph. In doing so, you’re minting shares of that subgraph along a bonding curve. 

In the above example, the orange region would be the amount required to be deposited to get from ‘Current price’ to ‘New price’ and the number of shares minted to the Depositor is the delta between current shares & new shares. 

Curators will aim to deposit into subgraphs that are, or suspected, to be in demand with many queries, thus attracting liquidity. If a subgraph’s liquidity is decreasing (curators are withdrawing their stake) due to a lack of demand, then you could losing some of your GRT upon redemption.

The earlier you stake on a subgraph, the greater the share of query fees you can earn for the given amount of GRT deposited as reserves are added to the contract (more stakers). As a result, you can withdraw your stake with more GRT than initially deposited after some time.


⚠️ Curation with The Graph is all risk/reward. Bonding your GRT to a subgraph early does not guarantee future revenue! There has to be demand for the subgraph in order for curation to be profitable. That said, depositing into a contract with more liquidity can be seen as less risky with lower reward, as it's a market signal that the subgraph is already in demand!


In the future, a Curation Tax will be implemented which will make certain types of economic attacks unprofitable and disincentivizes poor decision making that could harm the integrity of the network.

Curators also earn fewer query fees if they choose to curate on a low-quality subgraph, since there will be fewer queries to process or fewer indexers to process those queries. Ultimately, this encourages longer term commitments and higher quality curated marketplace. 

Subgraph Selection

Anyone can create a subgraph, so there will be duplicates or ones that do more or less the same thing. Some may have bugs, work incorrectly or be optimized for certain data sets over generalized. With real economic risk (and reward), Curators should carefully consider subgraphs selection. Evaluation metrics such as below can help: 

  • Completeness

  • Accuracy 

  • Complexity 

The first place to look is the subgraph page on the explorer, you should find a Github link to find the code repository to dig into the code. You can also test querying data, in some cases a default query example is provided or you may need to compose yourself.

The community of Curators (Discord) has growing resources and collaboration on this, where you can find Guides on what to look for in subgraph evaluation.  


Earn yield as an Indexer 

  • Skill: Advanced (highly technical)

  • Risk: High, knowledge of server operation/maintenance required, downtime and incorrect data will result in portion of stake being slashed

  • ROI: High, Indexers earn the bulk of the Network revenue, competitive market of Indexers with individual pricing models

Indexers are node operators in The Graph Network. Indexers stake GRT (current minimum is 100,000 GRT) in order to provide indexing and query services as a node operator. In return for their services, indexers earn query fees and rewards from new token issuance for their services.


👉 Token Issuance is currently 3% per year. Future GRT monetary policy will be set by the Graph Council.


If you’re interested in running a Graph Node, you can find the Github repo here along with more information on requirements for operation.

Note that this is very compute intensive. Archival nodes are required to index data on Ethereum as well as other chains (eg; if you’re indexing data on Ethereum Ropsten Testnet, then you need a Ropsten Ethereum Node). Multiple Ethereum nodes run with load balancing, due to the required I/O throughput a single Ethereum node may limit the number of subgraphs you can index. 

Additionally, an indexer agent programmatically monitors their resource usage, sets prices, and decides which subgraphs to index. Node operators can decide their own pricing models and strategies to gain a competitive edge in the marketplace.

Query fees are collected in a rebate pool, where they can later be claimed according to a rebate reward function. Indexers are incentivized to stake proportional to the amount of query fees they earn, this signals economic security behind the queries they serve while consumers can see the capacity of that indexer for their needs.

Indexers also have a delegation capacity, which is a ratio of Indexers owned stake, and can be slashed if Indexers are malicious and serve incorrect data to applications or index incorrectly, this also allows passive token holders to participate without risk of slashing. 

Delegators have less of a trust relationship with Indexers and will look at Indexers on chain activities (such as uptime or fees generated) in order to encourage decentralization. 

Final Thoughts

The Graph is a crucial piece of middleware for the broader Ethereum ecosystem. It allows DeFi applications to index and query data in a universal standard, allowing for better tools and applications to be built.

Though The Graph is still rolling out on mainnet, there are already ways to earn yield as a delegator, curator, or indexer.

If you need any help, The Graph’s Discord channel has plenty of resources and a community to guide you along!


Action steps

  • Identify where you could participate and earn in The Graph ecosystem!


Author Bio

GC23997 is a Bankless Community Member, Ethereum Staker & The Graph Curator with an interest in crypto networks where participating in network can earn trust-minimized, autonomous incomes.


Go Bankless. $12 / mo. Includes archive accessInner Circle & Deals(pay w/ crypto)


🙏Thanks to our sponsor

Aave

Aave is a decentralised, open source and non-custodial liquidity protocol enabling users to earn interest on deposits and borrow assets. Aave Protocol is unique in that it tokenizes deposits as aTokens, which accrue interest in real time. It also pioneered Flash Loans and Credit Delegation as innovative DeFi building blocks. The Aave Protocol V2 makes the DeFi experience more seamless with features that allow you to swap your assets for the best yields on the market, and more. Check it out here.


Not financial or tax advice. This newsletter is strictly educational and is not investment advice or a solicitation to buy or sell any assets or to make any financial decisions. This newsletter is not tax advice. Talk to your accountant. Do your own research.


Disclosure. From time-to-time I may add links in this newsletter to products I use. I may receive commission if you make a purchase through one of these links. I’ll always disclose when this is the case.