Series 1: Understanding The Graph and Its Integration with Predy

Predy Finance
2 min readSep 21, 2023

--

Predy’s Integration with The Graph

Predy harnesses the power of The Graph, a service we believe is pivotal in building Blockchain Applications. In this article, we’ll explore what The Graph is and how it’s utilized within Predy.

The Essence of The Graph

The rationale behind using The Graph is as follows:

  1. By leveraging The Graph, you can access data using GraphQL.
  2. Through a schema, you define the information that can be retrieved.
  3. Based on that schema, you set up data indexing, leading to the creation of a Subgraph.
  4. To enable the Subgraph, you need to trigger Onchain events, which is achieved by designing a smart contract.

What is The Graph?

The Graph is a service that indexes blockchain data, allowing for flexible retrieval of the indexed data using queries. These queries are in the GraphQL format, making them straightforward to understand. While its primary focus is on data retrieval, it doesn’t allow for data modification via queries. Developers have the freedom to define which data to index by setting up a schema and can also freely implement the logic on how to create data entities. This flexibility facilitates the design of desired entity structures. Such specific entities and their associated logic are termed as “Subgraphs.”

source: The Graph

The Utility of Subgraphs

Before the advent of Subgraphs, how were blockchain applications implemented? Retrieving data existing on the chain was a daunting task. Continuously querying nodes was labor-intensive. As a result, there was a need to maintain the state of specific contracts in the backend. To always be updated, applications needed to constantly monitor transactions to understand any changes.

With Subgraphs, applications no longer need to maintain their backend services. They can now retrieve on-chain data using Subgraphs. This has simplified the architecture by eliminating the need for a backend to verify chain states, which can be costly.

Stay Tuned! In our next blog post, we’ll delve deeper into Predy’s implementation using The Graph. We’ll explore the evolution of The Graph, Predy’s specific use cases, and the challenges faced. Please look forward to it!

--

--

Predy Finance
Predy Finance

Written by Predy Finance

Most capital efficient Perpetual Options based with Uniswap. Live on Arbitrum.