Kevin Jones I Best Use of The Graph with an AI Agent I Agentic Ethereum 2025
ETHGlobal·Thu, Oct 9, 2025, 12:00 AM
Speaker
Dive into indexing blockchain data with Kevin Jones from The Graph Protocol as he demonstrates how to harness smart contract events, build subgraphs, and integrate with AI agents. Learn why GraphQL and subgraphs transform how you manage on-chain data, see a live demo with CryptoPunks, and get insights on using Scaffold-ETH and Substreams. Whether you’re a newcomer or a veteran in Web3 development, discover how The Graph enhances AI-driven dApps with faster queries, better data insight, and seamless developer experiences. 00:00 Introduction & Agenda 00:37 Why Data Indexing Matters 01:04 Config & Architecture Overview 02:32 Handling Large On-Chain Data 03:35 GraphQL & Subgraphs Basics 04:35 Manifest & Wasm Handlers 07:03 Live Demo: CryptoPunks Subgraph 09:26 Deploying a Subgraph on The Graph 11:15 Querying with GraphiQL Explorer 13:26 AI Agent Integration Ideas 15:08 Substreams & Extended Tools 17:24 Hackathon Use Cases & Prizes 18:59 Final Thoughts & Support Channels _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 🤖 *Agentic Ethereum* Agentic Ethereum is an online, async hackathon that runs from Jan. 31 to Feb. 12, 2025. With over $175,000 USD in prizes, Agentic Ethereum is a great way to dive into the world of autonomous AI agents and explore how they can revolutionize projects on Ethereum. Start the year with groundbreaking innovation! Watch the full playlist: https://youtube.com/playlist?list=PLXzKMXK2aHh7jxP_flgRf5nZ_WDgFpBy3&si=RZozbd9C5KrG6Bf3 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ✅ *Follow Kevin Jones* X: https://x.com/cryptomastery_ YouTube: https://www.youtube.com/@cryptomastery_ ✅ *Follow The Graph* X: https://x.com/graphprotocol Warpcast: https://warpcast.com/graphprotocol Website: https://thegraph.com YouTube: https://www.youtube.com/c/GraphProtocol ✅ *Follow ETHGlobal* X: https://x.com/ETHGlobal Warpcast: https://warpcast.com/ethglobal Website: https://ethglobal.com YouTube: https://www.youtube.com/c/ETHGlobal _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _Are you interested in Ethereum development and entrepreneurship?_ 👉 Sign up for the next ETHGlobal event: https://ethglobal.com/events 🎁 Get exclusive access and perks with ETHGlobal Plus! https://ethglobal.com/plus 📣 Want us to throw an event in your city? Tell us where! https://ethglobal.com/city _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Transcript
[Music] what's up guys my name is Kevin Jones I am a developer relations engineer working on the graph protocol and today I'm going to be talking to you about the graph and how you can utilize building on the graph to enhance your AI agent I'm really excited to see what you guys can build using the graph data so without further Ado let's get started okay so again uh we're going to be talking about the graph we're going be talking about indexing smart contract data and uh again my name is Kevin I work in Devil for the graph I also support the build Guild working on scaffold eth uh but I'm really excited to have you guys here today we're going to try to fly through this intro because uh I want to get to the nitty-gritty and actually do a demo and maybe showcase um the power of the graph so first of all uh we're going to f out what the graph is why it's important we're going to talk about the configuration the architecture and then we're going to do a demo okay so first of all why do we need data indexing so for the most part you can uh I think everyone here knows you have a smart contract and you want users to create these transactions on your smart contract uh if you're a good smart contract developer your smart contract admits events right you you probably care about that stuff right that's stuff you want to keep track of um and uh if we think of a good example is like the Crypt punks nft right it's very simple it's just a list of IDs Crypt punks who their current owner is and then the metadata URI which is like the offchain data and those owners change right as transfers happen people buy punks or send them to their friends if they're super rich uh these events come off and we want to keep track of that stuff right so how do you get that stuff well it's kind of hard uh on the blockchain right if you want to get the data that you care about you're probably going to uh query it using an RPC right you're going to use it the the standard RPC so it's very difficult to find exactly what you're looking for I mean yes you can know the contract and you can kind of query for a specific um block right to get the data you need but the minute you want to get like multiple uh protocols or if you want to get um large number of different transactions for a particular protocol it gets a little hard to do we also have this issue where the original idea for building a Dap was that you would have a user interface ux like uh HTML sa JavaScript CSS and you would read and write from the blockchain well most blockchains are incentivized for rights right you pay gas to update the state of a variable and that's the security layer of the blockchain but when it comes to reading data it's not very effective to read from the blockchain so what we really want is uh to speed that up and and and we can do that with the graph we'll get there Providence we also don't know over time like what has happened in any particular smart contract without knowing the exact block number and then going back and looking in time and that's very hard to do and so what we really want is something like time machine on the on the Mac which is I guess still a thing but you can go back back in time and you can get changes to a particular smart contract right or in our case we want to know exactly what happened to the Crypt punks at at a certain time and so we also have this issue of like frontend developers is struggling trying to get the data they need from an RPC provider they end up having to get it from an an indexer because in order to get large amounts of information from different blocks and um you you might have to do something like this which is actually code we saw in the wild where someone was trying to Loop through and get all the nfts in a wallet which is fine if you only have a couple or a handful but if you have lots of nfts like me um you know you're probably going to have issues loading my wallet with this code uh in their application and so what we want is the graph uh the graph is the solution for a lot of issues when it comes to blockchain data and the graph is a decentralized network of indexers that are serving data there's over 200 indexers uh there's over 100,000 delegators providing stake to the network there's over 10,000 subp graphs which are unique apis that give access to blockchain data and there's over 10,000 curators that are curating data and signaling for high quality subgraphs and so this makes for a very robust and diverse uh uh network of uh infrastructure that the graph provides so we take this idea of a a huge number of uh transactions and wallets and stuff going on and we can consolidate this into what are called subgraphs right these are individual buckets that allow you to get access to that data in an easy to query way over graph ql so the one of the most important factors of the graph is it utilizes graphql uh graphql is very very powerful when it comes to getting lots of information because you can make one simple HTTP request and get lots of entities back with all of the data that you care about in one single request so we have this slow application we can replace that read with an indexing protocol a middleware layer that we call the graph and then we provide that data uh in an easy and easily accessible effective fast way uh that's very friendly to interact with so the config what does it look like well like any software all softwares has a configuration file that's what we call the Manifest it's the highlevel yaml configuration that keeps track of what network we care about the contract address how we want to um configure the entities how we want to handle the data as it comes off the blockchain it references those two other entities and the wasm uh file the handlers the entities you can think of as um the schema file like how do we want to store that data and expose it over graphql like what kind of data types are coming off of the events as they get stored into graphql and exposed or into the database and then exposed via graphql and then the handlers which is the wasm is what we call the mappings or the handlers and it's how you we we actually process the data so it's it's written an assembly script and it's compiled down into wasm code um the nice thing about this is it's very um secure Focus it's very fast uh and it's a subset of typescript so it has Type support and it's very very easy to work with um very very powerful and so all these kind of like tie together the manifest like I said is the the highle config that references the entities and the WM the the handlers so then um as your application amidst these events and maybe these events have ipfs hashes or R weave hashes and we can go out and grab that offchain data as well which is really powerful or we can just index the event data and we can process it with wasm inside of the logic and those handlers and then we can put that and store it on the indexer in a special database um and then when someone wants to come and query that data they can make a highle request over graphql graph node which is the PowerHouse behind the graph uh can go back get the data it needs from the postgress database in a very highly optimized way and then serve that graphql response over over the HTTP request and so what we're left with is is this this is the architecture that we really want right we still have a Dap HTML CSS JavaScript it's the front end is what we call the DAP in this case we're still proposing transactions to the smart contract that smart contract is admitting events those events are being processed by the wasm module and then stored in the database in postgress and then the graph node is then exposing that data via graphql so that the front end can just query the graphql API directly the subgraph we also have a really good solution if you're new to building on ethereum this is a really great starting point it's called the subgraph extension um for scaffold eth scaffold eth is a kit that comes with everything you need to build on ethereum a front end a chain and then the subgraph extension is just an added extension that allows you to um uh it's like a monor repo folder that keeps track of all the graph uh in this case it's all running in Docker so you can run a local First Development right you can build your stuff locally you can test locally no need to deal with any test Nets super powerful um you can get full access to the database and so it's really good for probably some of the project you guys are going to be working on um and this is really easy to spin up you just run that command on the bottom and it will give you the latest version of the subgraph um really really powerful we also have a telegram chat please join uh there's a new channel for this hackathon go ahead and go in there and join if you have questions we'll also be in the Discord we have the the graph Discord and then the eth global Discord uh will'll be in both um I think this is probably the easiest way to get a hold of people because all of our sport guys are in there and uh the devil but uh we'll we'll keep an eye on on uh all of that but if you have problems please go here now let's let's do a demo so we we've been talking a little bit about uh cryptopunks so I kind of want to uh start with this so cryptopunks is really cool nft project obviously I think everyone here probably knows about Crypt punks they are little overpriced pictures that uh have sold for a lot of money so if we look on this website we say oh well the most expensive Punk ever sold largest sales is $8,000 eth right $23 million that's crazy um but uh we let's see if we can validate that data with the graph right so first of all let's go to the gra.com and let's take a look uh what can we do here well we have uh our our docs up here on the corner so if you want to build a subgraph you're going to want to go over here to quick start and it's going to walk you through everything you need to know to building a subgraph subgraphs are great for getting data from events uh and if you want to get more data there maybe like block data or you want to index things in a different way um like maybe you want to get access to ordinals and you want to get access to like transfers you prob want to look at substreams so there's a whole section on substreams I'm not going to dive too much into substreams but it's a good alternative way and you can also do substreams powered subgraphs so you can uh process the data using uh substreams and then you can store it in a subgraph so gives you a little more flexibility but we're going to be focusing mainly on subgraphs today uh so let's go back to the website and come up here to products there's two main products that you'll use if you're in the hackathon you'll probably use either the Explorer or the studio if you want to find existing subgraphs that are already created then this is the place to go so you can see the most popular ones on the top here by curation signal and so these are like some of the most popular ones there's a test subgraph which is just tracking how the Network's operating but then there's the Unis swap one and the substreams Unis swap powered subgraph uh substreams powered subgraph there's the snapshot um uncx live Pier so if you're looking for existing data come here first see if there's already a subgraph and then use that subgraph if it doesn't have the data you need you want to build on top of it then you'll probably want to create your own so let's assume we want to create our own there's probably a crypt Punk swung in here but I'm going to want to build my own so let's go over here to the top and let's instead go to the studio so we're going to come to the studio we're going to create a subgraph so if it's the first time coming here you might need to uh log in I'm going to show you what that looks like but you can click connect choose metamask go ahead and sign connect and sign your transaction and it will kind of bring you in here now uh I already did this here but I'm going to go ahead and walk through it we'll create a new one we'll call it CP yeah sure crypto Punk CP hit enter and it's going to spin up like an empty shell for us for to build a subgraph so what do we need to do well we can put in details here later we don't care about that but everything we need to set up the subgraph is down here on the corner so it's going to walk us through it so the first thing we want to do is install the CLI okay so we can use npm or yarn so let's do that let me go out of here new terminal and let's do that so it might ask you to install a certain version of node you need to use node version 20 or higher I've already installed the CLI so there was nothing new to install um next we can do a graph a knit so let's do that so graph and nits will kind of spin up an empty uh project for us uh called CP and then it's going to ask us what network we want to index so you could search whatever if you were looking for bass you could type bass if you were looking for you know whatever Network Zora you know if you looking for Linea you can type it in like that we're going to use ethereum mainnet because Crypt punks was a OG project um it asks us what we want to uh index is it a smart contract or do we want to use substreams really cool you can use substreams but for this one we're just going to do a smart contract uh we're going to name it CP we're going to put it in a directory called CP and then it wants the address so let's go grab the address I I just happened to grab it right here we get it from ether scan copy it paste it in here now it's going to go out it's going to fetch the ABI for us automatically it's also going to fetch the start block so that's really important you need the ABI because it's going to generate Events off of the entities um or entities off of the events sorry and it's going to need the start block because you don't want to go all the way back to Genesis right you want to only index from the time of the you deployed the contract so in this case it's uh 3,914 495 and if you needed to get that you can come here and look at the transaction to see what that is but it's right here um and then it's ask for the name of the contract it also grabs that automatically enter and then the last thing is it wants to index the events as entities so we want to say yes because we want to look at all the events and build out subgraph automatically so it's going to do that by going in and grabbing the ABI if you for some reason didn't have the contract verified you can manually give it the ABI and it will do that for you then it's going to empty create an empty repository it's going to install the dependencies with yarn it's going to generate this the types and it's going to generate all the code and it's going to uh make sure everything is good like syntax wise and then it's going to ask you if you want to add another contract which we're not so we'll hit false and then we're ready to go so now let's deploy it let's go back to here we need to authenticate to the server go ahead and click authenticate and then we need to uh go into the directory and then we need to run a Cod gen and build just one more time just to make sure that there's no type errors or any issues with the WM uh being built nope it's good and then the very last step is to deploy it so now we can deploy it so you can see how easy it is you just put in the contract address and as long as it's verified it's going to do everything for you you need to choose a version so we're going to do version one you can add the versions as you build right there we go now it's uh deploying and it's deployed so let's go back here and let's look all right it's fully deployed because I've already deployed this one before in the past we have it here so we have the playground and we can hit play and we can already get data right it's working we get the data it's fully indexed now the thing is is we want to look and uh at the sales so we can come here to the graph iql Explorer and look and look at all of the uh entities everything that's in the entities is going to be here so and it's very exploratory so we can explore the punk Bots let's get the first 10 let's order by their value and let's get the ID the index who was two who was from and the value yeah sure hit play uh it's giving us value zero so what we can do is order Direction descending play there we go so now we can actually look here the most expensive Punk ever sold is 9998 well if we live here that's not here at all so what's going on well if we look here 9998 sorry is right here that's how much we it was it comes up to like 124 e or something like that is a lot so um what's the what's the thing well you can look up on it but this uh Crypt Punk was a wash sale so basically this sale is being censored on the Crypt Funk website because they don't feel that it's an appropriate uh sale like it was basically bloated the price was bloated so you can kind of read up about it but the whole point is that the data on the blockchain doesn't lie right we're able to get exactly what we need um so uh if you're going to create a subgraph uh you can come here to uh the subgraph studio you can build one if you want to use an existing one you want to go to the Explorer if you're uh just new to the Explorer or this studio you can create a free API key with 100,000 queries if you need a better API key let us know we can get you one if you run out of queries um uh what we're asking is for people to create uh the best use oh essentially the best use of the graph in an AI agent so um just to give you guys some ideas i' I've kind of come up with a couple ideas that I think would be interesting for first is if you're using bass uh maybe extending the CDP agent kit to uh integrate with some of our uh apis some of our subgraphs and that could be done maybe by um either adding capabilities and integrating with the Lang chain tools so you can do things like a graph ql Tool uh and integrating there you could also maybe just uh use Lang chain and you could uh ex use the graphql L chain tool that's available to get some data uh and Define that uh Custom Tool that way or you can create your own tool with linkchain as well so those are just a couple ideas to get you started um you could also run the the full stack and maybe like index some data and then do some like local kind of air related stuff on it on your local machine uh maybe over a database if you're using substreams um didn't get too much into substreams but if you can go on uh substreams website uh for uh streaming fast uh well here introduction to substreams on the docs uh this is a way of doing data processing um it's a little more composable and you can output data to a database uh so if you want to like create your own substream store it in a different database and maybe have your agent talk to that database that's an option as well but either way we're looking for the the best use of the graph inside of an AI agent so we'll have three different prizes first second and third so we're excited to see what you build uh again if you are just getting started um and you need support or anything like that please please uh join the telegram here uh reach out if you have any questions and uh really excited to see what you guys build and good luck and we'll see you uh in the future thank you [Music]
Automatic transcript — names and jargon may be misspelled.