New Ethereum talks, every Monday. The week's conference uploads by event, in your inbox.

Loading player…

Dune 🛠 Deploy an app with Dune in 30 minutes - Susmeet Jain

ETHGlobalMon, Oct 9, 2023, 12:00 AM

Join Susmeet Jain from Dune for a workshop titled "Deploy an app with Dune in 30 minutes". 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] as the title suggests we are here to riddle with Dune and I've planned this Workshop to be very Hands-On plan for you guys to work along with me and write some queries on Dune uh I hope your internet works just enough for you to do to be able to do that but otherwise we still have some content that's stored offline and we'll have a great time so I have added uh all slides to this QR code so you can scan it and get slides you will be able to access all links that are shared in the presentation so those of you would like to do that I'll just give a moment for you to do that and so how many of you are here by the way familiar with Dune you have used dune uh or at least seen a dune visualization uh can I see a raise of hands a quick raise of hands please okay so few of you so you must have come across visualizations dashboards like these uh overdone and for me the best place to start for any new programming language or a technology like this is to write a hello world program so without any further delay what I wanted to do was to just go to dune.com and start writing queries so okay I don't think that's going to work but we can continue the presentation so basically Dune has decoded tables from all kind all all blockchains that uh that are mainstream right now we have data from ethereum we have data from polygon L1 zl2's arbitrum optimism and now even Solana so this data is a community sourced in a big way uh the community submits contracts for decoding and that's how the data gets available on dune.com and everything that you see on all dashboards like these that you see on dune.com uh when you go to the Dune website you see all this trending dashboards uh which cover the latest in all blockchains all protocols when you when you go to this website everything that you see has been created by the community and it's open source it's available for you to use uh when you click on one of these dashboards uh if it opens with good internet you get to view the query with which the data has been fetched and you get to modify that query and you know make it work for your own use case um so I am here particularly for the API we as a dune team here are particularly at East India for the newly launched API the API is still in beta and you guys get very early access to it and what the API does is everything that I just showed you all doing queries dashboards all that data is now available on an Epi endpoint for you to consume in any medium that you like in your applications directly on your front ends if it permits or you know replace your entire data engineering Pipeline with just a simple Dune query so it's a very powerful API it's a very simple API but its capabilities make it very powerful because of the community sourced work that's been done on June so I have the new API documentation open with me right over here and it's as simple as you go to any query that you like would like you'd like to access on the API the data from any query that you would like to access on an API endpoint you take the query ID I'm going to zoom in a little bit so on in when whenever you are on dune.com there is a query ID associated with any query that you see on June you take that query ID and you just call or execute query endpoint execute query API endpoint with that query ID which returns an execution ID then you take that execution ID and you get your data right just like that so you pass the execution ID to our get query results endpoint and you get the data so basically with just two API calls any data available on Dune is now available on an API endpoint that's how simple and how powerful the Dune API is um so I have created a sample application as well for you to show how we can go from a dune query to Arduino app very quickly now that we have API access to dual so [Applause] if the internet works just fine what I'm going to do is this GitHub repository by the way is publicly available and it is linked in the presentation as well this is the link to the GitHub repository I'm going to try to fetch this code and just show you how you can use the same code to run any query and quickly build a application on Dune so I am going to make another folder I'm going to call it eth India and I'm going to go into this folder and I'm going to clone this Repository and I'm going to give it a few seconds with the current Internet that we have and come back to the presentation so um while the code is being fetched uh or on on the terminal I'll quickly go over the steps that you need to follow to get a API key for yourself so we have specially prepared a hacker guide for eth India hackers you can again get it if you have scanned the presentation already you already have the link otherwise there's another QR code here you can scan it and you will get the hacker guide we are prepared specially for you guys and it has all the details for you to get started different ideas with which you can get started and most importantly how you can get an API key so there's a form a short form that you'll need to fill up and we'll quickly set you up you'll find the API key in your email shortly after you fill up the form and after after which you also have bounties I'm going to talk more about that so I can see the code has been fetched the code for the Dune app template that I've just prepared so I'm going to show you the steps that are needed to quickly spin up a tune application using this template that you see right in front of me I'm going to open this code and vs code so this little part over here is something that developers might be able to follow uh more more easily but any of okay sure sure yeah yeah so I'm also going to try to zoom in a little bit yeah so what I yeah you can see now fantastic so what I did here was uh there is this link to GitHub repository which is also in the presentation I'll again share the QR code to the presentation so you will have all the links in place so I what I did is I just clicked on code on GitHub I just copied this uh get URL and I cloned it into my local system right this is pretty much all I've done and to open the code in vs code I just I've read in this little line uh I'm going to move a little quickly so those of you who are not developers might miss a few steps but we have our booth right here please come to us right now we are a little bit crunched on time so I'm going to move a little faster but please come to us we are here to help you we'll get you across any step that you're stuck on we are here to help you build with the tune API okay so yeah so I opened this code in my vs code and I trust the authors I am the author and um I'm going to quickly copy this environment variable file so there is a environment.

