Injective Integrates with The Graph Network

StreamingFast
4 min readJun 17, 2024

--

Injective is now available on The Graph’s decentralized network through a Firehose and Substreams integration. Beyond the performance benefits, this integration enables Substreams-powered subgraphs for Injective Mainnet, a first of its kind in the Cosmos ecosystem!

Injective is now available on The Graph’s decentralized network through a Firehose and Substreams integration. Beyond the performance benefits, this integration enables Substreams-powered subgraphs for Injective Mainnet, a first of its kind in the Cosmos ecosystem!

With over 6000 subgraphs currently deployed on The Graph Network across more than 50 blockchains, this implementation provides Injective with access to the largest decentralized blockchain indexing protocol. Since its inception in 2018, tens of thousands of developers have utilized The Graph, and now developers working on Injective can access these benefits as well. Through easy and reliable access to indexed data, dApp developers will be able to deliver incredible experiences to their users.

Substreams acts as a bridge between Injective data and subgraph indexing capabilities, allowing builders to create Substreams-powered subgraphs (SpS). StreamingFast, a core developer of The Graph, has recently deployed the first Substreams-powered subgraph indexing data from Injective to The Graph Network.

Check it out for yourself in Graph Explorer and start consuming the indexed data! To start building with The Graph, take a look at the tutorial provided in the Substreams documentation.

What is Injective?

Injective is a lightning fast interoperable layer one blockchain optimized for building the premier Web3 finance applications. Injective provides developers with powerful plug-and-play modules for creating unmatched dApps.

Recently, Injective has become one of the largest L1s by number of daily transactions and as measured by protocol revenue. Injective is incubated by Binance and is backed by prominent investors such as Jump Crypto, Pantera and Mark Cuban.

Substreams Foundational Modules for Injective

Substreams serve as an indexing technology that allows you to extract both historical and real-time data segments from many blockchains. The streaming-first approach of Substreams enables real-time data consumption with almost zero latency between the block being produced and received! In simple terms, Substreams allows you to:

  1. Extract the specific data you need from Injective.
  2. Apply custom transformations to the data.
  3. Compose data sources.
  4. Stream the data and send it to your sink of choice (subgraphs, Postgres, Clickhouse, and many more).

In order to specify which data you want to retrieve from the blockchain, you can use Substreams modules. You can create your own module, or see if any open modules are available on the Substreams Registry at substreams.dev (search for Injective!). To get developers off the ground, a foundational Substreams module has been created to fetch the event logs associated with a given event type.

Build your first Substreams-powered Subgraph

Building a Substreams-powered subgraph involves passing Substreams data as input to a subgraph. Although you can develop your own Substreams module extracting the data that you need, there are some helper modules ready to be imported into the subgraph with relevant information, such as transaction or logs data.

The Injective Substreams Foundational modules are a set of Substreams modules that allow you to access the most basic pieces of data in the Injective blockchain. Essentially, developing a Substreams-powered subgraph requires you to:

  1. Clone the Injective-powered subgraph template repository from GitHub, which you can use as a starting point for your development.
  2. Import a Substreams module into the subgraph template (for example, a module extracting transactions or events).
  3. Write the actual AssemblyScript code to perform the aggregations that your dapp needs inside the subgraph (based on the provided data from the Substreams).
  4. Test your subgraph code locally.

In order to test the code of your subgraph locally (before actually deploying to The Graph Network) you can run a local Docker set-up that includes a graph-node instance. The graph-node is the piece of software that takes the Substreams data and applies the subgraph aggregations, resulting in a GraphQL endpoint that you can query. With this local set-up, you are replicating the infrastructure that The Graph indexers use to serve blockchain data. Take a look at this tutorial to find out how you can start testing locally!

Once you are done testing locally, you can go ahead and deploy your Substreams-powered subgraph to The Graph Network, where one of the available indexers will start serving the data for you. Check out the README to better understand the flow involved with indexing your Substreams-powered subgraph.

Injective is coming to The Graph protocol

Injective is the latest chain following The Graph’s Chain Integration Process (“CIP”) for full Graph protocol support, enabling indexer rewards for Injective Substreams-powered subgraphs at completion of the process. Make sure to read their CIP here.

What’s next?

In the coming months, we plan to simplify the developer experience of building and deploying Injective Substreams-powered subgraphs. Creating useful Injective modules and providing no-code Substreams solutions are a priority for The Graph. With automatic deployments to The Graph Network and no-code generation tools will provide a frictionless user-experience.

We look forward to and encourage all Injective developers to deploy their Substreams-powered subgraph and provide feedback on their experience building and deploying to The Graph Network. Make sure to join StreamingFast’s Discord server to ask any questions that may come up!

--

--

StreamingFast

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