Anyone who has tried to create a decentralized application (dApp) on the Ethereum blockchain will agree that although blockchains are conceptually close to databases, queries to the former seem completely out of this world. Firstly, there are notable performance issues with blockchain data storage which is largely due to their distributed (decentralized) nature and the variants of consensus protocols. On a similar comparison, databases would also be slow if they consisted of a network of nodes where each node stored a complete copy of the entire database and each transaction had to be verified by each node. This is why people are experimenting with different approaches to utilizing blockchains as a database including changing the blockchain’s structure.
The Graph approaches the problem in a different way by allowing blockchains to exist in their current form, but also offers a way to efficiently index and query the stored data using GraphQL.
What is The Graph?
The Graph is a decentralized open-source protocol for indexing blockchain data. Developers can create and publish different APIs (subgraphs) and make queries via GraphQL. The platform can be used to quickly search for any data on e.g., Ethereum blockchain using simple queries. This solves a common problem that many blockchain indexing platforms encounter.
Blockchain applications face difficulties maintaining properties such as immutability, blockchain reorganizations, and security while processing queries. This makes the query process time-consuming, but fortunately, The Graph has a workaround to solve the problem. The project utilizes “subgraphs” to index blockchain data that users can access via the GraphQL API. According to the development team the protocol will be fully decentralized in the future, with more nodes responsible for indexing.
How does The Graph index data?
Let’s use the process of indexing information within the Ethereum blockchain as an example. The Graph uses what’s referred to as a “subgraph manifest” — a description of a subgraph that contains data about smart contracts, blockchain events, and a procedure for mapping these events before they are stored in the platform’s database. Transactions, subgraph manifests, and databases are coordinated according to a specific structure. It all starts with decentralized applications that add data to the Ethereum blockchain using smart contracts.
All of this data will contain a record of all events and transactions up to the point where they reach the final result. The Graph node then scans the entire blockchain database, collects new data and filters out the information relevant to the users’ queries. To simplify indexing, it identifies each data set that answers queries in every subgraph.
GraphQL is the link between the blockchain data and each application. But again, it is through the Graph Node that users can deliver search queries to the platform. After the entire process, users can finally see the results of their queries from their applications. This is essentially how the data query and indexing loop works. Users can turn to Graph Explorer to view the subgraphs that are already present on the platform. Each of these subgraphs accommodates a “playground” where users can run queries through GraphQL.
As of this writing, The Graph supports indexing data from Ethereum, IPFS and PoA networks. The platform will support more networks in the future. Yet, even right now, the project already has more than 2,300 subgraphs deployed and used by application developers. The “track record” includes AAVE, Aragon, Balancer, DAOstack, Uniswap, Synthetix and many others. 3Commas has also recently integrated The Graph to retrieve Ethereum wallet balances and prices. Support for displaying staked tokens will be added shortly.
Roles in The Graph ecosystem
Project participants can take on the following roles:
- Consumers. The users who pay indexers for processing search queries. The consumer could also be an entire web service or a set of software associated with The Graph;
- Indexers. The nodes on the network responsible for the data indexing;
- Curators. Using GRT tokens (native platform tokens), curators identify information for subgraphs that is important for indexing;
- Delegators. These are project members who delegate their GRT tokens to indexers in order to receive a portion of the profit;
- Fishermen. These are the participants who check the validity of the network’s response to queries;
- Arbitrators. These participants ensure that the indexers are not malicious.
Projects associated with The Graph ecosystem
Thanks to partnering with Chainlink, subgraph information can now be routed into the chain using Chainlink’s oracles, creating an even more robust ecosystem where DeFi protocols can use onchain metrics to better define their interactions within their product or platform.
Just to remind you, Chainlink is the industry leader in embedding WEB 2.0 data into the WEB 3.0 ecosystem with a robust set of benchmark indices, such as cryptocurrency price streams, that are used in various areas, such as decentralized exchanges and decentralized lending.
Partnership with The Graph allows Chainlink to send important onchain metrics directly to projects in near real-time, reducing the delay in delivery of important information, which better shapes the user experience. Here are a few more use cases:
- Using the subgraph to catalog liquidity on the blockchain. This helps calculate and cross-compare slippage on decentralized exchanges;
- Using the subgraph to catalog the average amount of gas consumed per block for each transaction and calculate recommended gas fees;
- Using subgraphs as APIs to integrate global real-world data (offline) into dApps, such as competition results, user IDs, financial assets, and so on.
Chorus One is an operational infrastructure that helps users securely increase the amount of digital assets they hold through staking. Chorus One operates with two separate sets of nodes to validate and verify information in different geographic regions of the world.
Ethereum Name Service
Ethereum Name Service (ENS) is a system for conveniently identifying addresses on the Ethereum network. It associates a long combination of address characters with easy-to-remember names. The platform offers a secure and decentralized way to refer to resources using easy-to-read names. It is a fully distributed domain name provider that allows anyone to buy and manage domains, which means you can send ERC-20 tokens or ETH to something like “realsatoshi.eth” instead of the long character chain “8e866f012fb8fb…”
ENS is built on Ethereum’s smart contracts, making it more secure, private, and censorship-resistant than the Internet Domain Name Service (DNS). The ENS team views the Internet’s naming infrastructure as a fundamental component that must therefore be open, decentralized, community-driven and non-commercial. On a technical level, ENS can use the existing Ethereum ecosystem, which means it is well programmable and can interface with other smart contracts.
Bancor Network is the world’s first decentralized liquidity network. In other words, it is a project that allows for the automatic conversion of one token into another. This is made possible by the creation of the Bancor Network Token (BNT). It is a digital currency with a built-in converter that allows it to be automatically exchanged for any token in its network directly from the customer’s wallet.
Aave is an open-source lending protocol. This protocol generates percentage tokens, called aTokens, when a user locks collateral for ETH in a collateralized debt position (CDP). The tokens are tied 1:1 to the collateral held in the smart contract.
Aave uses a decentralized lending pool (or DLP) model. The project switched from a direct lender-borrower matching model to DLP while rebranding from ETHLend to Aave. In the DLP model, the borrower receives funds from a large pool of funds held in reserve instead of directly matching users in a transaction.
The interest rate on loans and deposits is determined algorithmically. It fluctuates depending on supply and demand. Users place their collateral in ETH into a CDP to withdraw a percentage of deposited funds as a loan. The amount of money a user can withdraw depends on the Loan-to-Value ratio (LTV).
The 2KEY team has created a social economy that provides a new economic model for online exchange and rewards various participants involved in distributing online content and exchanging links. 2KEY uses multi-step tracking technology to track and record every person involved in the link exchange chain. The protocol also acts as a Layer 2 scaling solution for Ethereum and includes Action Redirection Contracts (ARCs), which are newly patented solutions allowing 2KEY’s multi-step tracking technology to be initially integrated into the blockchain infrastructure.
Each contract executed on the network produces its own ARC packet that acts as its own Web 3.0 multi-step tracking mechanism for transitions and conversions, which can also be viewed and interacted with any ERC-20 compliant client.
With the current hype around the field of decentralized finance we can conclude there is great importance for developers to have easy access to blockchain data. Making the process faster and easier for everyone could significantly impact the growth of the DeFi ecosystem, as well as its reliability, security and speed. Until recently the need to create an information bridge between applications and blockchain data was in-demand and The Graph is actively trying to fill this gap.
By deploying smart contracts that depend on user data, The Graph has established itself as an easy-to-use, cost-effective, and rapidly developing project. The platform is seen as a promising tool for empowering everyone in the community… especially blockchain developers.