David Langellotti ⚡️ Subsquid: Making the Next Generation of Web3 Possible

Polkadot Weekend Tbilisi · September 2022 · 18:10

David Langellotti, Growth Lead at Subsquid, introduces the indexer, API framework and backend-as-a-service platform they work on. They explain why web3 apps need data indexing for responsive user experiences and simpler development, how splitting an archive from squids avoids slow full chain scans, and what a typical squid build looks like. The talk covers developer features, the hosted Aquarium service, projects already using Subsquid across the Polkadot ecosystem, and plans to extend support to EVM chains such as Polygon and Ethereum.

Speakers

Topics

From Polkadot Weekend Tbilisi, hosted by Cyber Academy.

Transcript

and maybe that's a little bad that you're all developers because I'm not I'm not a developer but we're going to talk about a developer tool I know that's a little ironic we're talking about a developer tool I'm not a developer but we're going to try so subsequent making next-gen making the next gen of web 3 possible now what does that mean actually today I haven't really heard the term web3 very often uh that's interesting in the English language events we hear that term all the time maybe it's a buzzword maybe people don't really understand it so web3 let's just Define it very simply as the decentralized web so what does that mean are we in web 3

right now I don't think so right I don't think so like the things we do online we mostly do in web 2 don't we you know social media you know uh talking to other members of this event on telegram we're doing it in web 2. so how are we going to get to that next level of the web of the decentralized web where we are doing all these things in a decentralized manner where we connect the wallet or maybe we won't be connecting about how do we get there it's a really big question and I'm going to offer one answer one part of the answer and that is subsequent so about me just really quickly

I'm in the web 3 space since before it was really called that before that buzzword came about since 2017 and I've worked in a lot of different verticals of the crypto industry and I feel very fortunate to be working at subsequent now because we're working in all those verticals but those verticals are actually starting to work so things to subsequent and again like I said I'm a BD guy I'm a business developer and I'm here to talk about Dev tools but maybe it's not so strange because what does a business developer do he helps to solve problems and I'm interested in anybody's problems including developers maybe especially developers that's why I'm here so let's let's get into it what is

subsequent so what I wrote on our website at least is subsequent is web 3's most performant and resource efficient indexer API framework can backend as a service platform now maybe even some of the developers in the room don't know what an inductor is and then an API framework that's more or less understood and then back into the service I think that's a little better understood that's more of a web 2 term probably but can that work in web 3 well we're about to find out but let's unpack all of this so data indexing so in general data indexing it's about speeding up access to data and here we're talking

about web3 data now what is web free data that's blockchain data data from blockchains so why is data indexing important why do we need data indexing well first about ux so we were just talking about all these use cases that don't work in the current web 3. like social media you need things like instant caching gaming you need instant caching right you need really fast loading and responsiveness you need versatile backends for data Rich UI and you need scaling to handle thousands of online

users at a time like I don't know I spent a lot of time on dapp radar as a business developing guy and I'm looking at the number of users there it's not thousands I'm sorry it's just it's not not yet and we need it for better Dev ux so indexing lets devs focus on the DAP business logic not on data issues like storage caching serialization effect fast queries so again I'm not a Dev but I know in web 2 devs don't spend that much time figuring out how to get access to the data there's already tools for that in web 3 okay maybe you can do spend

time but uh there's tools there's tools are available for you and web 3 there's really not much I mean there's a couple well-known Solutions and we'll talk about those in a second that aren't quite doing what we need for the Next Generation but there's really not too much so let's look at how data indexing works so before there were tools for data indexing in web3 we basically had the blockchain and this is a very polka dot Centric picture because we've got polka.js there the developer had to figure out a way to get data despite you know changes in poker.js library

uh updates to the chain like everybody I here I think has heard of runtime upgrades I think they've been mentioned earlier uh you know missing type definitions and slow grpc that can be an issue like you have uh access to a single grpc that's very slow so the key and the key issue was that indexing is slow any significant change in in API requires a full scan of the blockchain I think developers here know all about that especially if they've used some of our competing Solutions you're sitting there for days days and days and days and days and days waiting also grpc nodes can become a bottleneck that means they become very very slow

and it's it's just not working right now for these high TPS use cases that we talk about so introducing subsequent we can index all of Consignment in 15 minutes I'm going to show that in a second that's 50 000 blocks per second yeah uh subsequent right now can index other chains at least in substrate faster than other indexes and we're going to go into a little bit why that is so before we had all those problems on the side here we have subsequence in infrastructure so what we've done is

we've split it up we've split up the index here so we have an archive and a squid fire squid that's the latest release of ours squids in our guys and I would say who did all that he's in here so you can ask him about it afterwards so basically we're able to solve these problems of speed with the processors carrying out batch requests to the archive and the archive sending back filtered data so I don't know who here is familiar with the graph we create a a subgraph that has to sync with the entire blockchain with subsequent we create a squid it

doesn't have to sync with the blockchain when you're developing because we have all of the normalized data already in the archive it radically reduces the development time and then when you need to iterate when you make any sort of change the data is already there just wait a little while so that's basically the comparison of it it's a little Beyond me as a non-developer so and here again a little beyond my knowledgeability but you can see how it works the process here targets the kusama archive that we have set up currently we're maintaining these

