Airstack 🛠Building data-aware applications
ETHGlobal·Mon, Oct 9, 2023, 12:00 AM
Join Jason Goldberg and Deepesh Nath from Quantstamp for a workshop titled "Building data-aware applications". Thank you to everyone who joined our first in-person appearance in 2023! We are incredibly grateful for the support and contributions of all the hackers, tech mentors, judges, partners, and volunteers who made the ETHGlobal Tokyo event such a huge success. Without your dedication and expertise, this event would not have been possible. We would also like to extend a special thank you to the attendees who traveled from over 59 countries to participate in the event. Your presence and involvement made it a truly international weekend, and we are thrilled to have had such a diverse group of participants. With over 1070 hackers it was a pleasure walking into Toranomon Hills and seeing such a talented pool of individuals. With over 22 workshops, 9 talks, and over $375,000 USD in prizes we hope you enjoyed the weekend full of hacking, meeting all our incredible partners and learning from enthusiasts of the space. We are proud to have welcomed over 35% of attendees who were new to Web3. We hope this event sparked your interest in the world of blockchain and provided you with valuable insights and knowledge. We cannot express enough gratitude to everyone who contributed to the success of ETHGlobal Tokyo. We are already looking forward to the next event and hope to see you all there! 🎉🚀 ----------------- Follow us: https://twitter.com/ETHGlobal​ Check us out: https://ethglobal.co​m Email us at: hello@ethglobal.com
Transcript
foreign [Music] ERS uh so today we're going to tell you a workshop on how to build uh more data where applications using air Stacks technology we're going to make this uh very Hands-On uh demo show show the apis show you how to how to work with them if you have any questions on the way raise your hand uh and so overview airstack so um we provide web3 data apis that enable developers to easily integrate blockchain data transactions token balances uh on-chain off-chain activities into your applications um and the idea is that you can just rather than having to run a lot of infrastructure on your own you could just query our apis and integrate directly into your systems or into your front end um the agenda we have today is I'm going to do a a quick show of the uh the cheat codes the AI um And Then Depeche is going to show you how to use the apis uh the way um writing basically how they're how they're formed what's in the apis and um be able to uh use the full functionality of them so we'll go through after the AI review how to get your API key the rate limits that we currently have uh the docs for developers uh headers what's in the apis how to do create queries with nested queries pagination how to run queries directly through your API key uh how to run scripts if you want to if you want to add let's say you know hundreds or thousands of addresses at the same time and get responses um and then we'll conclude by showing everyone just review of the ideas and bounties uh using your stack any questions before I get started okay um so let me how do I get to a browser cool all right so if you go to airstack.xyz um is our internet working let's start with that there we go let me make sure the Wi-Fi is off first ah there we go there we go okay so if you go to airstack XYZ uh connect with C should we turn the lights down a little yeah better okay so if you go to air stack uh XYZ uh it's app app.airstock.xyz um you'll see the home page is if you want to learn basically start with other people's queries you can see there's a community shared query so after you create a query you can publish the community you don't have to so by default your queries are public you can save them to your own account but if you're proud of your work and you want to share with others you can just click the publish button afterwards and share your query publicly for other people so for instance here's a query that sarbis did earlier today so it's the collection stats for Moon Birds um and I'm going to run this query and so I can if I wanted to I can just you know forecast query and use it or edit it so you don't have to start from scratch if you want to start with a community query um and then uh just to show you I'm going to sign it's best you wanna sign in real quick I just want to show the AI so I just want to show everyone the the cheat codes real quick um if you're on the query Explorer page uh you can use our AI engine to create a natural language query um it's uh we're running gpt4 we've been training for the last four weeks or so on the our graphql um which depends you can go into in detail but you can write a natural language query on the air stack system so I can write for instance show me all nfts currently held by italic Dot eth and the images of the nfts and the AI will generate the query for you um it is about 98 accurate on anything that we have in API for and it's about zero percent accurate on things we don't have an API for so if you ask it um you know what tokens is Obama holding it's probably going to come out with nothing but if you ask it uh let's say um to give you information about any uh nft collection any token any ethereum wallet any ens it'll get it right um and so here's the query and uh it is there's the response and then you can see in the response here there's also um images resized in the it's the internet but usually we can hover over and see the image as well there you go so this is one of um vitalik's uh nfts um so this is the the AI system is intended as a way for you to get started very easily so you if you're not comfortable with graphql you can just you know use the AI assistant or even if you are comfortable graphql you can start with the query through the AI and then edit it and can add other dimensions to it um but let's back up a little bit and Depeche will show everyone the Nitty Gritty details of the apis uh what's in them and as a developer how to make use of them sound good any questions before we roll into it I talk very fast you can slow me down if you want all right go ahead the best over here thank you Jason sure so let's see you know what is possible with this apis and uh how as a developer can make use of these resources so as a developer you know this is the starting point where you have to come to app.stock.
xyz uh the different functionalities are already you know you already know uh Json already talked about it so here we you can see there is API docs so once you clicked here you will be taken to the dock page is it better yeah so here you can see uh first of all you know I would like to encourage everyone to join this telegram group we have a developer chat so if you have any questions related to airstack you know that's our best place to contact us and we will make sure that we reply to each and every messages Let's uh jump in so this is a quick start so the UI which you saw here right the Explorer so this is our graphql client but in case you want to use any other client even that you can use it so but we recommend everyone to use app.stat.xyz in case you want to use uh Apollo Studio or any graph iql clients you can just use this API endpoints this API dot stack.xyz slash graphql gql is the endpoint where you can hit the queries currently if you are not logged in you have not created any uh account so current the rate limit is 50 request per five minutes but if you login you will get uh once you log in you will get a header key authorization key that you can use it with every queries so there you will get the rate limit of 50 request per minute okay and if you want any higher rate limit then definitely you can reach out to us and we will provide that currently uh one information like you know currently we have ethereum synced that can be used for development as uh in the hackathon and currently we are syncing polygon uh it's still syncing but we have made sure that we have the live transactions available so that uh hackers can use live transactions and work on uh create some apps on top of it uh any transaction that happens uh it will appear in Aztec Avi is in less than a minute so it is pretty fast like a minute is also a very high thing but it it should be in some seconds itself all right moving ahead uh I will give you a walkthrough of the epis that is available and I will describe you you know what this apis are capable of so before uh going to this apis I would like to you know give you a walkthrough on how our schemas are built there is a certain pattern which we follow and there is also a nested queries how we can get multiple information of of multiple information in single query so let me give you a quick walk through here so here you can see uh all the queries are listed uh one common pattern you will see everywhere is this input so this is where you know we provide the input we have four basically four Fields one is blockchain on which blockchain you want to query currently here we can see ethereum but uh after sometime we will get polygon as well then there is cursor the cursor is more related to pagination so if you want so current we have a limit of 50 records in one query but uh uh you can get more data using pagination so this is where a cursor is used so it's just a string you can just add it and you can get some other page then we have filters the format here is we have and or if you if you want to query something you know which is give me something some uh token whose address is exactly equal to given address then this is where we use equality and if you want to use multiple addresses you can just provide an array so we use this in comp in operator and similarly we will have more operators like you know uh depending upon the use case let me go to stats here you can see uh there is greater than less than in all these are the comparator comparators so you can use this as well so this is the format which we have in our schemas any question here all right I will move forward now in this document you can see uh we have various apis so let me you know give you a very high level walkthrough one by one so token API so token API is uh if you want to get information about any token high level information for example name symbol decimal total Supply uh this is the API which you are going to use it uh here you can see uh there are more details uh but you know the majority you know you will need name symbol decimals so this is something I can show you uh you can just run this query so here you can see you know I have provided the address on ethereum and I got this name symbol decimal total Supply uh loss transfer block and last transfer timestamp so yeah token related information you can get it from token apis in addition to uh uh tokens if you want uh so tokens can be like erc20 721 1155 if you want more details about 721 and 1155 this is where we have the token nft apis here you can get some uh off chain data as well for example metadata generally they are kept on ipfs also also the images generally you will find the images on ipfs so you you can query all this data through our apis uh one thing we provide is the images the nft images you can get it in a four version so we resize the images and provide it provide you in the four sizes to give you an example here uh let me take first this example this is a very interesting example so I will just spend some more time here let me explain this query so I'm I'm trying to get uh token nft or its name its symbol then I'm trying to get its metadata its attribute type than images these are the four dimensions predefined Dimensions available in addition to that we are also trying to get nft scene transactions so this is an estate query this is example of nested query so the NFC nft sale transaction is something you know you can have a different uh query itself but in here in this example you can see like you know within a one query you can just uh query a lot of information related to that token nft uh one more interesting thing I would like to highlight here so here I'm querying based uh querying the uh and trying to fetch token nft based on this criteria that is I am saying give me a token nft for this collection where its metadata trade type is equal to background and its value is orange so here is a best example how you can query an nft based on its traits values as well let me run this work either internet is true trust me guys apis are fast ah got it uh so here you can see we have the metadata information rate type its value we have the images extra small large medium original then we have here you can see uh sale transactions you know what was the uh at what price it was sold so these are the information which you can extract from token nfts API then token balances so here you can query you know what are the different balances a particular wallet holds uh so uh you can get in erc20 Balance you can get you know what are the different token nfts they have a particular when it have and what are the token transfers so this is a very straightforward API you can just run one of the example here I think we already have seen this one I will just copy paste it I will run it here you can see you know we are getting very detailed information like you know what's the token type what's their name and uh how much amount they hold so this is this is this is how you can use token balance API then we have domain API so this is more like you know you can run the queries uh using very user friendly names instead of address uh to give an example ens is one of the projects so Enis is one of the project which we have indexed uh we will be indexing more so uh all the apis which we have uh this they can also work with ens and here I can get more uh information related to ens project like you know what was the payment token used at what price it was bought you know when it is expiring what's the name what's the primary in its name all this information we can get from uh domains API then we have a wallet API so this is a very powerful API you know here you can get a comprehensive data you know just provide a specific address and it will give you you know made information example uh what's their other social supports their different social profiles what's the token balance was it uh what was the token transfers uh nft sale transactions all this information you can get it I will give you uh one example here this is a very nice example so here we can see uh here we are providing an identity key so here it is like you know when we provide an input we can provide either address ens name in we can also provide a social profiles name or ID for example if you have forecaster you can provide for custom name or for cluster ID and then our apis will just take this name it will resolve you know you know what are the addresses uh that name has and then it will give all the data it will go and fetch the data and provide you the information what do you see the average sorry I did not get it on these all the transfers when they found a financial deal I have Reds and fun Journey they um yeah or block number yeah how do you filter for time range oh you want to know like uh if someone was an example you can use an example but like how do you filter that for the time range let's say January to April or something went okay I see so you have to basically convert the block range into Unix timestamp you have to figure out the block number by yourself I guess so your next time stamp or something yeah so if you uh if you uh if your question is like that like you know I want to get a token balance between a particular uh time range or or historical value right yes yeah so that is something you know uh we will be enabling that that is the balance snapshot where you can uh query any wallets historical balance so uh it will be possible for you to provide the block range like start block number and end block number and what was the you know balance between this range or uh uh even it can work with block time stamp so it will be like you know you don't have to know you know what's the block number of a given timestamp everything will be taken care of it so this is the API which is under development uh and we will have this API very soon so that will be possible this is uh we call that call call it as history thank you oh right all right moving ahead social API using social API you can query the data of social apps for example forecaster we are also indexing lens that you will get it after some time so the details which you can get it from the social API is like you know what are the profile names IDs and what are the different connected addresses or Associated addresses with that so this is what social API is uh token transfers so this is uh quite straightforward like you know any trans any token transfer you can just query it uh what was what was the token which was transferred between the addresses then we have nft sale transaction So currently uh if you want to know you know if a token was sold in a particular Marketplace for example openc or variable this is the API which you can get the data from So currently we have indexed openc and variable and here you can get uh you can get you know what was the payment amount uh what was the fees paid for that transfer and what was the royalty fees uh what was the platform fees and we also converted into USD and USD value and just provide all this information uh all this data uh using this apis uh then there are stats related API so basically you can you can just get the information like you know what's the highest sale price what's the lowest sale price what's the average sale price of a particular collection and this stats you can get it daily basis weekly basis monthly early and Lifetime and to just give you a high level detail like daily starts like everything is in UTC timestamp and daily starts from 0 am like midnight and uh ends at 11 59 PM similarly for the weekly it starts on Monday and ends at 11 59 pm on Sunday and monthly you can just understand that this is the first calendar date and calendar date so this information is also available we also have a information related to uh data related to Marketplace stats so you can also query you know what the uh what's the highest price lowest price on open C or on variable so this this API works at the marketplace uh uh level so you can get this Marketplace data as well all the stats similarly we have nft stats so at the token um nft level you can also get the similar stats ah coming back to this identity API this is very powerful uh so all the queries which we saw wherever you see you know where we have the owner address you can query uh you can make a query based on either ens address ens name or if you have forecaster ID for custom name you can just provide this and all the apis would work all right uh let me take one more example suppose you want to query uh on multiple chains ah so you have to query some information from the ethereum chain as well as polygon chain using one Epico even that is possible uh So currently this is not deployed on the production so you can't see this but this is something we will push it uh very soon so you can see the query here right like I'm trying to get token balance of italic I'm providing his ens name on ethereum and the second query is in the same same we have this aliases where we have ethereum and polygon as a labels and here you can see uh we are changed the blockchain to polygon and if I will run this you can see this ethereum and polygon this is how you will get the data and the token balances you can see this is the blockchain and different tokens and its amount similarly for the polygon if you will see we will get the similar data so using one query itself you can get data of the multiple blockchain so whenever we will enable more blockchains you will get all this data there now coming to do we have that okay three minutes three minutes but if anyone is a chicken pine is afterwards especially right outside and walking through and also good Iris live stories guys I've uh hello uh I would ask a question um audio centralized servers yeah so I can't run my indexer on my own computer not right now and their plan decentralized it okay thank you all right so there was one example you know which we wanted to uh you know I will just take just one minute and I will just say say you know how you can quickly do this so uh what you need to do is you just sign in after signing in you go to profile setting go to view API key this is where you will get the API key so this is something we need to pass this in the header uh against uh key authorization and this is where your apis would work with a good rate limit uh and very quickly here this is an example this is the node.js code so I can so this link is available like it's a GitHub repository it is available in the GitHub repository you can just have a look there so this is a query where we are running we are trying to get all the nfts of a particular of multiple owners and there is some page relation pagination logic as well if you will just run it yeah here here you get all the response all right I will just uh all right so thank you everyone if you have any more questions uh Depeche and saravesh will be outside and at our table we also have uh bounties that are available um it's linked to uh from the youth Global prizes page uh as well as uh if anyone asks just come up we'll send you a notion page that has information we also have uh suggested ideas and uh projects to work on if you're looking for inspiration all right any questions real quick all right thank you everyone appreciate it thank you
Automatic transcript — names and jargon may be misspelled.