StreamingFacts — Understanding the Costs of Upgrading a Subgraph

As a subgraph developer, you are creating the building blocks that make up the foundation of The Graph. While the subgraphs you carefully craft may meet the needs of today, they may have to be upgraded to meet the needs of tomorrow. Before upgrading your subgraph, it’s best to understand the true costs associated.

Gas Costs — Ethereum Network Fees

When deploying a brand new subgraph, you will consume between 125,000 and 150,000 gas. This transaction would involve no curation share minting, no transfer of GRT, simply the creation of the subgraph:

  • setting the account
  • deployment ID
  • version metadata
  • subgraph metadata

Then, once the initial Curator comes to signal on this subgraph, that transaction will

  • initialize the curation share tokens
  • initialize the bonding curve
  • transfer tokens into the Graph Proxy
  • burn 2.5% of those tokens
  • issue the curation shares

This will consume roughly 1,300,000 gas, so about 10 times the amount of simply deploying. Subsequently, others who curate on this subgraph will consume approximately 240,000 gas.

When upgrading a subgraph, you will pay a similar amount of gas as the initial curator (1,300,000 gas). This cost can only be paid by the owner of the subgraph. This will

  • burn the curation shares on the existing deployment
  • set up the bonding curve on the new deployment
  • move the auto-migrate signal from the old version to the new version

It’s worthwhile noting here that there is work being done to allow for the subgraph developer, should they choose to do so, to both deploy and signal on the subgraph in one transaction. In this case, you’d be performing a more gas-intensive transaction.

Upgrade Tax — Graph Network Fees

When upgrading a subgraph, there are two taxes that occur: the subgraph developer will need to pay 1.25% of all GRT that is currently being signalled in the bonding curve’s reserve of GRT tokens, as well as a burning of 2.5% of all GRT in the reserve after their deposit (effectively 1.25% that the subgraph developer pays, and 1.25% that the reserve pays). The amount of GRT that the subgraph developer will need to deposit is actually slightly above 1.25%, as they will need to account for burning 2.5% of the amount they will now add into the reserve. For those who want to understand this from the source code itself, let’s take a look.

In the GNS.sol smart contract, you’ll find the relevant code for this calculation. If we were to rewrite the calculation in a more readable way, it would look like this:

PPM = 1,000,000 (100% in parts per million)
curation% = 25,000 (2.5% in parts per million)
owner% = 500,000 (50% in parts per million, this is 50% of the 2.5%, or 1.25%)

Below, we have included sample calculations so that you can see both the cost to the Subgraph Developer, as well as the cost to the Curators through the amount that is burned from the reserve.

Prices taken from and Gas Price as found from, both on August 18, 2021

Understanding both the cost to yourself, as well as the impact it will have on the Curators of your subgraph, you’ll need to decide on a balance between constant innovation and economic costs. There is no correct answer, although communication directly with Curators will probably help.




StreamingFast is a protocol infrastructure company that provides a massively scalable architecture for streaming blockchain data.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Vera Live on ChainSwap | Bridging $VERA between ETH and Polygon

Future of the Automobile Industry — List of the Most Popular Auto Blockchain Projects

It Keeps Expanding! Blockchain Usage in The Real World

Here’s How Blockchain Technology Could Revolutionize eSports and Gaming

The Role of CID in Web3 and How It reshapes the value of Data

PCHAIN (PAI) Weekly Progress Report (12/11/2018–18/11/2018)


TP Courses 22— What is a Blockchain Virtual Machine?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


StreamingFast is a protocol infrastructure company that provides a massively scalable architecture for streaming blockchain data.

More from Medium

The Role of Graph in Web3

Transaction pending on Ethereum?

How Accumulate Enables Monolithic Chains to Become Modular

Axelar is a universal interoperability platform that connects all blockchains through a…