The Graph Developer Newsletter #5

🏗️ Subscribe to get The Graph Developer Newsletter delivered straight to your inbox 🏗️

gm web3 devs!

What a month May was! There’s always movement at an incredible pace in The Graph ecosystem, and we appreciate you taking a few minutes to read this newsletter for a summary of what some of the best and brightest are doing for our shared decentralized future.

We hope that by working on this summary every month, we make it a little bit easier to stay informed when building on The Graph.

Cheers everyone! 🙌


Before we go through these sections, please give us your feedback with this easy Developer Survey:

Developer Survey

Building The Graph Network is a collaborative effort and the core devs would love to hear your feedback!

How likely would you recommend The Graph's decentralized network to a fellow web3 developer? Just click the emoji to indicate your vote.

A short survey follows that you can answer or dismiss.

🙁  😐  🙂

Topics in this edition include:

  • Substream-powered subgraphs news roundup
    • Substreams at EthGlobal Lisbon
    • Substreams rapid sync time for Uniswap (from 2 months down to 20 hours!)
    • Start building substreams with an example repo
  • EthGlobal Lisbon Review
  • New Developer Blog contributions
  • Announcing The Graph Builders Blog

Substream-Powered Subgraphs News Roundup

Core dev StreamingFast has been working hard building substream-powered subgraphs for the past few years, aiming to make indexing blockchain data upwards of 100x faster. Substreams are gradually being brought to the mainstream, and we are seeing more and more substream-powered subgraphs at hackathons and in production!

Check out May’s substream highlights:

Substreams at EthGlobal Lisbon

Sahra Karakoc from core dev GraphOps shared her live presentation at EthGlobal Lisbon that detailed the power of substreams as well as diving into some of their components.

In the presentation, she provides a high-level overview of substreams as well as goes into the fundamentals of how to build a substream.

Substream-Powered Uniswap Subgraph Sync in 20 Hours

The Uniswap V3 Subgraph developed by StreamingFast and published on The Graph Network on May 19th formerly took 2 months to index without substreams.

Now that the subgraph is powered by substream technology, syncing only took 20 hours!

That’s a 72x speed increase!

This is a landmark in infrastructure architecture for all of web3 and we applaud StreamingFast for this massive achievement.

Start Building a Substreams-Powered Subgraph

Buidler Alexander Gusev of Soulbound Labs and BuidlGuidl built a very simple substream-powered subgraph that “only” tracks contract creations, something that was not possible with subgraphs before.

This serves as a great working example of a substream fueling a subgraph in action, as substreams are effectively a new data source for subgraphs. Not only can subgraphs listen to events, they can now gather much more granular data such as contract creations through the power of substreams.

To learn more about building substream-powered subgraphs, check out the brand new substreams documentation through The Graph’s official docs.

Developer Blog Contributions:

“The Graph Unlocks a New Web3 Use Case: Organizing Off-chain Data” by Craig Tutterow

With the introduction of File Data Sources, the door is now open for parallel indexing off-chain data through subgraphs. Edge & Node’s own Craig Tutterow goes through a few different use-cases of how this could be implemented in your dapps in his blog entry, such as hosting blog data, prioritizing content by having a custom feed based on publicly expressed behaviors, as well as real-time monitoring from an oracle.

It’s important to note how this itself is an important paradigm shift for The Graph ecosystem as a whole. On-chain data is the primary data source for The Graph, but now with off-chain data as another primary component of The Graph’s data pipeline, subgraphs are becoming even more powerful dapp data portals 🎇

“Two Simple Subgraph Performance Improvements” by David Lutterkort

Edge & Node’s David Lutterkortprovided a great blog post on easy ways to optimize a subgraph such as using Immutable Entities as well as Bytes as IDs. These two features are easy to implement in subgraphs and improve subgraph performance substantially.

How substantially you might ask?

When both features were used, block processing was 28% faster and there was a 48% decrease in storage requirements, meaning faster queries and improved storage capacity! 🔥

Let’s go through an example of an Immutable Entity as well as an example of using Bytes as IDs:

Immutable Entity

Converting a Transfer entity to an Immutable Entity is advisable when there's no plan to update the entity's shape in the future. For example, this immutable conversion would be appropriate in the case where an entity directly represents on-chain activity without additional logic being performed in mappings.ts.

Once converted to immutable (as seen by adding  (immutable: true) to the Transfer entity below), the entity is now unable to be altered in future subgraph updates and allows graph-node to be much more performant!

