Encode x Gnosis Chain Hackathon: How to Utilize Gnosis Chain Datasets with Indexed
Encode x Gnosis Chain Hackathon 2023 · 16 May 2023 · 39:05
Mike Nikles and Jeff Ling of Goldsky present Indexed, a free and open dataset of blockchain events that includes Gnosis Chain. The workshop covers how blocks, transactions and decoded event logs are published as Parquet files, a live demo of syncing data for a contract address with the command line tool and querying it with a Parquet-capable engine, and options for live streaming and webhooks. Audience questions cover commercial use and how hackers can get help during the hackathon.
Speakers
Topics
From Encode x Gnosis Chain Hackathon 2023, hosted by Encode.
Transcript
hello hello everyone hello welcome back um I hope you can all hear me um give me a little uh hello in the chat if you can um well um I'm just gonna quickly invite our speakers to the stage um or some Hello Katya hi good to see you guys again um awesome cool cool so um yeah as everyone's coming in slowly hi guys hi everyone um pop a little hello or uh tell me where your base at the moment um in the chat hi Mike how's it going very well good morning good morning
um yeah so um before I head over for later Mike I just want to say hello to everyone and let's go over a few things so um today today's Workshop is on uh how to utilize no chain data sets with indexes um and um we have this is the first Workshop of this week we're already on week three now if I'm uh not mistaken um I will do a couple of admin things at the end but um feel free to reach me out um reach out to me on Twitter I've put those um links in the chat so if you need anything feel free to feel free to ping me there and I've also put Mike um Mike's Twitter in the chat too as
well as gold Skies Twitter there so you can go give them a follow and uh contact uh our speakers today after we're done um okay I think that's pretty much it I'll say everything else I need to say later on um Mike are you ready to go yes let's do it awesome okay um are you sharing a screen today I am yes give me a minute all right good morning good evening everyone depending on where you're calling in from my name is Mike Nicholas I work at Gold Sky and I focus on developer experience so anything that you will be interacting
with whether that's index.xyz or gold Scout or anything if something doesn't work I'm I'm the person to yell at and then I'll get this sorted out uh I've been a goldsky for about a year now and um we basically provide uh you for with a way to index your data uh from the blockchain and give you ways to access that now what we did um very recently was we launched something called index.xyz which basically provides you with a free and open data set for blockchain events so we we do all the heavy lifting of you know getting that indexing it and then
we provide it as data files that you can download to your computer or to to a cloud machine and then analyze that so what I want to do today is show you uh what it is and how you can use that maybe through your hackathon projects if you need to analyze any kind of data or anything alike now because I have my screen in full screen mode I don't see any questions or anything so if somebody has a question then you know please interrupt or just let me know all right cool so let's get started uh three very simple things we're going to do today I'm going to talk about what is index just so that everybody's on the same page and then
I'll give you a demo and then we can do some q a um at the end or if you have something that um you want to say as soon as I'm out of the presentation here I will see the chat and I will be able to try and act and answer that in real time uh all right so first things first what is indexed XYZ so as I briefly touched on it's basically um Gold Sky and a bunch of web3 and Cloud organizations getting together and taking whatever's happening on the blockchain indexing that and providing blocks and traces and events and logs in in a file format that's called parquet it's very easy to query there's various
tools you can use to access that with SQL or even visualize it in in dashboards and whatnot so we basically put that up on cloudflare R2 at the moment and what you can do is you can download that from there with various tools we'll get into that in a second and then and then work with that data now that data is up to date as of about you know with a 10 minute refresh so if you do something now then you do have to give it some time to to get that latest data and there are other ways to get this live streamed as well we'll touch on in a minute so if you have more critical use cases where things have to
happen more real time than we provide ways to deal with that all right so we're going to jump right into the demo I think this is most valuable for for everybody um on on the call given what you're going to be doing at during the hackathon so this is just for your reference once you get access to the slides afterwards but I'll show you what's on this slide in real time so let me get out of here and just go quickly over here if we have any questions I don't see anything yet so let me do you have one actually sorry oh yeah go ahead just just a quick one from um this shag I'm asking can you can they
earn money as a developer by indexed dot XYZ can I earn money um yeah I mean depending on what you build you can you can probably earn money with it not not through us like index.xrt doesn't pay anybody to use the data or whatnot but depending on the project you build um you can use that for commercial purposes um yeah it's open free um go go for it you should use it for anything you want uh cool yeah thanks for bringing it up so heading over to indexed dot XYZ um you can see that it's a very basic interface
where you can either search for a chain or in our case we just click on gnosis here and then you get kind of four options of what what kind of data you want there are raw blocks and that really just gives you block information um the way you would see it on like a blockchain Explorer or something same for Road transactions and raw events and then we also provide what's called a decoded event logs so this is more like human readable where um we convert some of the hashes and whatnot into into readable values that make more sense than you know zero X something something so what we'll do for now is we'll we'll keep we'll select that decoded event
logs and there's a number of contracts that you know we just haven't is an example but this is really where um you're going to put in your own contract address so whatever contract you deploy to the chain you would put that in here so that once you hit enter you'll get the correct command that I'll show you in a sec now in my case I'll use I'll use pull up and there's you know enough traffic on or enough events happening that I can actually show some meaningful stuff but in your case enter your address here so you can you can just paste it right in here and then you see Custom Contract you can take that values pull up and what that gives you is a command that you can run in your terminal now
Gold Sky is not installed on your computer very likely so there's a download CLI uh where you know the instructions on how you can get that there's other ways to access that data as well you can use the regular S3 client to download or you can use something like our clone there's various tools that allow you to download from a cloud for a layer cloudflare R2 instance all right so if you look at the command you can see uh it's about indexed syncing decoded logs the network name and then our contact address pretty basic so what I'll do I already have that prepared over in my terminal so that's not the terminal here
we have um excuse me one sec you can see I have my network so if I don't provide a contract address or if you don't provide one and you hit enter it asks you what's the contract address you're interested in now in my case if we go back to um back to here I have an address saved here so you can look at that real quick I'm using the the poab contract address with this hash so if we go back to my terminal and I paste this here and then I say run
so this goes up to the index XYZ storage which I mentioned is cloudflare R2 so there's cached and somewhere near your your location um it downloaded two files that's because obviously prior to this call Energy index some of the data locally but the more important thing now is that you can see it's waiting for new data now what that does is exactly what it says so it just basically stays in that state and keeps on checking if there is new data that has arrived so if there's an event happening for that contract index.xyse graphs that processes it and then the CLI here will automatically
download that to the local file system where you can then use a query engine to go in and have a look at what's going on so let me just quickly jump back and see okay nothing so far nice all right so this is fetching data now let me show you what this looks like on your on your computer and let me get out of here so I am in a directory here where I have a um where I ran my command for the CLI now that created a data directory if we look at that real quick um to the data directory
it's more readable it contains two soft directories a temp directory we don't really need to worry about that's for the CLI to just kind of keep track of what it usually has downloaded and whatnot and then it has a notice director with decoder and roll folders with further sub directories for your contract and then the data in it so for example I'll show you real quick so data analysis decoded locks and then here we have that poab address and then inside of that directory this is where we have all the um many many files of of parquet and I'll show you how to query that in just a sec it's not as scary as it looks like
here on that screen all right so what you can do is while this is keep keeps downloading data over here we can use something like Doc TV or any other tool that can read parquet files and in my case I use stock DB so I can come in here and um let me show you what one of those files looks like so you get an idea of what kind of data you get um actually you don't have to watch me type this let me copy so basically you can say describe select star and then you can just instead of giving a table name you can use that
directory path that I showed you up here and then where these 11 000 files or so are located you just use a start or parquet and then we don't need any of the rest for the describe but that's fine so we just hit enter and that gives you an idea so there's going to be block time obviously our address so we can kind of query by our address if we have multiple addresses we may care about you can do event signatures parameters block number all these different um fields are available and then the other thing we can do is actually just go and have a look at the top five or the most recent five [Music]
entries in that database so if we nuke this here we do a select star and then at the end we have a let me hide this here we go to the end you can see we are ordering by block time and then we sort it in descending order so that we only see the most recent five you can hit enter on that oops what did I do I have to spell select oh what's that hang on pretty cool
all right so I searched or I filter for Block time block number and transaction hash so if we grab that transaction hash for example here and we go to uh he notices scan you can see that transaction happened about 16 minutes ago and it's for the the web token of course because that's the contract that we filtered by now this this data that that you get uh here locally you can integrate that into your application and you can query things now in this case you only have one contract you could run this CLI here on multiple contracts and you know do aggregations
or analytics um really whatever your project needs in terms of blockchain data this gives you access to that data and you can go ahead and query that you know slice and dice the data in whatever format you want and then process that you know integrate into your application or into your dashboards whatever your project is about um without having to worry about you know calling an RPC provider to to get that data and build all the infrastructure around that so this is just something we provide here for you let me go back are there any questions so far this is a very quick run through I think Jeff's been very quick on the um
in the chat to answer anything that's come up nice okay coupon code okay cool um I suppose yeah yeah okay um exactly yeah you can as Jeff said you can run this in the background um as I mentioned as well you can run multiple of those commands as well if you want multiple contracts uh they just keep running and keep on adding files as soon as something pops up online um pretty straightforward uh one other thing I do want to quickly uh show is um if you want that data like live streamed
into your application like through a graphql interface or even if you wanted into your data warehouse uh directly as soon as it happens on the Chain you could sign up for a free account as well on Gold Sky which is the exact same underlying infrastructure um but you don't have the 10 minute delay that you get on the open and then you'll all you really need to do is provide your API and the configuration file and then goldsky will do the rest for basically taking that contract parsing it and then providing you that value even to like graphql API um I mean really anything you want we can we can export that data to wherever you want
um yeah so bunch of links here if if you're interested in you know if your use case requires more live stream than did roughly 10 minute delay that we have on the index um yeah I think this oops is there is there any anything else I can answer um given given the broad audience uh I don't really have any specific use cases in terms of you know what um what you can do but happy to answer questions on use cases I've seen or use cases that um may be helpful uh uh cool we can open that up to the um to the floor to check
[Music] um I'm just gonna minimize that screen there nice awesome no problem um yeah everyone feel free to type your questions in the chat and then we can read them out and go through them um awesome great and also Jeff has just put down some um some links that were on the screen earlier they're in the chat so please feel free to go check those out um we have a question from Nestor uh Mike would you like to read them through or I can read them yeah I can do yeah I can prove it okay yeah great uh you can read them through and we can take turns grabbing them deal okay sounds good um can I close your shared screen or
would you like to keep that up in case you'd like to demonstrate anything let's keep it up no worries oh okay feel free to share if you need it yeah fantastic awesome um okay so uh first question from Nestor the parquet files are compressed question mark um for example with Delta or another technology um they're asking to understand the size of these files yeah um so let me have a look so I don't um Jeff you know if they're compressed specifically uh we may do but who Jeff has gone quick he's like
[Laughter] um hold on I can I can have a quick look um I think Jeff has actually left the whole session so I mean we can take a quick pause on that question as well um although Nessa has now elaborated and said it is a question about Big Data technology um and just because they're curious yeah yeah let's let's hold off um Jeff's just texted me saying I'm having issues uh we I guess we figured that out um so we'll see what happens I I did um download Pro app uh all of it like the entire history and
um on my local computer I'm at about six gigabytes of data for for that um but let's see uh Jeff Jeff is typing so yeah fantastic awesome okay uh I see another one uh quiz on are you competing with the graph blockchain um yeah that's a good question so the graph the graph provides soft graphs um that you build and then you index your data right and what they had or still do is they hosted service um and now they're migrating more to a decentralized approach with the newer
I'm offering so we actually leveraged some of the open source work that um the graph team built which which is super helpful uh to index the soft crafts that's basically how goldsky started as um at the beginning now since then we've we've evolved um quite a bit and what we're doing is we also provide something called direct indexing where we do a lot of the heavy lifting um with our Technologies um uh so for the hosting part yeah I think this is similar to to the graph um we have you know other stuff that we built on top uh where instead of just a graphql API for example you can get the data into anywhere you want if you have
your own data warehouse things like that we can do that so I I don't know if I was introduced or I'll just introduce myself real quick I'm just featuring co-founder here um of gold sky so yeah parquet compression so so parquet is already called the compressed we also have Snappy compression on top of that um it's not in any specific format like Delta I would say like it's not that parquet uses Delta or Iceberg as compression that's kind of the other way around it's um Delta and Iceberg are formats or metadata formats that also happen to use parquet as compression and storage format
um we chose not to do any specific Delta or Iceberg the reason being is that we want this to be completely durable data um for us to support Iceberg our Delta um often you need a hosted metadata store and any company that hosts that store could eventually um charge for that data so the idea of putting this behind like publicly sponsored buckets by cloudflare and later by in the future by other providers as well and also in decentralized sources like ipfs and R wave is that anyone could copy it and run this pipeline by themselves and no one can have control over any metadata so it's kind of a principled approach um does
get a bit inconvenient I admit that we're trying to build more Tools around that to make this as useful as possible cool great um yeah I think Nest is uh said yeah responded with it great um okay um I think the the next question is um Nas asking when you say indexing blockchain data is it just the events or anything on chain so um it's almost everything on chain um we haven't pushed traces onto
um indexed yet but that's coming in the future version but yes right now it's uh all logs so raw and decoded um and then there's transactions and there's logs or blocks [Music] has asked how long has Gold Sky been around uh since 2021 somewhere around there uh yeah um basically found it uh from Kevin and I uh I was working in like fintech big data text stuff but it's very interesting blockchain Uh Kevin was
uh the team leader at matcha with zero X so and then he saw an issue we had a thesis together and then we founded the company around that time awesome um okay next question I think is let's get me through all these uh also from archon uh what chains are you compatible with I'm assuming index I think that one we have to prefix with um today we are compatible with um ethereum noses and basically and um there's more coming um as well but let's just put a link in there as well in terms of what else is
available through Goldstar so so I want to um make sure that the distinction to the index and gold Skies clear index is the public good that is you know done in partnership with the networks themselves um and is free public good like always going to be free forever there's no other remote up there other than marketing for Gold Sky really um Gold Sky is totally capitalistic we're here to make money uh we're here to provide a great service um it's a business so Gold's guy has a more change index um with a direct Network Partnerships um and also index in a different way
um indexed dot XYZ is um what Mike mostly presented today it's completely free and will be free forever but relies more on like either download files and build your own pipelines and uh build a foundation it's more of a foundational layer for you to build on top of cool awesome thank you for the clarification um yeah I think that that really helps us kind of understand the distinction um okay let's go through the list um I think the next question is from nass uh asking so basically we don't you need to use sub graph then
so I think um and nurses questions can sort of be combined um you you do want to use subgraphs if you want to do something and within like a second see it in an API index updates basically in a matter of minutes um so so our pipelines do index any event instantly but because um if we emitted every piece of events separately out into uh the index data set um there's basically no compression you kind of want to collect a few more events first and then be able to batch them into files and then push them out
um so basically there's a multi-minit latency with index.xyz um and then with uh Gold Sky there's like under one second latency when the block is proposed to yeah to go and so so depending if you're thinking about using this for your hackathon project I would recommend if you don't need Super real-time stuff use indexed it's free it's free forever you can build a whole business around it if you want um but then Gold Sky is also like obviously very good for building business around it but um it's a paid service and you just need to keep in mind like what you want to do but if you want to have like super
real-time stuff Gold Sky uh indexing is probably their best bet cool one thing I'd like to add for the question about whether you need to use subgraph or not I think if if you want just basic data uh without much you know transformation like Converses whatnot um we did build a feature where you don't actually have to build the sub graph we do that for you as long as you give us your API and um a configuration of I'll be document but you can you can bypass the process of building a subgraph and maintaining that um by just providing the API in the config file yeah but it's kind of like like more Elemental you look at the raw
events in an API but it's also quite powerful for example like cash flow uses this to power some of their operations um so it can actually scale really well um even though you get a few less knobs and levers and you can always upgrade to doing custom logic later if you want cool um awesome so that was kind of the combination of Nas and quezon's question together so um next question that's come from arkon is asking is there a limit per user um I'm assuming well you guys speak first two two
answers one for one for different products I think indexed XYZ There's No Limit other than whatever cloudflare is able to provide in terms of download OSB which is pretty good uh Jeff do you want to take the gold Skype part well um yeah for for the coupon code I gave earlier um that's for the dev plan so there is a query limit it's good enough for actually all MVPs and many small apps um it's around like I think 20 to 50 uh uh the requests every like five seconds or something um which is a pretty generous for most use cases
so yeah that would be the only limit um with um that plan as well you're only allowed three indexers but if you're working on just like one or two contracts um you can kind of fit as many contracts into one of the next errors you want um and then you can use the others for like versioning and like having a Dev one staging one prod API um yeah whatever you want great awesome um any other questions come through so um I guess I can ask a question um what is the best use case you guys personally think there is for um either
index or gold scale or just this um method of um processing data and stuff for for indexed um we've seen people build basically like a mini dune um for for their own self analytics they were doing machine learning um so they needed two things they they needed all historical data for free uh so they kind of pulled all that data and processed it in some sort of proprietary data model and then they they needed live streaming data but they didn't need really real-time data so they they basically set up a sink to watch the bucket and they used their model to infer insights as new data came in and since it was updated like
it's basically updated in a live stream fashion that's lagging by a few minutes it was good enough for their use case um for gold Skies the most interesting use cases probably are like you know running a decks or running a bridge directly using our cross chain capabilities basically in our Enterprise tier and soon in self-serve as well you can pipe goldsky data directly into your own database um so it kind of turns this whole web 3 data problem where like you have to deal with a lot of apis into a standard web 2 problem where you just have like a bunch of data in like a postgres database and then you're this
figuring out what to do there and building normal apis on top of that so I yeah that's kind of like the most joyful use cases I've seen awesome cool um might anything else to add I think one one thing that's that's quite powerful as well especially once your business starts to grow is um and you know maybe that's just me but like analyzing your competitors so you can you can use um that data to see what's going on on other contracts and you know you can build your own competitive analysis kind of dashboards or things like that whatever you need um if if that's something that I mean
you know you get access to any contract if you want to so yeah or fraud detection is something that um actually that's quite interesting too because of the live stream fashion of what's Happening um if something does start to look fishy then you know you know that a lot sooner than you know if it's you know but delayed by minutes or hours sometimes depending on data sets cool um and I guess like on the uh flip side of of projects my next question is um what do you think is the easiest way or maybe like an example of the easiest way to implement indexed or gold sky in a hackathon project
um I think if you um have like a background or a need for analytics um index is probably the easiest way you could spin up a VM somewhere and just download the entire data set and now you basically have the entire blockchain um in the hard drive for you to access um this is a warning it will be like a multi-terabyte data set so provision accordingly but if your hackathon project involves um basically doing like wide analysis like doing style stuff but you need a lot more customization um than or you just want to have it for free
um then then that's kind of the best bet or or you could just handle just your contract and it'll be a much smaller size um for for Gold Sky I think like Mike highlighted a few times the instance suppressed feature is definitely the easiest way to do any sort of custom indexing anywhere so you're deploying a contract you can throw in the ABI and your contract address and the start block and you're instantly get an API that you can use um so you can directly connect to it from your front end and you just don't need a back end in this case uh so that's great for if you just really want to make an MVP or even a production Scale app that
needs to refer to information in your contract we besides the kind of pull approach of you know calling an API and getting the data even though it's live streamed there's also a way where uh you can subscribe to webhooks so whatever happens related to the contract you care about we then push the data to you but you do need a backend for that so um that's but yeah if that's something that may be helpful for your for your hackathon um let us push it into you instead of you doing the polling cool thanks so much um everyone in the audience right now uh please drop any final questions that
you'll have um in the chat um Mike Jeff if um any of the hackers want to get in contact with you what is the best way is it via Twitter yeah Twitter works or uh support that Gold Sky if you're you're interested in anything you can also make issues in the indexed docs and we get to it pretty quickly um yeah and uh yeah Twitter is probably one of the better ways to do it but we are also pretty good with email yeah awesome okay well um popped your Twitter Twitter's in the chat already
um both of you but uh I will just send a little reminder one again here um we're just pasting this in the chat right now so if you guys in the audience want to um go give them a follow please do and um ask any questions that you might have after this Workshop um uh yeah I think that's pretty much it um Mike Jeff do you have any uh like last uh remarks or any word of words of advice for our hackers just general even I think the yeah if if anything of Starbucks you don't get blocked um use
our Twitter handles um we know you're you're going to be busy this week so I'll keep checking um even more than usual and um yeah and anything else like I think get get to get to something end to end as soon as you can especially for hackathons it doesn't have to be the prettiest and then you you can figure things out afterwards but yeah let us know if we can help foreign thank you so much for coming um I'm gonna quickly just do a final bits of admin um so I just wanted to make sure that everyone
here um if you haven't registered officially for the hackathon yet um please register using this link that I've just posted um and then I've also put in the hacker pack um in the chat so if you need any resources or whatever or want to look up our FAQs for this hackathon please refresh the hackathon pack um this hacker pack um and you can always you can always ping me um again like Twitter works for me as well um and of course if you guys are in the Discord group The encode Discord server then you can always contact me I'm just gonna quickly copy my ID here so just drop me
um a message there um but yeah I think that's pretty much it um I think a good amount of time um yeah so if everyone is okay with it I think we'll wrap it up there cool thanks so much for having us yeah no worries okay awesome uh and as usual the chat will stay open for a little bit as well okay see you everyone [Music]
Related talks
- Best use of Goldsky - Superhack 2024
- The Graph 🛠️ Quickstart to Subgraph Development & Querying - Marcus Rein
- Defining Your Web3 Stack: Building Fullstack Dapps
- The Graph 🛠 Building decentralized, serverless applications - Ørjan Auestad
- Stream It or Miss It: Building a Live On-Chain Activity Monitor for Gnosis Pay
- The Graph 🛠 Indexing your smart contract with The Graph - Pranav Maheshwari
- Dune Analytics 🛠 Open Data for Open Finance
- Воркшоп «Блокчейн-аналитика в реальном времени» | Алексей Студнев
- The Graph 🛠️ Querying Web3 Data