they're free to access here uh the person the developer put the data that they would like to get and then here's the proof 50 000 blocks per second for Block transfer uh transfers on kusama so just a very simplified look at how to build a subscript you clone the template on our um GitHub you fill in the schema it's a lot like building with the graph here it's just the stuff behind the scenes is making it go a lot faster then

you iterate into play so there's a ton of really Dev friendly features type safety built-in Auto completion you can do SQL queries we have a custom codec so this is something to bring up here because it's a polka dot event I'm told there's a lot of problems with polka.js I know there's parody guys in here I don't know I'm this conversation is beyond me but I know of different types of changes can really slow down things so we've bypassed that again you can ask Alexa about that he helped to do that um we have we offer support for external libraries and external APO calls API

calls that's a really really important point so subgraphs with their monolithic architecture are unable to do this but squids they because they separate the ingestion from the data transformation they are we support eliases basically that means when you make an update to your squid to your API you're able to update it and you don't have to change anything in your config in your config it's it's just uh basically you just with a single command in the CLI you uh just send that new version of your squid to that endpoint

and also graphql subscriptions now that's of course a very big thing okay so the next aspect of our service I think it's maybe even a more controversial aspect of our service this is maybe our web 2.5 aspect we offer a back-end as a service it's called The Aquarium so subsequid we will host your squids host your apis and right now we're doing it for free but in the future it will be coin free so if anybody here builds for the graph you know what I mean you're going to be able to in the future

when we launch our decentralized Network predict your monthly expenses because uh the aquarium will take payments in usdc and other stable coins so you will not be affected by a coin going up and down in price by you know 70 affecting your infrastructure costs and we will be using freemium model but as I said a couple times it's free for now um so right now to get into the part that I'm more familiar with getting away from the tech right now such good power is 200 more than 200 projects uh and so that includes dapps and the biggest

wallets in that Sama if you are a DOT summer user a polka dot if you found my user you probably are using an app that gets data from subsequent So currently in terms of our support for chains the chains that we can get data from it's all substrate chains including those that have evm and evm plus you know we're good friends with the guys at Moonbeam a star we have um so full support for akala the thing we're really excited about is wasm no I haven't heard too much today about wasm but that's uh that's webassembly and that's going to open a lot of possibilities for smart contract development going into the future

for these more advanced use cases and we offer support for that we're the only guys to do it another couple guys have said they do it but we've looked at it and they don't and so let's just go look at some use cases some ways that people are using subscript right now and it really spans the entire polka dot ecosystem so earlier today in uh Dennis's first talk he he explains crowd loans we work with a lot of projects that are doing their crowd loan we help them to provide essential data so the data might be used by their internal business team the internal business like they need business analytics of course or it might be used

for example to provide rewards to participants right so they might provide rewards to the top refers for example we can provide information about who the top prefers are and then they're able to calculate the rewards for those participants so this is this example is of course centrifuge but uh like most recently we did we provided data to the snow peritone uh so subwat I'm sure there's a few Subway users in here so we provide data to them they're one of our close partners and so for these guys it's really quite interesting they don't have to really do

much development work at all with our API framework all they have to do is plug in the URLs to existing apis that we have on in our Aquarium and it works they get the data they need but let's look at this other wallet I wonder if there's some Talisman wallet users here uh they're doing some really really cool stuff right now so on the one hand they use us much like sub wallet uses us but they're doing some interesting Innovations they're using squids uh as a sort of web 3 cache and uh basically what it is you log in and you see the logos for your for all the different coins that you

might have in your wallet and those are saved in the squids database as far as I understand it works sort of like a cache for web stream um then we're working with the biggest nft platforms and metaverses right now on dot sama most recently uh we helped with the sky breach landsail they're using squids to provide data in a few different ways one funny way is there's a game where these things called chunkies or chomkis something like that they pop up and we help them to provide the calculations for how that works and how users are rewarded we are powering rare sama

so that's actually the biggest nft Marketplace on polka dot I don't know how familiar you guys are with the moon Summit ecosystem but they're doing some crazy stuff uh they're about like here's some interesting information that you might not have if you don't see on Twitter all day they're about to Launch a evm smart contract platform that we'll see maybe we'll try to compete with some of the other big ones interlay here's a really interesting use case so maybe a couple of talks ago I heard somebody mention how there's a proof of work parent chain of course internally

is not that like not a para chain that's proof of work but a substrate based chain that's proof of work but interlay their project that is basically doing a sort of bridge with Bitcoin and um they use us for various defy dashboard use cases as well as I believe some governance use cases and then here's another well-known beam swap another well-known uh D5 platform that uses us theme song so uh what's next I'm going to provide some Alpha so

we've gotten really good at evm we are the best at it in the ecosystem and we're interested in some new experiences and trying to build in other places where people are building different interesting things so very soon there's going to be some announcements about support for evm chains including polygon and ethereum uh and maybe there might be a pair of chaining coming so that's something to look out for now I left some resources here I don't know if these presentations will be made available later but if you're interested we have some public repositories for all

uh the uh for example the archives that are publicly available you can access this datum uh you can access the aquarium to see all these squids all these apis and get data to that absolutely free and then the template project if you're interested in trying out building a squid you can go to that third bullet point the template project clone it and try for yourself or you can just run it and make some queries and that's it mataloba it was nice to speak to you [Applause]

Related talks