Bytes as ID

To share an example of Bytes as ID, let's look at the above example and convert the id type from ID to Bytes.

See David Lutterkort’s blog post for various strategies to transform data extracted from the blockchain into Bytes in your mappings.ts. By using the low-level type of Bytes for your IDs, graph-node can once again be much more performant!

These features are available in graph-node versions 0.26.0 and beyond, and subgraph authors need to use graph-cli version 0.28 or higher, and graph-ts version 0.26 or higher.

After reading his blog, check out the official documentation for Immutable Entities and Bytes.

The Graph at EthGlobal Lisbon Review

EthGlobal Lisbon was a huge success! From Sahra Karakoc presenting on substreams to Simon from Edge & Node on an account abstraction panel as well as a wonderful hackathon, it was truly a blast!

There was a significant increase in the use of The Graph during the hackathon - we had 33 submissions using The Graph! We just want to congratulate the winners and participants of the hackathon and wish you a happy building experience in all coming events!

Best New Subgraph:

🥇TreasuryDAO

🥈Mose the Hose

🥉LensPub

Best Use of Existing Subgraphs:

🥇Pinky Protocol

🥈dAlign.ai

🥉CryptoWise.AI

Pool Prize:

🏊Checkmarks.io, transparenza, Highlight, TurtleShell, Kangaroo Court, Natural Chain - AI Toolkit for the Blockchain, TBA 🤝 Lens, AI Mechs, Graph Navigation UE5, Coffin Finance, HarmonyLens, proto, ABINITIO, Peermatch, ShieldPass, Legit, Qsound, InfluLENSer, CommunityGiver, DeSave, DesignChain, DeviousLinker, Green-Pluto, Uniswap Risk Assessment, snake3.xyz, Prank Wallet, Zap Network

TreasuryDAO

The first prize hackathon submission for Best New Subgraph was Treasury DAO, a groundbreaking toolkit for on-chain treasury management of decentralized autonomous organizations (DAOs). Designed to address the limitations of traditional multi-sig wallets, Treasury DAO enables any DAO deployed on Polygon, Optimism, or Arbitrum to interact with DeFi protocols through governance proposal payloads. The subgraphs they designed indexed factory smart contracts, providing an elegant way of gathering data we loved to see!

We were inspired by TreasuryDAO’s project as it aims to improve the management of DAO coordination, something we appreciate!

Pinky Protocol

The first prize hackathon submission for Best Use of Existing Subgraphs was Pinky Protocol, a protocol that aims to revolutionize NFT lending and borrowing with a collateral-free approach. By integrating with the borrower's smart contract wallet, Pinky ensures secure loans without the risk of liquidation. Lenders can list their NFTs on the Pinky platform, specifying price and duration, while borrowers can select from available NFTs and pay upfront interest. The borrower gains full control over the NFT during the borrowing period, while the plugin integrated into their wallet prevents transfers.

The project leveraged The Graph to monitor for borrowing events through smart contracts to update their front-end, which was a clean and effective use-case for The Graph we enjoyed!

Announcing The Graph Builders Blog

The vision of The Graph is to be a powerful permissionless indexing protocol that is supportive, collaborative, and self-sustaining.

We are very excited to announce The Graph Builders Blog as a new valuable piece of this collaborative vision.

We know that building decentralized applications is not always an easy task, and sometimes it can be challenging to find the right resources and information. That's why we want to create a space where builders can come together, learn from each other, and share their knowledge with the wider community.

Perks of being an author on The Graph Builders Blog

  • Once The Graph ecosystem editors approve the piece, you will be featured on thegraph.com, with reach to hundreds of thousands of monthly readers, with you named and credited as the author of the blog
  • We will highlight and tag you in social media post, including our over 290K twitter followers
  • You will receive an exclusive “The Graph Builders Blog Author” POAP
  • You will be able to add, The Graph Builders Blog author to your LinkedIn and resume

To propose a submission for The Graph Builders Blog, fill out this form and we will review your proposal and get back to you shortly.

Thanks for reading this far. We hope you enjoyed this edition. Feedback and suggestions are always welcome, just reply directly to this email. We read every reply 💌

-

Happy hacking!

Marcus & Simon from Edge & Node, working on The Graph


How likely would you recommend The Graph's decentralized network to a fellow web3 developer? Just click the emoji to indicate your vote.

🙁  😐  🙂


Category
Graph Builders
Author
Marcus Rein
Published
May 31, 2023

Marcus Rein

View all blog posts