Substreams Builders: Spotlight on Thomas Monte and Substreams Triggers

Substreams, Insights, The Graph By Jun 11, 2024 2 Comments
TL;DR: Thomas Monte is a NYC native and a passionate member of the BuildersDAO. He shares his history with The Graph and his thoughts on new features in the space, e.g. Substreams Triggers.

Kevin McGowan (Pinax) met with Thomas Monte from The Graph BuildersDAO to better understand Substreams, and to learn more about why Thomas is so passionate about this space and what he thinks will come next in the ecosystem.

The rise of AI

Kevin McGowan: Substreams is still very much an evolving technology, but what do you see as the next big thing?

A hyper-realistic photo of Thomas

Thomas Monte: I think what I see, especially with AI coming together, I’m excited for Substreams to evolve into a low-code or no-code solution. It would pump out a Substreams for you. “Here’s the contract, here’s the data aggregation type, etc.” and just asking it in a human-readable way.

For example, “I want all the user balances for this,” which would enable someone to come in with no Rust experience or any coding experience at all, with Substreams as the backend.

So that’s where I’m most excited and I have a feeling that that’s where the minds are behind the scenes because it just makes sense.

How it started: a portfolio tracker

KM: How did you get started in The Graph ecosystem?

I have always been big into IT and have followed technology and where it moves and goes. That has always been a hobby of mine.

Then crypto came along, and then DeFi and the market got hot again. I really got involved in these little niche protocols that were popping up every other day.

It was really difficult to see my portfolio, so I went out and I started in these little niche groups on Discord and Telegram. I built my own portfolio tracker and pushed it out. “Hey, you guys could check your balances here if you want.” It blew up. I had five, six thousand unique wallet addresses a day being requested through the API. It was a fun time, and that’s really how I got my start in crypto.

How it’s going: using Substreams triggers

KM: What is it that you’re working on now?

Yes, so the BuildersDAO works within the ecosystem and we have a job structure (bounties). We may work with Edge & Node or The Graph Foundation directly or some of the members have partnerships outside of the ecosystem, and that’s where I come into it as the sales guy. So I’ll do some type of outreach with new chains and protocols, a type of marketing to say “Hey, listen, we’d love to build some type of indexation for you.”

We post the jobs internally once we acquire them, and then one of our members picks them up, so it’s kind of like working freelance. But we all sharpen each other’s skills in a way too, which is great. We have a good base of people to bounce ideas off of and maybe get some help.

Right now our Substreams jobs have been a kind of replication of existing subgraphs and determining how you would do this in Substreams. That was our phase one.

We’re at a point now where we have redone the Curve protocol, and it is now a full-fledged Substreams. It’s similar to the way that Uniswap was done by Messari and the StreamingFast team.

We’re working with Teller, which is a lending protocol. I actually was working on that one myself, and it’s been quite the challenge. There is a drastic difference between how a subgraph interacts with the existing data that has already been written to the subgraph, versus what a Substreams is capable of doing.

So, a lot of times in a subgraph, you’ll create an entity, and let’s say it has an expiration date on it, right, like a timestamp that you store when it’s created and has an expiration timestamp. Now, what you may want to do is check every X blocks that this timestamp is now expired. And you want to set a new status to it. But you only want to do it for statuses that are of a certain type. So in a subgraph, you could say, “What does this entity look like right now? What is the current status? And what is the expiration?” And it just works magically.

In Substreams, you have map modules and store modules and you can’t read from a store that you’re writing to. So if I have a store that’s setting the status of an entity, and within that store, I need to check the current status before I update the status, you can’t do it. And that’s been a pain point when dealing with Substreams.

Something I’m really excited about is some new functionality within Graph Node that has this concept of Substreams triggers.

Prior to Substreams triggers, you would map out the exact entity change, and it would take those entity changes, store them into the database on The Graph side and then serve them up via GraphQL query.

The triggers do this: rather than take the entity changes, you can create custom mappings that will be consumed by a subgraph and then you could act on those mappings. Typically, you start with a block in a subgraph and your trigger is “Hey, a new block happens” or “a new event happened inside this block.” But you could take it a step further to just import the Substreams map module that you create, and that map module would output.

For example, “Anytime this price gets to this point, I want to be notified in my subgraph.” So you would build that Substreams out, go to the subgraph side, consume that map and now you know that anytime that map has some type of output being produced, you could then save the entity and still access the subgraph store. So it’s the best of both worlds where the Substreams may lack some features as far as accessing the store itself, but this is a great way to mix and match.

So you have pain points on the subgraph side (it can be slow, for example), but on the Substreams side, it’s extremely, extremely, extremely fast. But you’re kind of limited unless you want to build out full-fledged stores, which gets very cumbersome because then you’re essentially recreating a database in the Substreams, which is not really a good thing. So now you have a little bit of the best of both.

I’m really, really excited about this, and we have some bounties put up to do some basic use cases.

Learn & explore more

Are you developing Substreams or interested in learning more about this tech?

Watch Thomas in action during The Graph’s Builders Office Hours:

Author

Kevin is a Program Manager at Pinax, leading our Knowledge Team. A seasoned project manager (PMP, A-CSM), he frequently speaks on PM subjects at conferences across North America.

2 Comments

  1. Thanks Thomas for giving us an overview of Substreams!

  2. Thomas Monte says:

    Nice chatting with you Kevin!

Leave a comment

Your email address will not be published. Required fields are marked *