Covalent 🛠Building Web3 Applications with One Unified API - Leibing Guo
ETHGlobal·Mon, Oct 9, 2023, 12:00 AM
Join Leibing Guo from Covalent for a workshop titled "Building Web3 Applications with One Unified API". And that wraps up 2022! ETHIndia 2022⎯the biggest Ethereum hackathon to this date with over 459 projects built within 36 hours. 🫂 2000 attendees from 🌆 321 cities that were 🌱 44% new to web3... ...joined forces in Bengaluru to write history. Thank you for taking part in it 🫶🔥 ----------------- Follow us: https://twitter.com/ETHGlobal​ Check us out: https://ethglobal.co​m Email us at: hello@ethglobal.com
Transcript
foreign [Applause] [Music] but hope you guys are all fine and having a good time here at eth India so I'm part of covalent covalent is a data API service and we provide blockchain data to more than 40 blockchains close to 50 now so today I'm just gonna give you a quick introduction to what is covalent how you can start building on it and what kind of data you can get before we begin um if you scan this QR code you receive a free covalent themed if India nft so yeah there's no reason not to do so uh you just need to sign up and register you get a free API key you can start calling and using our API and you also get this nft so please go for it testing oh okay okay awesome so um as many of y'all know um the future is looking multi-chain in fact right now it's already multi-chain and we believe that by 2025 there will be uh dozens of dozens of blockchain layer one layer 2 app chains Etc and there will be a problem however you know from a perspective of a Dev which is that uh we're gonna have a data challenge right unless you're working purely in one ecosystem uh you will probably need multi-chain data and multi-chain data right now is difficult to access right um they are mostly stored in point query form uh if you host your own node obviously like that's terabytes upon terabytes of data and that's really difficult and most of the data is not aggregated the host on Smart contracts and even if you call using web3.js or ethers.js they are Point query little small Lego bricks so it's hard for you to get the high level picture right and most of the time if you are querying using uh some sort of a SQL database the the queries can be really really complex so we've kind of abstracted that away from you as a Dev right especially if you've already built or spent all your time and energy on ux UI on your backhand solidity code whatever and you just need a quick way to get on-chain data onto your front end or or any other kind of client covalent is solution for you right it's a single rest traditional rest API which allows you to get all kinds of blockchain data like balances transactions um nft data it's curable from the cloud uh you can you know use all sorts of environments to call it technically it's no code required right we even have a feature where it allows you to download everything in CSV so it's super convenient for the analyst friends if you just want to like you know download the data put it on Google Sheets or whatever and it enables you to go multi-chain in a matter of minutes how does it work so obviously the blockchains holds the data themselves and then exposed to us via RPC nodes right covalent is almost like the data layer we host the full archival nodes of every single chain and then we aggregate the data package them up into a standardized model and we serve them up to you in a rest API form so it's really simple for you uh when you use it and it's used to power all sorts of applications so uh on top of the fact that it'll make your life simpler we are also used by over 40 plus developers and More Than 3 000 projects out there right now so yeah I'm sure you guys are dying to know how you can get started so um everything is our docs you can just check out how to use the API from our documentation we have an API reference which allows you to call the API directly from your browser typically I would be exploring this but because the Wi-Fi is a bit flaky right now um I would just be skipping that and maybe I'll show you a little bit about what the response looks like uh using some of the slides here and also you can we have also built out you know code templates uh that enable you to um just code along or quickly drag and drop code Snippets into uh front-end like react front end or something to see what kind of data you can get so this one for those of you who are in uh familiar with Postman right getting um all sorts of data through this lovely interface we have built out this Postman collection that enables you to sample all of our endpoints uh from the comfort of your Postman workspace so you just go to this URL covalent hq.postman.com and you will be able to find this collection here and it has all our endpoints with the chain ID with the wallet addresses pre-configured so all you need to do is to press the send button and you'll be able to like save the response to study in the future you'll be able to see the response structure does it have the data that you need um Etc right so it's probably a bit small for you to see here but there are four categories of data that we provide in general that balances data and that includes uh nft balances as well this nft data there's also transactions data and uh what we what we call Base so that allows you to get like all log events of smart contracts for instance right and also X Y equals to K which is the Dex data so you can get all the liquidity pools you can get all the um the amount of seven day liquidity in a Time series you can get 30 day fees Etc so if you're looking for inspiration you can build nft Marketplace very easily and that's just a matter of a couple of API calls all the data is there right you don't have to um I guess make 50 or 100 queries which is what you will be doing if you're using the likes of Json RPC you can build uh you know a D5 portfolio trackers like zapper right which allows you to see all your token balances and more so all these are the endpoints that allows that loading you can build the likes of wallets um inside our balances endpoint is one of the most popular endpoints that we have that allows you to very quickly get all your token balances as well as nft balances as well as the NFD metadata which is all where other images Etc stored you can build sites like coin gecko which has you know the top top tokens um the amount of liquidity Etc so now for this hackathon we have also a pretty juicy price for you guys so you have uh 10 000 usdt or usdc prize pool and the top three prizes get respectively 3K 2K and 1K and uh we have uh and then we have the 4 000 uh dollar prize pool for the remaining projects and all you have to do to qualify for the prize pool is to make a meaningful call to our API and as long of course like um to qualify for the top prizes you have to have a good use case your use case has to be novel um the problem they are trying to solve should be a genuine and good problem of course and we also judge on the quality of your um implementation but of course given uh this to be a hackathon environment most of the time we are judging on the quality of the idea itself right so yeah and then you need to use the covalent API uh yeah typically I would try to give a quick demo and if I'm connected okay I am connected to the internet let me just okay hopefully um it allows you to call something without an API key here oh there we go we have the response here let's open it up uh I need the adjacent formatter I wouldn't um get you to suffer through that but if you see here this is the sample response of our balancer's endpoint all it is is you know one query the query string passes in the chain ID which in this case is one and then the address it resolves the ens which is demo.
eth but you can of course put any address here and then it gets you the token Holdings of this address and as you can see this address actually holds 122 tokens 123 including zero so um and each of these items uh all the information you need about the token you know your sdt and this is the contract address of usdt um and this is the balances in way and all you need to do to get the uh uh eth is to take 10 to the divide by take that and divide by 10 to the power of the contract decimal here and uh it also holds some Frontier token this amount of Frontier token some native token eth right fairly straightforward you can get the historical portfolio value of any address so they'll allow you to build the chart with you know ups and downs of all the tokens that you hold um you can get all the um nft holders of a particular collection as of any block height right so that's very useful if you are doing on-chain nft analytics of let's say uh who uh the token holders of pudgy Penguins as of January this year right and compared to now maybe and so for nfts you can get all the nft transactions you pass in a contract nft contract address and it will give you all the um you know all the transfers of the nft that is made so of course get all the transactions etc etc now just one final thing before I wrap up so oh yeah another thing is you go to that I believe is this URL I need to sign in but if you go to that URL you will be able to Fork the covalent Postman collection which is a super neat tool the one that I mentioned just now so we also have built a web 3 resources which is like a starter pack for you to quickly integrate it into your app so this is like a react Library we have built out a couple of components right so for token balancers you see that uh this is the simple react component that will just input in the address [Music] and it gets you all the token Holdings so it is a component here that you can plug and play this is a erc20 transverse component you see all the transfers made of all these erc20 tokens this is the token holders component and this is a transactions component you're passing the address you see all the transactions of this wallet [Music] so each of these are used are built just simply using one endpoint One Call right yep that's about all that I have uh thank you for staying through with this um I'm opening up this um this last bit of time for any questions that you may have if not for those of you who have just arrived you can still scan this to get a free covalent at India nft any questions anyone feel free to ask all good okay thank you guys
Automatic transcript — names and jargon may be misspelled.