Covalent 🛠Building Multi chain apps with One Unified API
ETHGlobal·Sun, Oct 9, 2022, 12:00 AM
Join Leibing Guo & Leilani Ledingham of Covalent for a workshop titled "Building Multi-chain apps with One Unified API." This workshop is part of HackFS 2022, a three-week long virtual hackathon focused on building a digital world that is censorship-resistant, decentralized, and trustless. For HackFS, ETHGlobal has partnered with Protocol Labs - the organization building Filecoin and IPFS - to run an event centered on dapps, web3, decentralized storage, and everything in between. ---------------------------------------------------- Follow us: https://twitter.com/ETHGlobal​ Check us out: https://ethglobal.co​m Email us at: hello@ethglobal.com
Transcript
[Applause] [Music] apps with one unified api um for one of our hack fs workshops i'm super excited to have them here and with that being said questions go into the zoom chat and uh leaving feel free to take over thank you thank you anna um hi guys and uh hope you're having fun at heck fs i think coco villain has been in a couple of the hackathons that if global has put up and every time the theme is very interesting and we are touching on a really really important and interesting development within the blockchain world file systems distributed file systems right i hope you're having fun and today i'm just gonna introduce to you one way that you can get data uh on chain data in uh your web3 application be it nfc data crypto data um or you know any other smart contract data right uh using uh the traditional rest method this method is really fast it gets you aggregated data multi-chain data and you're free to try right so let's get started i'm gonna cover four things today i'll quickly touch on some of the trends in webtree where do we come in as covalent what is the covalent network and also i'll give you some project demos so um i'm sure by this point you wouldn't need me to go through you know how web three is different from uh web one and web two right we people in web 3 pride ourselves is you know being open trustless permission is composable and instead of just doing read and write it is like read write execute or rewrite own technologies that's uh being brought forth by cryptography and smart contracts right you know no matter if you develop an ethereum or any other blockchain those properties are available so by 2025 we see and by we like i mean here at covalent we believe that um you know there will be millions of critical information on public blockchains and in fact that vision has already been accomplished right um there will be dozens of single-user multi-use blockchains and this vision has already been accomplished so maybe we should change it to 2023 or 2022 because these things are already happening thousands of applications powering our lives now um that has not happened but we believe like you know after the bear market consolidates there will be a new generation of apps or depths that it's going to change to like fundamentally change how the internet works and how how we [Music] um you know relate to each other in a lot of ways right because being able to transfer value so quickly through so many tokens on such a fundamental way is unprecedented in human history and just like facebook there'll be like billions of users on chain right so with that vision uh our job as developers is sometimes a little bit difficult right like so okay we can't do this like multi-chain thing so easily every chain is its own ecosystem and every chain probably has its own language zone protocols its own its own development suite of tools although we are seeing you know a broad trajectory converging onto evm equivalence or uh you know this side of things um there's still many like blockchain projects that's pushing the grounds with their own languages developing their own ecosystems right so how do you get consistent on-chain data things like transactions things like balances uh things like um portfolio holding right or event locks across different chains like sometimes you have to write complex queries you know through sql using any of those like available methods and the most annoying part is when the data that you get is very inconsistent they're missing because of the uh structuralist um manner in which web 3 conducts itself right and also if you want to query it on a large scale it is sometimes very expensive to host an entire node and if you want a query for archival data it is extremely extremely expensive in terms of just storage right you need probably like one terabyte for uh just hosting like a full uh ethereum archival node so for most of us that's not possible so that's where covalent comes in we see that that you know there's a gap in all these like developer experience and um we see ourselves as like uh the middle layer the blockchains themselves uh produce the data and it's exposed to us through notes via most of it via json rpc and we aggregate all the data across many different blockchains and make it available to you guys that you can use on your applications so specifically we are we we see ourselves as a single api like a unified api which means that our query string is very consistent across different uh blockchains you just need to write you know one you just need to like kind of use one kind of query that you're very familiar with to get the same kind of data whether it is a arbitrarium whether it is clayton polygon avalanche phantom uh and soon a lot of those like subnets and super nets as well right the app chains you'll be able to use an api that you learn once familiar with apply it to all different changes to get the data that you need you can query it from anywhere and technically you don't need to know code to use it we uh you can either like put it in a browser and copy and paste json response and then format it on your own or there's also a no code option that i'm going to show you later on our website that you can use as well so yeah it enables you to get multi-chain data in a matter of minutes super super easy super fast and the covalent network is our step as an organization to move towards uh progressive decentralization because we really believe that the future of web3 data something as critical as web 3 daytime it's not within a centralized infrastructure but when we started out you needed that kind of centralized organization to create the right kind of incentives for the people to make sure things move fast that coordination is done uh well and the work happens right but once that threshold has been reached we have already taken steps to make sure that the data providers are a decentralized network that is um supported by validator nodes so just like how ethereum the data from ethereum is served from nodes the data from covalent as of now is also being served from nodes some of the nodes are operated by the community partners and will i believe will eventually gradually expand the number of like nodes and operators that's going to be so that it can really be um you know resistant resilient as well right so underlying it is a tokenomics that is supported by cqt which is the token that we use and yeah the vision ultimate vision is to have a universal decentralized data model for multi-chain indexing and core ring right so all of these you can find out more if you google block specimen produces covalent block specimen produces covalent on google right and this is the rough infrastructure that we have currently set up our users tend to spend across analysts and crypto developers and here we go uh for the bounties that we have for hack fs i believe let me just check that oh no this is not the right this is not the right uh one let me just um pull up the right one here just give me a sec sorry about that so this is the right one i'm just gonna paste it here share my screen again all right so the bounties that we have for this hackathon we are putting up a 5 000 usd pool price pool for any project that makes meaningful use of any of our endpoints for your builds we've kept it really open what uh eath global likes to call i believe green grass type of bounties i think someone used that term to me before like when we tried to make it pretty narrow but um yeah we decided that we like to keep it open so that you can work on any any kind of project that meets your fancy and all you need to do is to integrate our api into your project in a meaningful way for you to be able to qualify for the pool price now it says here that participants can now see your application okay um yeah so you just need to use it and if you if your app is a really novel idea it is a well implemented idea and it really use the api in creatives useful and uh in a good way there is a top price of 1500 right and if you participate and if you use it correctly up to our standards you will qualify for a minimum price of 300 right so yep that's that's all you can read up more about our price on the eth global prices page and let me just quickly share with you some of the hackathon resources that you can that you can use for those who are new to covalent api the first one is of course our api reference this is your bread and butter it teaches you everything that you that you need to know to use the api right first of all of course you get an api key and then and then you can start trying it out through our api reference uh page so for instance get token balances for address it returns you any addresses token balance you can even click run here and it should be able to get you the token balance of the address specified here i think this particular example here holds a lot of tokens as you can see like 126 different kinds of tokens and yeah these are all this wallets token balances it holds really lots and lots of token usdc ether uh uni v2 etc right let's check out another one like get someone's historical portfolio value over time sometimes the examples uh that they kind of hardwire into here load kind of slowly it depends on which address that you use and that is also a trait of um web3 data sometimes if um if the address that you input just returns like uh millions of rows right then it is foreseeable that the response is kind of slow um yeah while that loads i can just go through the broad classes of the endpoints we have what we call class a endpoints and class b endpoints class a endpoints refer to [Music] data that is available across all different blockchains so for instance balances data will be available on ethereum on polygon on avalanche or any of the layer ones right all layer twos nft data they'll all be available across it right in comparison we have class b endpoints which are protocol specific so not all not all layer ones would have taxes well of course like most do but um class b endpoints allows you to query specifically uh protocol specific information and by protocol i mean things like units swap things like ave things like compound etc we used to have those endpoints but i'm not sure uh why right now we only have endpoints for dax's so x y equals to k if you're not familiar with the axis it is the constant product formula and so any of the pools that follow the constant product formula will be able to get return responses in the data so so for instance if you query a the ethereum pool ethereum endpoint using this one right which will get you the pools on both unison and sushi soap let's give it a try oh okay you need to specify the deck's name and i don't think you need to specify the contract address so there you go so this gives us the the number of uh the pools right that's currently available on on unit swap so let me just can i zoom out it's kind of bad okay so you see here you have one pool and what's the tokens in this pool you have got token zero which is a crest token apparently token one which is wrap eta right so that's a crest crest repeater trading pool and what is the total supply here the total liquidity within the pool right now and the number of swaps in the last 24 hours right very powerful to for you to find what's going on within any pool at any time on the biggest two biggest protocols backs protocols on ethereum and of course like on matic you have things like quick swap that's sushi swap you have got a sushi swap spooky swap spirit swap on phantom and all these will follow the same kind of response formats and you'll be able to get like the volume fees total supply the number of pools basically hey what else what else yep you can also get the you know more in-depth detail about the pool if you have the pool address right so i think what this one shows i'm gonna just show you here is uh it shows the number of stop counts it shows the liquidity what you got from the response just now as well but in addition it shows you the total supply um and things like seven day volume code which is quite useful if you want to know how what's the depth of the amount of transactions that has gone through in terms of value right in terms of usd um for the last seven days right so really useful so that's our class b endpoints and of course we've got some like pricing endpoints um and you know to integrate this into your application on the front end or client inside application you just make a standard rest api call and then um you can choose to display the response uh chop it up use available fields you know pretty pretty standard stuff and yeah give it a go right now um i believe we have a rate limit of five requests per second it will always be free right our product will always be free and um five requests per second is pretty good for like um like uh when you're in the development stage as well as maybe testing stage for our production kind of uh applications you can i suppose reach out to our team and we're currently in talks to develop a pricing tier as well for so that you can get way more volumes right for your for your queries that you need for your application and that is about it um one question that i get a lot as well is you know what are some of the some of the ideas that you can build using our api right um we see lots of wallets uh like most of it is like display pages right our api is a read-only api we can't do write to the blockchain so what it can do is to have those like transactions pages right and yeah so wallets you have nft dashboards you have analytics dashboards you can look at the log events emitted from a smart contract for instance in this one you can get all the log events by a contract address you can get events by topic cache and that'll enable you to do a lot of on-chain analytics right um [Music] yeah the sky is the limit and be creative there's even if you want to dabble a bit into like a full depth development you can you just need to um implement the our api on the client side to perhaps make some calls to the to the data that your uh your backend smart contract has emitted and then yeah build an interface for it for the front end user as well so that kind of concludes uh most of my call on most of this webinar i'm i'll open it up to questions for now i think i'm gonna take a look at the chat okay all right thank you very much please can you hear me yes i can hear you all right good afternoon from here i so much appreciate uh or your lecture please i have a question like uh i don't fully understand how this api like can be utilized okay for instance now i'm i have a personal brand an exchange brand just like a vendor i i buy crypto and i exchange it for fiat so how can i utilize this blog this api now in my transactions thank you so uh let me try to understand where you're coming from a little bit so what i hear is that you are doing an exchange right like you let's say you are an investor or something like a personal retail investor and you want to exchange your crypto for your fiat right yeah i mean yeah yeah yeah so it's kind of changing fiat to yeah in that case our api is probably not what you're looking for um what you're looking for you know you can go to centralized exchanges to do an exchange right and like you can use binance you can use gemini any of those or you can use like a unisop if you're familiar with the uh you know full decks options our api is more catered for developers who want to show on-chain data on their web3 application so let's say you want to create a website right you want to create a web3 website where you want to want to show like some statistics on how many people actually interacted with this particular protocol right on this day how what are the transactions that has gone against this protocol uh how much volume how much uh what's the prices for instance of that token at this time so all these data is available for you to get from our api so we are kind of like a data warehouse right we're kind of like data supplier you can't you can't go to the data supplier and say i want to exchange i want to do like uh like a trade because that's not the service that we provide um what we provide is for you to you know use that data to build an application hope that kind of uh answers your question yeah yeah yeah you did thank you no problem um we got another question is it possible to get all nfts for a specific user and if so what chains would this work on is it blockchain agnostic in the sense that all evms are supported great question uh it is possible to get all nfts for a specific user and the endpoint that you want to use is get token balances actually for address under this endpoint there is because nfts are essentially also tokens right there are also tokens there are uh erc 721 tokens all your coins are erc 20 tokens so we support uh yeah 821 and also erc1155 which is another like nfc standard right so what you do is you specify set to true so once you set nft to true it will also return all the nfts of a specific user so let us try right maybe we will use uh maybe we will use this address and let's see what nfts does this person have okay now to show why this time of the day um this interface is very slow um yeah not really okay but in any case typical normally it should be way faster than this in any case the answer to your question is yes you can get entities it is using this typically it would yeah i think there's some technical error here i'm not sure what's the problem and you will be using this endpoint all right uh so what chains would it work on it'll work on all these chains every single one of these uh 30 chains that we currently index and is it blockchain agnostic it is agnostic to the extent of it being here like only if we index it then it will be available you can't use it on a chain that we don't index uh is there a way to watch the movement of crypto whales using covalent yes someone has actually developed a whale alert application using our api actually um [Music] i don't think i have the link with me right now but yes we'll alert like a like a twitter based one so using an api they get updates when there's a huge movement in price and then um through their back-end client they develop some code right to be able to see that oh this for this amount of tokens we call it we consider it will and then once that happens it triggers like an automated post on twitter informing everyone else that uh wales have moved so you can do that for every single address obviously using our api yeps exactly yep you can follow any data set that is on chain yeah so you know how data is formulated on chain is that um most of the data are um are on emitted from the smart contracts right so every single application most of the applications are a set of smart contracts like ave like compound unit swap so you can either put these smart contract address to look at what all of them is doing behind the scenes or you can also supply the wallet address of any wallets that you are following and you'll be able to get updated data uh so the amount of tokens okay so i'm going to repeat this question so is there a cap on amount of tokens that are returned or would you need to use pagination for say a list of 1000 nfts we use pagination so um there's no cap because we return as many tokens as the person has right we can't like cut off what the person is holding because that will be untrue so uh and if a person has lots of token holdings we just need to you know you just need to supply the pagination like i believe the syntax would be something along the lines of like uh you can increase the page size from the default 100 you can increase it to like 1000 or even like 15 000. so so that you you know the page returns up to 15 000 entries of tokens or nfts or balances yep um if there's no more questions we are reaching the end of our time here thank you so much everyone for coming and if you have any more questions do hit us up on our discord or you can also uh dm me on twitter my handle is musings on defy on twitter and you know oh yeah one last thing if you are building web3 applications we are currently developing this web3 resources library and um so with this library it will make it super easy for you to integrate any of our uh like tables and data that we have into your application right you just copy the whole table and you'll supply it to you web3 data for instance something like this is what we are currently building as well you can get with one address uh you can get all the transactions that erc20 transactions that this person has done so yeah you can go to this url i'm gonna drop the url into the chat here you can go to this url give it a star to follow it and you'll be able to see lots of goodies that's gonna come out this quarter yep thank you guys thank you so much leaving for taking the time to do this workshop uh for hacc fs hackers um and thank you to the rest of you for joining this workshop and asking really interesting questions as leigh being said he is reachable on the sponsor covalent discord um just tag him um or via twitter and with that being said we have another workshop in an half an hour i also hope to see you all there and otherwise have a great rest of your day thank you anna for having me take care guys bye everyone you
Automatic transcript — names and jargon may be misspelled.