example file which you need to copy to just pass the API key to the application so I'm just going to create a new file I'm going to call it dot EnV and I'm going to paste this over here so I have my API key stored with me right now um in the Dune folder just give me one second I prepared this just now yeah okay found it so I'm going to be deleting this API key so that's nothing to worry about and I'm going to paste this API key into my environment variable file which is to pass this API key to my application I'm going to save this and another change that I'm going to do is there is a file called application dot by app.pi what I'm going to do is just pass the query ID adjune query ID to this application and that's pretty much all so like you pass this query ID you just edit this query ID I have example ID right here I'm going to take this and add this over here and this template is pretty much ready just one last minute change which you would not need to do uh but I'm doing it for the demo over here and now now we are good to go so and I need to activate my virtual environment yeah and I can run my application [Music] I ran into an error error over here let me try to debug this okay okay thank you yeah now we're good yeah now it works fantastic so yeah this is the template app so we went from a dune query to an application just like that in a couple of steps uh this exact steps are listed on the GitHub repository and again as I said we are at the boot to help you out and if the internet works this application should actually work right away So within this application you saw I passed a particular query ID you saw this query ID being passed over here so I'll quickly show you what this query actually does so I have this query open at dune.com with me right here so this is a query that fetches the total amount of US Dollars spent by any particular address in their entire transaction history on ethereum this is what this query does so it takes an argument as an address as any wallet address on the ethereum blockchain and it gets you the total amount spent in US dollars so the details of this query uh are something that if you want to learn about you can again come to our booth and we'll definitely explain you but right now you can consider this as a black box the good part about the API is so the good part about the API is that you do not need to understand these queries you do not need to understand SQL all this work has been done by a community you take the query ID you catch the get that data on an API endpoint just like that so all the work that has been done by the community you get access to it and build interfaces on top of it with the API so I'm going to quickly show how this works in the Dune interface I'm going to take a random address so 0x5 sub.edh it's an address that belongs to one of my friends and while I wait for this ether scan link to load I'm going to go back to my application okay this is loaded fantastic and I'm going to so when I paste this address here and I run this query it just fetches the data for me it fetches the total amount of US Dollars spent by this address on the ethereum blockchain and all the transactions the sum total of all their amount so right now it it's in the Dune interface it's on the dune.com interface and the same thing is now available to us on an application and this is taking a little dial extra it's quicker than this uh again because of the internet as you all know the Internet situation right now so coming back to my presentation I'll come back to the application and show you when the results are loaded but coming back to the presentation uh yes we have ten thousand dollars of bounties on offer uh five applications five top applicants to this bounty will get two thousand dollars each and we have some swag for collection so you can come to our booth and see the swag that we have and we're very serious about our swag what you see here is available only for this event it would never be available again you we in fact have a page dedicated to how serious we are about our swag you can check dune.

