Indexing blockchain data with Subgraphs and Data Pipelines
Indexing blockchain data with Subgraphs and Data Pipelines · 18 Jun 2025 · 46:18
Andrew Gelman gives a deep dive on how to index blockchain data and create subgraphs and data pipelines using Goldsky. It is aimed at developers who need reliable, queryable onchain data for their applications.
Speakers
Topics
From Indexing blockchain data with Subgraphs and Data Pipelines, hosted by Ethereum Engineering Group.
Transcript
Hello and welcome everyone. My name is Peter Robinson. This is the Ethereum engineering group meetup. Today we've got Andrew with a little help from John who are going to tell us all about um subgraphs and um processing them um using gold sky. So um before you kick off your talk, Andrew, can you please introduce yourself? Yeah, absolutely. Thank you, Peter. Hey, everybody. So, my name is Andrew Gellman. I'm on the Gold Sky team. I am the customer success manager. So, basically what that means is I get to do all the fun stuff working with all of our various chain partners and the DAPs that leverage us and projects. And
really, my my main goal is to just figure out, you know, what are the problems people face when it comes to indexing and how can Gold Sky come in and really streamline all their operations. So I get to do fun stuff like usage analytics, a lot of ecosystem engagement such as workshops like this, some fun co-arketing. So I really just get to talk to a bunch of awesome people and learn about what they're building out and find out how Gold Sky can come in to essentially make things easier. Sounds good. So please um dive in and take it away.
Yeah, absolutely. So to give a little background context everybody for why we're even here today. So um one of the chains that we work with is immutable and Peter and I have been you know recently syncing a lot and just discussing about ways to to optimize that relationship and one conversation we had one day um you know this group came up and I was really excited to come on and talk to you guys all so excited to be here um so yeah I mean I think to really dive in and before we really start demoing all the projects u or all the the products we have available I think it's really important to understand what exactly indexing even is, right? Because there's a problem that it's solving and understanding how it works really comes from
understanding, you know, why not using it is problematic. So, when you're reading onchain data directly, it can be really challenging and difficult because you're dealing with raw logs. There's no decoding. RPC calls are often rate limited and slow. So, they're not really designed for complex queries. So typically you'll have to build your own ETL or write your own custom indexers. So essentially when you're reading onchain data, it is very limiting as far as the kind of use cases you can create and the DAPs or projects or protocols that you're building can't be as customizable and you can't really make it, you know, a similar fast experience that we're so used to with the web 2 world today. So that's where indexing come uh comes in. And it essentially
turns really messy blockchain data into these structured fast queryable data structures that allow you to, you know, really efficiently query specific information because you can get decoded events, organized entities, and essentially just instant access to data that your app needs without having to really go through the headache of reading onchain data. So a lot of really cool use cases are enabled when you are using indexing and it can be critical infrastructure for something like dashboards for Dows or wallets or if you're doing some kind of real time bot that reacts to certain events on chain.
You know there's a lot of cool use cases whether you're looking at historical data or live onchain data that requires you know really really quick real-time data. There's a lot of different use cases that indexing uh unlocks and that's essentially because of how it efficiently lets you access this onchain data. So, you know, another cool use case too we've been seeing is a lot of point systems or rewards distribution or they'll calculate APR based on, you know, onchain activity. So, a lot of really awesome things that can happen, especially when you have fast data. Um, so basically any DAP that requires onchain data can leverage indexing to really help themselves scale to get to a level that has that same speed that
everybody's used to and familiar with, right? So today we're going to go over a couple different ways that you can index with Gold Sky. Um, so I'm going to go ahead and share my screen and show you what is possible. And we're going to start off diving into subgraphs. Now, if you have not yet uh you know used uh Gold Sky before, you don't have an account, I'm just going to really quickly show you how you can sign up. Super fast, super easy. So, all you got to do, golds sky.com, hit that dashboard button, and you just sign in with Google. It's as simple as that. It's super easy. You don't even need to put in your credit card information. Um, we have a free plan
where you can get started, deploy some subg graphs and it's, you know, very easy to get started. So, you don't even have to commit to anything. You can just get started, play around, deploy some subgraphs and see what's possible. Um, of course, I already have an account, so I'm going to dive in and show you um an example of how to deploy. But before I do that, what even is a subgraph, right? Let's kind of dive in and dissect that. So essentially you can think of it as this hosted GraphQL API endpoint for specific smart contracts that you want to index whether it's uh you know a protocol or a DEX or a specific asset or even just a specific chain. You can deploy a subgraph and you can think of them as these data structures that will
allow you to really efficiently query the data you need. So you can set up specific queries whether it's a specific address you want to follow or a contract or you know whatever it is for your DAP if you want to have very custom data you can optimize it so that you can plug it into your front end your backend you can make a dashboard you know really the possibilities are endless and you can get really efficient about the queries that you write so that you can optimize for speed and you can make it just a very smooth experience. I like to think of it almost as if it's like a magnifying glass on chain, but you're able to find what you need basically immediately because it's very quick. So once you have an account set up, once
you're up in the subgraphs page, we're going to take a look at how to deploy subgraph. So you hit deploy subgraph and you see this little window pop up. So, for this example, um I'm going to be using uh the USDC smart uh contract because I mean stable coins right now especially have been such a popular trend. I even saw I think it was today JP Morgan is launching their own stable coin and so stable coins are very very prominent in the industry and so I figured for this example I'll use USDC because that's a very popular one.
Coinbase has it just plugged into their ecosystem. Everybody knows about it. So if we wanted to figure out some information about USDC using subgraphs, first things first, what we'll want to do is open up that contract on Etherscan. So if you're not familiar with Etherscan, that's basically an explorer where you can just search up any kind of asset, contract, transaction, shows you a bunch of information about it. So what you can do here, um, I already have it up, but if you were to search for the for the token, you can find it there. And so the first thing that you want to do is open up the contract and get the address from that. So this is the USDC token. This is the token contract address. So simple as copy paste. We'll take that deploy it
here. Paste the contract address. And you'll want to name it for this. I'll just go let's go USDC example demo. Next up you're going to want to choose your network. uh for this because this is the Ethereum engineering group we're going to go mainet but we have a lot of different networks so if you're trying to deploy on an L2 or you know another L1 you have a lot of options but for this example we're going to use Ethereum and um there's a lot of data out there on Ethereum of course so last but not the last couple options are the start block and then the contract API so start block is very helpful because if you want to index from a specific time you
know you can choose a block And then that way you're not indexing all the way from you know the genesis block right so in this case because we might want to optimize the subgraph and not have an overwhelming amount of data we can choose a specific start block. So in this case I'm going to actually open up the contract address page and you can see here that it was deployed about six years ago. So that can show us the start of the contract. But I don't even know if I want to go back all the way to six years. So, I might just do something more recent. So, why don't we filter by completed transactions. These were about 17 seconds ago. So, maybe we don't want to do 17 seconds ago. So, maybe we'll bring it back. Um,
let's go like that. So, we'll bring it a little bit back just so that you know it's fairly recent. It's going to be kind of a smaller subgraph. Um, and it'll just query it really quickly. But, yeah, we can choose a start block. You can be really custom about what you want. So, if you have a specific date range that you want, um, you can throw that in. And then last but not least is going to be the contract AI. That's going to be really critical for us to have, you know, all the data points we want as far as the entities that the subgraph is going to be querying. Now, one thing to note is that in the explorer, when you go to the contract page and you find the AI, you want to double check that it has all the information you want. So, for example,
with USDC, we'll probably want a lot more information than what's is in here. And the reason for that is because sometimes the contracts are proxy contracts. So, a little cheat code for you to know uh if you click more options here and then is this a proxy, you'll be able to confirm whether it is a proxy contract. So, in this case, it is. So, we'll want to verify and go to the correct contract so that we can get the AI from there. And then that way you'll see that there's a lot more information here. So essentially this is just going to make the data much more rich and we'll be able to query a lot more information. Um and to be honest most of the time ERC20 contracts they
have the same AI. Um, so you can typically use the same one, but this is a good practice to know because if you're doing another chain or, you know, it's another L1, different L2, depending on the chain, you might want to have the specific contract ABI for that and it might be different. So, always good to check, but in this case, we're going to go ahead and copy this AI, put that in here, and now we have all the data that we will want for the entities. We have the start block, network, contract address, and name, and we're good to go. And it's simple as that. So we're going to deploy the subgraph.
And one thing to note is over here migrate existing. What that means is let's say you already have another provider where you have subgraphs deployed or you're using the graph for example which is a very popular uh subgraph provider. Maybe you'll want to switch over and use gold sky. So you can actually migrate existing subgraphs and it's a really easy process within the gold sky CLI. uh you can just make that uh command and it just makes it very easy to just you know move your existing workflow. So whether you're creating a new subgraph or migrating a subgraph uh it's a pretty simple flow and we have docs in our uh we have guides in our docs so docs.goldskuy.com goldsky.com and we can send out links after. But essentially deploying a subgraph, as you can see, very simple process. Um, and
while we're waiting for this to index, I'm going to quickly go over just some of these page details so that you can have some insights, you know, into what these metrics available are so that you can have a better understanding of the subgraph health. So first and foremost entities that just essentially gives you insights into you know how much data your subgraph is indexing which is helpful to keep track of usage and also costs as you're starting to deploy a lot um because that's based on um what the costs are are you know focused on it's the entity usage. So entity count this is going to be very helpful to track.
Now, next up, you've got API requests. And this is pretty cool because this essentially tracks the count of the GraphQL API calls made to your subgraph. So, as an example to kind of show you what I mean by that, um, each of the subgraphs has its own public Craft Q GraphQL link. So, when you click over here and it opens up here, this is where you can be querying your uh, subgraph and figuring out the information that you want to index. Right? So over here you have this explore where you can kind of see all the different information that you can query and if you think look back to the AI a lot of these terms are in there. So essentially this is you can think of the API as almost like a
skeleton for the kind of information you're querying and then this allows you to index that and then it'll display it. So we can check here it's about 14% done. It's fairly quick. Um, and you know, obviously the more data you have, the longer it'll take to index the subgraph. But as an example, I'm going to run this query. And now you'll see a bunch of data populate. So what I did is I took the first 100 transfers, uh, ordered by block number, descending order. And so the from, the ID, the time stamp to value, all of that is shown here. And what's pretty cool actually is if you were to take some of this information, you can actually search for it in Ether
Scan and you can find that as well. So let's say we search for that. Oh, no, it's over here. You got the ID. So it has a dash4 in the end. You want to kill that? Uh, which part? At least what you paste had pasted had an ID in it. But yeah. Okay. The dash after. So it's like -414. Yeah. Yeah. D414. So that is I think giving you the transaction. So the ID is the um transaction hash and the dash and the number after the dash is the transaction
count. So within a block you've got say for there I think it was 414. So that means that was the 414th transaction in the block. So um yeah, it's just some additional information. Um there we go. We're we're all learning together today. Super cool. Um so yeah, you can take that transaction and drop it into Ether Scan. And as you can see, you know, the information on here is very similar to what you're going to find on here. So that's the two address. You got that D40. Let's see where is that at. D40 over there. the from address 404, right? 404. So essentially a block explorer like this is almost certainly
using a subgraph to display this information, right? Because you got to index onchain data. So you can actually build your own explorer if you wanted to using subgraphs by calling these API endpoints that um you know you get once you deploy a subgraph. So and now see this is deploying uh indexing. It's already 37% complete. It's pretty fast. And every time that you call the endpoint, that's when the the requests are going to go up. So, we'll call it just a couple times just to show you. And it goes up. So, entities to kind of recap, that's just going to show you the overall usage data and give you insights into, you know, how much data you're indexing. API requests when you wherever
you plug in your uh your you know endpoint whether that's into your front end or if you're just calling it to just figure out whatever data you want to learn about. API requests are going to show you you know how many you have and then the latency as well. Now in addition to that you've got a few other different metrics too. Um just to point out some for example ETH call that's to show you like you know the number of onchain ETH calls made and their latency which could help you uh identify either an expensive or slow contract just to give you insights into the contract information. But what I think are the two coolest parts of this page are tags and web hooks. So as you can see over here there's this version number. So what you can do is you can
create a tag and for this example I'll do prod like for production. So let's say you create a tag and now you have this new graphql endpoint and as you can see here instead of it being that 1.0 it says prod. So let's say you plug in this endpoint into one of your apps or into a dashboard and you realize that you need to redeploy the subgraph because you have to make a new version with either a different contract or you want to customize the query. Essentially tags allow you to deploy new versions of your subgraph. So you can have the same name and deploy a version that has different modifications in it. So although it might be a different
version, if it uses the same tag, then you don't have to make any changes in your app or in your backend. So this is just a really efficient workflow optimization that basically makes it so that developers can, you know, securely work with different versions of subgraphs without it affecting anything downstream. So it's a really effective way to just simplify that workflow because oftentimes you will have to redeploy a subgraph and make some changes. So using tags is a very effective way to just kind of streamline that experience. And web hooks are super cool. So essentially web hooks, they send these HTTP notifications to your backend anytime a subgraph writes a new entity.
So it's effectively syncing subgraph data with your own systems in like this automated fashion. So it can unlock a lot of really cool workflows. And web hooks are a very cool way to just basically automate the flow as you're you know indexing new inch onchain data and a couple other aspects to just to point out. So over here the entities this is again you know kind of showing you of what you have in the AI what are the different amounts of the various entities that are called. So here we've got a ton of transfer events, a lot of mint events, some burn events, approval events, right? So this is just really helpful to as you deploy subgraphs get a good understanding of okay, what kind of
information should I expect? And this is going to show you just a breakdown of what there is there. And then we also have logs. So logs are very useful when you're trying to debug or if you just want to get some insights into what's happening with the subgraph. So logs are just very useful to just kind of you know view errors, warnings, events happening, that kind of thing. So yeah, that's a subgraph. It's a very simple way to just deploy onchain if you want to get insights into onchain activity and it's basically like the classic way to read onchain data, right?
But subgraphs have been, you know, for a while around and as far as they they go, they're very useful in certain situations where you may just need to query a specific contract data or there's just a subset of information that you want. But as DAPs lately have been, you know, really really optimizing for speed and as chains are rapidly growing, you know, transactions per second are going upwards of 100,000 200,000 uh per second for a lot of these L2s. Scalability issues and limitations definitely arise with subg graphs. And for example, let's say you want to combine information from multiple L2s.
You know, you're not just looking at Ethereum mainet data. Maybe you're looking at um you know, rise chain or you're looking at base and then now you're looking at uh optimism. You know, there's so many different chains and there's probably going to be a lot more that come around. So if you want to combine data from multiple different chains, you would have to deploy multiple subg graphs because you can't do all of that within one. So essentially there's bottlenecks. There's sometimes speed limitations. Um and when you want to combine data from multiple chains, it can be kind of an outdated experience to your subgraphs. So that's where mirror comes in. And that is the second way that you can index data with gold sky. So mirror pipelines are super super cool new way to essentially in the
same way you're you're you know querying onchain data but instead of having an endpoint where you know you're kind of pulling the data too you can now actually connect your database whether it's Postgress or click house AWS you're essentially taking that onchain data and you're using a pipeline which is a data stream and you're putting that into your own database and so as chains do get faster as DAPs do scale and there's you know hundreds of thousands maybe millions of users you tons of transactions per second real-time data becomes all the more important and scaling with your infrastructure is essentially critical because it can become a bottleneck if you do not. So to sum it up mirror streams onchain data in
real time directly to your existing database. So, we're going to take a look at how to deploy a pipeline. And by when you when you want to deploy a pipeline, um, essentially you just click new pipeline and we have this pretty cool UI. It's very very simple. We call it flow and it's essentially this visualizer that just basically breaks it down into really simple steps. And you can also, just for reference, do this same thing in the Gold Sky CLI if you want like a more traditional coding experience. But you'll find that the CLI is basically visualized on here in really cool blocks. So here's here's how you get started. So initially what you want to do is drag this over here for
your data source and you're going to pick the source. So for this example we're going to go with Ethereum and we're going to use an ERC20 transfers data set. So what we have are called data sets where it's essentially onchain information that has already been ingested. So it's really fast and a lot easier to just leverage that. So you don't have to um you know build out your own data sets. They're just readily accessible. So Ethereum ERC20 transfers is going to be the data source we'll select and we'll start indexing at the beginning of the chain. But what you can do is start with current. So if you're not necessarily looking for historical data and you don't necessarily want to look at trends from before, you only want to see what's happening moving
forward. Let's say you have a DAP where you know you plugged in some kind of pipeline into it and you want to track everything that's happening from here on out. Then you can just start indexing from current. But for this example, we'll go with beginning. And because we were using the USDC contract uh with the subgraph example, I figured why don't we just use the same contract for this example here too. So we'll go ahead and go back to the USDC token contract. copy and paste that address. And one thing to note is that when you are copying and pasting the address into the pipeline here, you want to make sure that it's all lowercase because sometimes the case sensitivity could
mess things up. So just be um you know cognizant about that and make sure that when you are pasting the contract address when you're making this source, just make sure that it's going to be all lowercase. So now that you have the source ready to go, you have a couple options for how you can proceed forward. So we have what's called transforms and that essentially allows you to customize your data a step further, right? You can essentially curate a subset of information specifically to what you're looking for. So in this case, you have a couple different options. You've got custom SQL and then there's the HTTP handler. So SQL transforms that basically lets you write a custom query so that you can output you know based on specific parameters you have in mind
whether that's certain types of um you know properties you want or a specific address as an example I'll show you an example query in just a moment but custom SQL that's a very popular option there's also HTTP handlers which can be used if you prefer to you know just do that logic in your own language on your end and then have it return back to the pipeline So you have a couple options, but for this example, we'll just go with custom SQL. So once this pops up, you now basically get the option to customize the query to what you want. So in this case, we're going to leave it as all because we do want to have all this information. But let's say we want to choose a specific
address that we want to query for, right? We want to just search for that. So I'm going to add as an example like a burner address. We'll go where the sender is equal to that. So what you'll want to do before you save is click run just to make sure that as it runs the query everything is functioning okay. And it's going to pop up in just a second with kind of just sample. It's not even going to be data. It's just to confirm that the query runs okay. And it should just tell you all right let's see where sender equals.
All right. Tech support. John, what what did I do wrong here? Looks fine. You can just save it. All right, cool. So, we'll go ahead and save it. Oh, maybe your quotes got sent in with like squigglies or something cuz Yeah, does look like now looks like a real error. Yeah, the last quote is a tilty one like that. All right, there we go. Yeah, very case sensitive. And uh that's the thing with coding, right? There's always that
little specific thing that'll get you, but we're good. And the query ran successfully. So essentially, it's just kind of spitting out here. This is what I can expect to see in the table once I do put that into my database. um which you know matches this over here. So we'll save that. We've got that ready to go. So now next up, the final step, uh you're going to want to create the sync that you want. You're going to want to, you know, connect the sync that you want the database to actually be connected to. Um in this case, we already have one plugged in. It's called ClickHouse demo.
Uh we like using ClickHouse for this example, but if you want to create your new sync, you have a lot of different options. So depending on what you currently use in your backend, you know, whether it's Postgress, AWS, Kafka, Elastic Search, you have a lot of flexibility on the type of database that you can connect. And currently in beta, as of recently, we actually host Postgress databases. So this is something relatively newer and it's a pretty cool one. But for this example, we're going to use the one that we've got connected, which is this ClickHouse demo here.
And one thing also you want to make sure that you're naming these just so that we can have some clarity. So for this I'll just call it mint and then this will be USDC mint call it demo. So essentially to just kind of sum it up, give you a little recap of how to create a pipeline, it's very it's very simple. You know, when you're using the flow gold sky flow, all you have to do, you choose your source, choose the chain, choose the data set you want. And just for reference, by the way, you can actually use a subgraph that you deploy as a data as a data source if you wanted. But data sets are just much
faster and it just it just makes more sense in a lot of the situations that you'll probably find yourself in. So you choose the source, choose where it starts indexing, filter by the specific contract address that you want and then once you add the query to basically customize for, you know, the kind of subset of data that you want once your sync is connected and you're ready to go. Last but not least, you want to rename the project. That's an important step. You actually cannot deploy until you do. So good thing to know. So, we'll call this USDC mints demo.
We'll save that and we will hit deploy. So, we'll give that just a couple minutes. But essentially once you deploy a pipeline you're going to see a similar kind of health metrics page as you did for subgraphs where here it's going to show you the sources you have connected which by the way can be multiple and the syncs you have connected which can also be multiple. So you have a lot of flexibility here as far as what kind of data you want to look at and you know where the data is going. So this is exceptionally helpful. Let's say you want to be, you know, combining different types of J chain data, right?
You want to combine arbitrum data with optimism with Ethereum mainet. You can have multiple data sources all go into the same sync in your database. So let's say you want to combine all the different superchain data sets. So you're looking at just all the various L2s in the OP stack and you put all that into your database and you query within your database so that you can really efficiently look at what's happening on chain. And so it's just a really cool way to just, you know, combine data in an efficient way. Also, a cool way is you can combine it with off-chain data.
So let's say you have your own database with information that you want to plug into it, whether it's for your app or just something that you wanted to, you know, get from another off-chain source. You can combine offchain with onchain in your database. So very cool use cases are unlocked with that and um all possible with mirror. So, just to show you as this is currently um being written, I'm going to go to Gold Sky Dash, which is where we have the database. Refresh the page. So, you can see here USDC Mints demo. This comes up. This is that table that I just created. And it's still loading. So, there's no results just yet. We'll give it a minute. So, now it's live. So, it's no longer
starting up. It's now live. And so basically now it's going to be um you know writing the records. So we'll just give it a few more minutes as well. But just like you had in the subgraph page before the various logs the logs will pop up here. And this will show us as well too when the information starts writing into the database. And you have your own YAML file here too. This is similar to what you'll find um you know if you're going to be doing this in the CLI and you want to go more the you know traditional coding route you know this is what you can be using.
So we'll just give this a second. But now that we've refreshed the page so about 20 20,000 records have already been received in the pipeline and 196 have been written into our database. So now when we refresh this page, you'll see all this information and you've got the ID, the block number, timestamp, block hash, right? This is all stuff that we wanted to find and it all goes back to, you know, the entities that we want to be putting into the database. So essentially you get the the pipeline, you deploy it, you pick your source, you transform the data, you put it into your database, and then once it's in your database, the possibilities are pretty pretty endless. I mean, the
cool part about this is you don't have to pull that data every time. It's just data streaming real time. So essentially, as there's onchain events happening, you can have real-time data in your database. So, let's say you have a a DAP where you plug it into your Click House database. And let's say, for example, some kind of onchain event occurs to trigger an action to perform in your app. It'll be really fast. It'll be literally real time if it's plugged in to a pipeline because as the onchain events are occurring, that's when the data is populating your table. So, and we'll refresh here. And you can see now already 863 records written, 172K records received. So essentially, as it's backfilling, depending on how long
um like depending on how far back you're going, that will impact how long it takes to backfill the data. So if you're going to be indexing an entire chain, that might take longer versus if you're just indexing, you know, a specific data set or a contract. And regardless, it's going to be a lot faster than subgraphs. So yeah, at the end of the day, it really just depends on your use case. But a lot of the time when you're going to be thinking about scalability and you're thinking about you know how am I going to optimize my indexing for you know as my app grows as the chains get really fast as data needs to move pretty fast you know you just really need to think about scalability pipelines are going to be the way to go and most of the time that's what we'd suggest
building out because you want to think with scalability in mind ahead of time so that you know as you do scale you don't have bottlenecks due to limitations of subgraph graphs, but subgraphs are also great. They have their own use cases, too. So, it really just depends on, you know, what you're trying to build out and, you know, what is the the, you know, main goal that you have. But, at that point, I'm going to take a pause there. I know I've been talking for a while, so wanted to open the floor to any questions if anybody would like me to come back and double click on anything I've shown you, or if you just have questions in general about indexing, uh, happy to, uh, answer whatever Um,
Raganda, do you want to have a Yeah, thanks Peter. Thanks Andrew for wonderful uh presentation. So I have couple of questions. So compared to uh block explorer uh my understanding is the graph is a decentralized uh way of implementation. Correct. Uh yeah. So the graph the graph is decentralized. Um can you can you like kind of expand on your question? I'm kind of a little confused about so basically uh basically um so basically um so when you are querying the data so if you are using a block explorer block explorer is hosted by somebody uh who is uh running node
and then they're doing the indexing and then they're providing the front end. Right? So that is uh when I was looking into the graph protocol and all those things the one of the important thing is uh if you are using a block explorer or such type of things so that is a centralized uh the main advantage with the graph is basically it's a decentralized so you don't need to just trust one explorer service provider but basically it's a decentralized uh way of getting the data.
So the this pipeline whatever pipeline just we created this is also decentralized or uh this is kind of a SAS model that you are providing this just for creating I mean uh if I want the click house and I want to do analytics so it is creating a pipeline I think I'm just guessing so back end of it is kind of a Kafka pipeline and then stream processing and then putting into the analytical databases.
So just want to understand like how it is different um compared to let's say I want to build a pipeline and do this. Yeah, I think you're I think you're on the right track with that. Um John, I think maybe this is something that you can take. Yeah. Yeah. So you're right. Um we we are a SAS company, right? Um we and you're also good guess on the back end. we are using Kafka and our SQL dialect here is Flink SQL. Um so so yeah why why why not decentralized versus decentralized um and I think we're basically I think filling a niche where decentralized can have its own pain points and we're not against it to be clear. We also do have some of these data sets available for free um that are
streaming into um R2 which is like an S3 clone from Cloudflare. So that data is available to stream um it's called index.xyz. So it's uh it's that's of course not decentralized, but again just try to say like there there are some other options here from decentralized to to centralized. So a couple things for for like why not decentralized. I think part of this came from why Gold Sky was originally founded. Um the founders were actually using the graph at a previous company and found it very difficult to like get enough of the graph tokens at a certain amount of time to actually spend them to like index the subgraph. And so it was kind of like a constant sort of like beating this beating the food like to your subgraph needed more attention that you don't want to have to give if
you're like just trying to run infrastructure, right? You just want to turn it on and let it go. Um so that was one reason for for h having it centralized was actually the decentralized component took a lot more work sometimes to operate. Um, another thing and I this is not necessarily just to like speak against the graph but I think just getting support like you're paying gold sky like we're here and we we can help you when things don't go right and uh whether it's with a subgraph or it's with a pipeline. So so part of the reason to decentralized is that there are certain customers out there that have you know low latency and high uptime requirements which being decentralized is not necessarily a priority. And so that's one of the trade-offs you can make. Yeah. And so so that's that's the main reason that we
are centralized in that that sense is that uh customers have asked for it, right? Like they wanted to have a slack channel where they can page our engineers on call and say like what's going on with our subgraph or what's going on with this pipeline. But um yeah, it's it's a we're obviously using graph node which is the graphs technology on the back end here to index subgraphs. So um all credit where credit is due for for the awesome tech they've built. Okay, understood. Thank you. Um I've got a question. So in um so there was you had to put the block number in when you were creating the subgraph and say I deployed a contract at um block 1,000.
Is there you know should I put 1,000 in rather than you know zero you know where zero would be genesis because it's not going to find anything for those first thousand blocks. So, is that just going to slow the um the the indexing rate or I don't John, correct me if I'm wrong, but I believe if you just put in the contract address, it should just automatically know which block to start from. And um the block number could just be if you want to customize it from a specific time if it's not just the start.
Yeah. And I'll expand on that. The so graph node, the software on the back end for this indexes sequentially. So if it doesn't know any better, it will give take the block it's given, look for the events on chain by, you know, requesting a block, requesting the logs, checking the topic signature. And so yeah, that actually takes a lot of round trips to the RPC. And if you are indexing a thousand blocks where you know your contract isn't at, then yeah, you're you're basically just chugging through cycles and wasting time. Um, so yeah, using the start block for subgraph specifically is ideally the block your contract was deployed on. Um there are other like nuances around block number choice in subgraph deployment but uh in our example I think we didn't have a
stateful subgraph. So you actually can have a subgraph where it will maintain some additional state like let's say wallet balances or um like NFT holders. Um and so in those cases the like start block also matters because if I start let's say at a later block rather than at the current block the aggregations I'm building up could potentially just have missed some amount of the history. Um, and I think just to kind of shill a little bit on on mirror here, like part of the reason we built mirror as a like next step for subgraphs was that we've pre-indexed everything. So like when you actually put in that filter for contract address, we can actually kind of like scan through the data to the point where that address first appears and then start emitting it. So that effectively
rather than going block by block by block looking for things, we can just jump to the point where that thing exists and start emitting data right away. Um, and so that's like a a nice upside of the way pipelines work is um it lets you kind of skip a lot of that uh kind of block byblock indexing stage. Okay, great. That that makes a lot of sense. So thank you. Another question I've got is so say in the example of the ERC20 contract um we indexed the or we put in the whole ABI of the whole contract and so then we had a resulting entity count. So if we were only interested in transfers and so which you know essentially is mints burns and real
transfers and we didn't care about approves um would we be better off like editing the API to just mention the transfer events um so that then the entity count would only would be you know like is the entity count smaller if we say we only want to look at fewer events. Yeah, I if you want me to get this right, I already I already talked. I'll just go for it. Um, yeah, so it I'll kind of add that the like ERC20 as a subgraph is kind of a contrived example. I think usually if you're going to be building a subgraph, you're doing a lot more complex mapping on any given event. So you may not actually just care about the transfers. Like I mentioned before, you might actually want to create a ledger
of balances or let's say a more like let's say a personal example like, hey, I'm me. I do a lot of token transfers. I could make a subgraph that actually just looks for token transfers to and from my wallet from any contract, right? And then I'm just indexing things from my wallet rather than say a specific contract. Um or I maybe I'm looking at USDC but I just want to see when my wallet is interacting on there. And so you can uh you know emit only those events. But yeah to to like more directly answer your question, yeah, you could totally just cut down the API. All that the AI is used for on the in the graph node side is that it looks for the event signatures in the AI and it uses those to map to entities to to uh index automatically at least in the like sort
of standard copy and paste uh uh smart contract indexing where we're just indexing log events. And so yeah, you can pair that down just to one event if you want or one or two events as well. And and yeah, it'll cut down the amount of data that's stored in gold sky. Um, I think again going back to the the like mirror pipeline thing, if all you care about is transfers, like why store that data in Gold Sky when it's we can just send it to your database, right? And so there's like an extra step here where where you're you're like saving by just like getting the data transferred to you rather than having to store it in a subgraph.
Yep. Okay, great. Um, are there any other qu are there any other questions? Okay, back to you, Andrew. Awesome. Well, that about wraps it up from my end. So, if you guys are interested in learning more and, you know, you're just curious to find out about, you know, all the different guides we have available, all the networks that we support, if you go to docs.goldskuy.com, goldskuy.com. You're going to see a ton of really helpful information and there you can just basically get, you know, step-by-step guides on deploying a subgraph, creating
a pipeline. We have a lot of guides that kind of give you like cheat sheets on how to do specific use cases. So everything you need to know pretty much is in the docs. And you can actually even in the search bar ask a question cuz there's AI built in. So you can basically talk to our docs which is a pretty cool way to learn. I did that myself. So yeah. And and if you are going through the docs and you're still confused, feel free to reach out to us. There's a couple different ways. Um one, you can contact me directly, um I'll put in the chat my Telegram and my email. Um you can also reach out to supportgolds sky.com. We have um a great team over there that handles things really quickly and they'll be able to answer pretty
much any question you have. But here's my email and here's my Telegram. So, if you want to reach out, uh, it keeps trying to have me tag someone. All right, there we go. So, if you want to reach out to me in chat, feel free to schedule a call, too. I'm I'm always happy to call. You know, I like remote work, but I'm home in this box all the time, so I love video calls. And if you want to just hop on one to just chat about whatever, I'm happy to talk. But yeah, I think if you're already on this call, you're in the right space because this is a really cool thing to be looking into. So yeah, if you want to learn more about Gold Sky, check out our website and um stay tuned on X too. You can follow us at Goldsky.io. Um I'm
posting stuff on there all the time. You know, we're posting workshops. We're posting cool announcements often. We'll post change log updates if you want to stay up to date. So anything that you want to look into, um you got our website, you got our X account, and you can reach out to me directly. Sounds awesome. So, thank you very much for your talk today and um yeah, I think we've all learned a lot and um so I'll post this on YouTube sometime later today and then um yeah, so for everyone who can make it next week. Um see you next week at the next talk. Thank you again Andrew.
Cool. Thanks for showing up everybody. Have a great rest of your day. Okay. Bye. Bye.
Related talks
- Indexing Ethereum: When and How to Build an Indexer
- The Graph by Yaniv Tal
- Eva Beylin, Yaniv Tal : Decentralization in Practice via The Graph
- Understanding Transactions in EVM-Compatible Blockchains Powered by Opensourceby Lefteris Karapetsas
- TrueBlocks Workshop | Thomas Jay Rush | ETHDam 2023
- PARSIQ Smart Triggers: Client-Side Blockchain Co-Routines - Anatoly Ressin
- Using Reth Execution Extensions for next generation indexing by Alexey Shekhirin | Devcon SEA
- Building Augur - Lessons Learned by Scott Bigelow (Devcon4)
- The Neighborhood: Rethinking Ethereum Data Access