com lookbook to to see to have a look over that and so that's about the bounties and I'm going to come back to the application well it's still running because I suppose the internet um coming back to our presentation again [Music] so I've also attached a link to our Discord that's the best place for you to get into the Dune Community it's super active with not just our community team but the community of wizards we have built the data analysts we use Dune every day so many of them are using this for the full-time jobs now and they are all hanging out on a Discord you can come and start playing around with Dune playing around with the Dune API and you would find us there and you can follow us on YouTube as well as Twitter so YouTube particularly we are releasing some really good content uh Andrew Hong if any of you are in the web 3 data space you probably follow Andrew Hong he has recently joined us full time and he's going to be releasing some amazing content on our YouTube channel so stay subscribed there follow us on Twitter give us a shout out while you're building at East India using the new API and you know we'll retweet you and we'll follow you back and with that let me come back yes the connection was about it because I guess it took too long so I'm if you want to have a real demo of this application and the things that were actually planned for this Workshop you can of course come to the workshop come to the booth we would be there for all three days if you guys keep coming to the booth I'll be hanging out there late until night I'll be there building with you hacking with you so a team our team is here we have our champion community visit zero Xbox AKA Florian over here who has built the Dune Community from ground up come say hi to him come say hi to David Bell and me we are all at the Dune booth and with that I think I'll open for questions because uh with limited internet I don't think I can actually do more demos so uh those of you who might have some questions about doing any kind do you know they're doing API uh we're open to taking them and you can raise your hands and someone will help you out uh yeah can you raise your hands again please uh hi so what is the source of your data and you publish it I mean I did see ether's scan on this so I guess that's one of them but what about the others yes yes so the the thing about data from blockchains is it's all openly available so this data is nothing that demon is curating it's available on blockchains openly what Dune is doing is it just making it easy for you to access it that's all we are doing so etherscan is one UI on top of the same data so if the internet was working I would have actually gone to etherscan and shown you how the same data is available on Dune and ether scan and perhaps on many different platforms we're just building a UI on top of these scenes so this is a completely new paradigm for data and dune is just trying it trying to make it super easy to you know have it in a place where you can analyze all this data in a very simple way like you don't even need to install anything you can be on any system you just need a browser you go to dune.com and you can start analyzing blockchain data data straight from blockchains guys so does that answer your question thank you so I had a chance to go to the booth so before I get to my question I just like to know that can we have like customize the screen queries yeah yeah yeah so guys okay so if we can do that let's say um I have like multiple sources of data one of them let's say is on ethereum chain or something but others are like let's say a mongodb production database or something like that so does tune have a facility where I can use like let's say uh DB like mongodb along with like some chains to analyze all those things at one place or will I have to do that yeah absolutely so this is where our API comes in right so uh before I continue my answer I'll just check with the organizing team so I have to use the same mic or is there a different mic with the headphone I'll use the same mic I need to be here or I can walk around and it still works does it still work all right um so of course this is where the API comes in so you can combine data from Leon you can take it out to an API endpoint you can get it into the media into a medium that you're familiar with it could be W it could be any database it could be a mongodb database that you want to get that data into so our data is organized in SQL format so it will need some work for you to you know combine data from two sources one is nosql and one is SQL but yes it's possible and in fact we are here to help you with just that so come to our booth and we'll help you out we'll fix you up I'll just go to my second question there yeah so uh from what I heard you can be use a dune also as a data engineering platform like to set up pipelines and all right so I didn't see that in the demo so maybe yeah no no I'll just give a quick answer to that as well so what I meant by that was currently if you have to Source data from change you have to build very sophisticated engineering infrastructure so those of you who are developers here you will know how much pain that is so what Dune does is if you want very customized data you want some exact data that you want from change and nothing else you can simply write a SQL query instead of building that entire infrastructure now that gets outsourced to Doom so Dune is taking care of building your engineering team and Engineering infrastructure you just write the query you get the data into your own database using that and of course again for implementational details now come to our booth happy to answer I think you also touched about multiple chains so I'll drop a quick note on that as well so some of you had questions already about do we support data from different genes and do we support cross-chain data so on dune.com you will find something called Dune engine V2 which is especially meant for crossing data analysis you can actually combine data from ethereum and polygon if people have addresses across change which is I've seen similarities across genes you can get their transaction data across scenes in a single query in a single table so this is also super powerful and we would love for you guys to explore that as well so it is possible to do cross-chain analysis it is possible to take Dunes data and combine it with off-chain data everything's possible and we're excited to see what hackers here built with the API now that all of this is possible um all right next question please okay so my question is let's say I have an empty Marketplace and I want to fetch all the nfts held by a particular user from the wallet address so for that I usually do a solidity function to fetch all the data so how is that different video tune yeah so you just mentioned the complexity that you go into to get that simple piece of data if it unit it's going to be super simple so we have created a aggregated nft table which is called nft.reads and this is again being done by the community so we have an initiative called spell book and we have a GitHub repository called Spellbook github.com Spellbook so over there our community is aggregating data from across scenes from across Protocols of different nfts and it is they have integrated it into a single table called nft.

reads so every trade that has ever happened on any nft it's all aggregated into a single table and if you want to query data for a particular address what you simply have to do is Select star from nfe dot rates where address is equal to the address that you want and it will happen in minutes like you just go to dune.com you write this query and you have all that data and now you can get it on an API endpoint use it in your application one of the problem is that when I try to fetch all the nft let's say it kind uh can you be a little louder I guess hello yeah I can hear you okay so another problem is that uh let's say the wallet has 100 nfts so for every nft I have to you know make a different RPC call so will that be same for the Dune or the Dune simplifies it also um so I think this is a question you would have to come to our booth and we'll be happy to go into further details of this yeah okay thank you thank you uh more questions all right I'm trying to look into the back if anyone still has any questions um in any case uh you know a booth is okay we have one question also asking about your community program so you have this Wizards program like what's the like what's it like like you have like a progression that you have certainly you talk about that right so um you just mentioned Wizards so uh the community that has grown around Dune people who are actually doing data analysis on you we call them Wizards and because it just feels magical to be able to get data from things just like that and when you see we have a program for visits I wouldn't say we have a program for visits but we do value our community very highly and there is an entire Community team at even dedicated to just supporting our visits so if you start working on Dune if you start doing data analysis on Dune or even using our API now so yeah so you would be in our visit community and I mean this is something to be experienced so just come into a Discord hang out with us build with us and you'll get to experience what it's like to be there so that's the answer to your cash yeah all right okay uh thank you so much everyone for your time and please come say hi to us at the Dune Booth we would love to help you build with the Dune API thank you so much [Applause]

Automatic transcript — names and jargon may be misspelled.