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

Loading player…

Gelato Workshop | Luis Schliesske aka gitpusha | Serverless Web3 Functions | ETHDam 2023

CryptoCanalSat, Oct 7, 2023, 12:00 AM

Luis Schliesske co-founder of Gelato Network. https://twitter.com/gitpusha Gelato Network https://www.gelato.network/ ETHDam is a Hackathon & Conference that gathered over 500 DeFi and Privacy builders on the 20th and 21st of May 2023 in Amsterdam. Privacy is normal. Following the arrest of Alex Pertsev, a Tornado Cash developer in the Netherlands, ETHDam 2023 is determined to counter the chilling effects of the lawsuit and bridge worlds to discuss the future of privacy and encourage to build on the shoulders of cypherpunk giants. ETHDam is powered by CryptoCanal, - a blockchain education and events platform growing in Amsterdam, spreading its roots to Rotterdam and Zurich. ETHDam 2024 is on the map already! Keep up with us to see updates: CryptoCanal https://www.cryptocanal.org/ CryptoCanal Twitter https://twitter.com/CryptoCanal Join CryptoCanal Community https://t.me/CryptoCanalCommunity We would like to thank our partners and sponsors that made this event possible. 🌷 Our BFF 1inch https://1inch.io/ Our Frens: Sismo https://www.sismo.io/ Aleph Zero https://alephzero.org/ Scroll https://scroll.io/ RAILGUN https://railgun.org/#/ And our Sisters: oasis.app https://oasis.app/#earn Maven11 https://www.maven11.com/ bitvavo https://bitvavo.com/en Lido https://lido.fi/ Spankchain https://spankchain.com/ API3 https://api3.org/ Gelato https://www.gelato.network/ VanEck https://www.vaneck.com/nl/en/crypto-etn Marlin Protocol https://www.marlin.org/ Silent Protocol https://www.silentprotocol.org/ Cyber Capital https://cyber.capital/ … and Proto https://twitter.com/protolambda 🍍

Transcript

foreign [Music] I think I'm yeah that's there nice so hey everyone I'm Lewis I'm the co-founder of gelato Network and today in this Workshop I want to show you how you can use our serverless web3 functions to basically Farm engagement on your lens account who here has a lens account already nice quite a lot of people cool and as I said in the beginning you can already if you brought your laptop go to testnet.lansa.xyz create your test net lens account this is by the way anyone can do this you don't need to have a mainnet lens handle for this so yeah you can try this out in the workshop so quick um background about gelato gelato is web please decentralized backend and yeah we basically empowering Builders developers to augment their smart contracts um to to basically build um much more scalable and user-friendly web free applications and gelato is a basically a decentralized stack that has currently in its Suite of products smart contract automation transaction relaying for gasless transactions and weapery functions for Access and indexing on off-chain data and this is roughly how it works so you have gelato validators of chain um we basically work with currently five node operators in this network that are validating and sending data um from from off chain and yeah then the question for these services do you want to automate a smart contract do you want to post some data from a web 2 API or do you want to relay a transaction and if so you can talk to our gelato entry points and then get this done by this decentralized network for you and on chain there's a smart contract protocol which then forwards your request to Pancake swap for a limit order they use as for example or Conex uses us for cross-chain bridging many many pretty much I would say every D5 application or many nft applications use gelato in one in some shape or form so the agenda for the workshop today is to use agility null code solution to prompt chatgpt to post to your lens account um so basically instead of you posting on lens you can have chat GPT post on lens for you and you can give chat GPT a prompt uh you know to to sort of limit the scope of what it can post and we're using our serverless webpray functions for that and I will show you the code it's very minimal but I will also show you how you can do this we have a UI for this which we quickly hacked together yesterday so don't expect uh Steve Jobs like design um yeah that's Landstar so if you want to follow along in this Workshop you just have to go to testnetlenster.xyz you have to sign into metamask um you know the internet has to work for this I know we have someone from the from the lens infra team here what's what's up all right cool now it's working all right you sign in in this case I already created my account now this is a July to death account all right yeah and as you can see here I created this account yesterday and I used a lens gelato GPT to say give me some wisdom some computer science wisdom and every 10 minutes you see gelato's posting some wisdom from your lens focus on logic not memorization always strive for modularity that's very fitting right ethereum is becoming more modular that's great also I can go to my other account where I asked chatgpt to post fun facts about Amsterdam by the way there's a bit of a small bug here with chechi PT it sometimes does this or less thing but apart from that it's pretty cool like Amsterdam is the third most bicycle friendly city in the world the world's first Stock Exchange open in Amsterdam the city is over 400 years old and you can see every 10 minutes I'm posting some cool stuff about Amsterdam right I mean in reality it's gelato weapery functions and chatbt doing all the work for me and I might get the airdrop great so yeah that's how it looks in the end um you can go to the UI at them I should share the link here so we have a UI for for all of this um it looks like this and as you can see here it's eve Dam Dash gelato.web.

app uh sorry I don't have this in a link anywhere but if you want to you can go on here now iftam-gelato.web.app and you can connect your wallets um and in this case I basically already went through the steps but I can quickly tell you what these steps are so first we set a lens allow you allows you to set a dispatcher and a dispatcher is basically a an account that can post to your lens profile so here we're setting a gelato dedicated message sender this is a gelato smart contract module as our dispatcher the UI literally will just give you a button if you haven't done this already to click set dispatcher um and yeah you just have to put your profile ID in there so that's quite important let me quickly go back to my profile and then let's go to the git Pusher um so you have to set this profile ID here on Mumbai um and oh actually maybe not here but somewhere you have to set your profile ID and then here you see I'm logged in with my Dev account and there I say give the prompt here that I want chbt to generate text for me based based on based on that prompt is give me a bit of computer science wisdom and you then just set prompt this is an on-chain transaction talking to lens and then um talking to lens gelato GPT and yeah from that's it like two buttons and you're off to go anyone in the world you don't have to be a coder for this can now have chat GPT pulse on their lens accounts for them two buttons um yeah that's the UI if you want to try it out and now it's time to get into the meat of things and yeah does someone already have a question here or because now we're diving into some code oh good nice yeah it's gelato adapter so it's a gelato middleware smart contract that connects to lens and it also connects to the gelato web free functions protocol um but but yeah essentially it's an integration with lens and by the way a shout out to the lens team because these Integrations were so easy to do with super cool made me a lot more bullish uh I think uxy's there's still Improvement but from a developer experience lens is already I guess better than Twitter today foreign so first of all what are July web3 functions webview functions are decentralized Cloud functions that enable developers to connect their smart contracts to off-chain data ensure data is accurate run often computations execute transactions on all major blockchains send notifications store data it's really just like we give you the ability to just write a typescript file a script and then currently the script is then deployed for you on ipfs and from there the gelato nodes download the script and they run it for you and what what you want to do in the script is completely up to you so we basically before if you use our gelato automate service services or relay Services before you were already able to do a lot we gave your UI to basically Define what contracts to call under what condition all of this stuff but it was very limited to on-chain data and now with this you can talk to any web tool API on the internet get access to any resource and sort of enrich your smart contract work Pipeline with data that is not just available on chain like you can talk to sub graphs here if you have a subgraph you can talk to coin gecko whatever you want right and we're also working in the in the next release so it's currently in beta you can get white listed to our web3 functions beta but we're also working to decentralize the valid data set here so that eventually this data will also be validated by multiple node operators so that if one of the node operators is down or has some faulty data ideally this would be um basically removed yeah so how does it work you write your web free function um ipfs gelato nodes downloaded run it and then we execute this for you and we send the transaction for you via the gelato protocol on chain use cases are Dynamic nfts you can leverage one inch for example like a lot of protocols that use gelato automation before always had to encode payloads for uni swap swaps on chain and now they can use one inch which is much better of course in terms of execution price um yeah I guess life I could use this as well to automate bridging across multiple chains um yeah there's and here I mean yeah this is what we're doing today the that's AI post messages to lens protocol yeah that's not too interesting so so let's go to the actual thing like how how does it work how is it how does it look behind the scenes um and first we will have a look at the Smart contract the legend GPT integration and then the web free function and this is the solidity code for the the smart contract and it's really insanely easy um you just have this we just have the set prompt um function and this is what on the UI you you call when you set your prompt I don't know give me a fun fact about Amsterdam every 10 minutes on lens and yeah you just basically you just um you just have to submit your profile ID on lens we verify that the message sender is actually also the owner of this profile so um yeah that's just a sanity check and then um we we also require that you have enabled uh gelato's dedicated message sender as a dispatcher so you have given gelato protocol access to your lens account um and and then um that's it and then we just store your prompt on chain and that's all that's all we need we can then now that you prompt a store stored on chain we can then in the web free function off chain that we wrote for this read your prompt talk to chat GPT post on ends on your behalf so that's it that's the web Suite function now so this is the Smart contract but insanely easy right it's literally just like talking to lens and and this is the back end part so this is a web free function example using typescript very simple script and the first thing we want to do here I mean there's a bit more you can check out the code I got a linked uh yeah maybe I can share the slides here later we will probably publish it somewhere but basically first thing we do is we we talk to open AI and the cool thing with a web free function is that we you could even use secret API keys so you can write your gelato webview function and you can use secret API keys to talk to your open AI account for example and here we just talked to chat GPT we use the prompt that before we fetched on chain from the smart contract and yeah we get the text back from chatgpt and and that's pretty much it um so you can think of this like you can use gelato web3 functions here to talk to any API really get any data from it and then post it on chain or do whatever with it start on ipfs all these things in The Next Step we're using the lens client to basically just validate this publication results or our chat gbt generated text and we we then stored on ipfs because lens obviously integrates with ipfs to fetch the content so that's that's that basically just storing storing our post on ipfs so this could be one of these uh chat gbt generated fun facts about Amsterdam that is now stored on ipfs still in the webpray function here and now we generate the data for the post so this is lens a lens object right we put our profile ID we put the content URI to the ipfs post that we just stored on ipfs lens stuff right and off we go like we then just tell gelato okay gelato I have a new call data for you have a new payload for you to send like gelato is very specialized and transaction sending right so hey gelato here's a new payload please call the lens Hub address for me and please post my data on there right and that's it then in the end you just have to say Okay it can be executed and um and off we go so that's from from then on out in this returns this statement the your request gets sent to the gelato P2P Network and it will be executed and yeah so in the end you can see it posted just now two minutes ago it posted a new fun fact about Amsterdam Amsterdam is home oh no wait this is probably one that it posted before as well here 59 seconds ago I posted on lens it is home to the narrowest house in the world yeah there's stuff stuff on here right so um I mean we could try one thing quickly I think it pulls every 10 minutes right now but I could change my prompt to something like um tell me a fun fact about London I'm setting the prompt now and yeah so now the transaction is being sent my prompt is changed and now my gelato web3 function in the next round will get my new prompt it will talk to chatgpt again generate a new text based on my prompt poster to lens for me given that we just had opposed one minute ago I think this will take nine minutes from now on so we probably won't see it anymore but yeah now my prompt is tell me a fun fact about London so in nine minutes about you should see on my lens profile if you follow me on on the test net lens get Pusher you will see fun facts about London and and that's just one very simple use case of what you can in just this much code build with web free functions super easy for developers like you don't have to worry about hosting at all anymore um you you don't have to worry about like RPC connections smart contract transactions all of these things they're all abstracted for you and just like this you you can build a no code interface where every lens user out there no matter how technical she or he is has access to a bot that pulls for them right that's pretty cool so in a matter of I don't know half an hour you can you can build a UI for anyone in the world to have a bot that posts on lens That's The Power of it and obviously you can take that and apply it to many many other different use cases do whatever you want with it uh yeah that's that's it that's the workshop any questions it's not related to the workshop I really like it yes it's a nice idea it's related to be white listed like I apply it uh more than one month ago and I I don't know what's happened I'm not quite listed yet to try it okay this is for the weapery functions beta right exactly did you go via our Discord server uh no I think I use it a form okay yeah I think we've got many many applications so maybe some of the forms were lost the best thing is to go via our Discord server they are usually you get why does it pretty quickly okay yeah thank you and so sorry that it was not done yet I think it will be open also not not far from now it will be open access maybe in a month or two then then you don't need to talk to us anymore to do something I is very interesting user case I like it and I want to know you mentioned that um you will like this is super simple code and then you can have this user interface and I want to know do you abstract or do you get all the data from open AI or you do do some verification or some validation of the data and also what kind of data you can get from there like all the any sort of data for like yeah yeah so technically in web 3 functions you can do whatever you want we just basically give you a sort of platform as a service to build whatever you want you can build your own Oracle with this and so on now of course uh if you if you need your data to be super secure and validated then you you would have to add that in yourself at the moment we're working on having some basic consensus data validation and so on for this so that anyone can benefit from in the future as well but um yeah you can really get any data you want do anything with it what you want of course if you have a D5 protocol so uh most likely it shouldn't just rely on on your data without any verifications on right um so so there you have to be careful but yeah for for a use case like okay I just want to use chatgpt to post on my lens account yeah I don't think there needs to be much validation so like I can trust the opening a AI API and and even if chbt generates some bogus not the end of the world yeah thank you yeah thank you I have a small question so for the back end part you could all in typescript and then you deploy directly like you have a CLI or how does it works exactly yeah let me quickly also put this up here in case you want to join our Discord and so on um so basically currently you just write your typescript file and then we have an SDK a webview functions SDK we also have a hard head plugin that makes it super easy to test stuff it's super cool and with the SDK it's very easy to deploy your web free function there is a deployment script it's very easy um and then the way you currently submit inputs um to your webpry function is by going to our app I can quickly show you this one second so we have a very nice UI that we originally use for our smart contract Automation and there for example we we now have this page for any task that you want to create on a web free function so if your web free function like want some inputs you can submit the task on chain at the moment and that's what we did here and here you see for for this task here this is this is basically the webpray function that collects all of the prompts from all of the users using this and then it generates all of the chpt contents and poses to each individual lens account and you can even see here the task logs um here you can see it ran it ran a couple of times here here actually it was ready every 10 minutes and it submitted for execution like they eat chocolate Contours for breakfast or what is this is this maybe a an Amsterdam fun fact Amsterdam was the first city in the world to have an aquarium wow yeah so yeah basically once you once you actually deploy your weapon functions you immediately have this very nice UI where you also can connect with your wallets and you can get logs even the logs like if you console log in your web function you can see those you can see the code here it's not so nice because we didn't properly use the apis but you can even have a look at the code here here that's the code and you can import any package you want inside it it's not like in the graph or with the weather or whatever you can use npm okay thanks or it's by the way if uh yeah we I think we are probably over time but I don't know we still have some time and if we have if we're a bit patient we can see the next post oh two two more minutes and then it should post again so let's see hey uh nice presentation I have a question um so these we have three functions they are in typescript right yes um are there any concerns that some people are deploying maybe malicious code and then the gelato workers execute that JavaScript and yeah so obviously this is the biggest security um vulnerability there the the runtime environment is sandboxed it's actually using the node.js not node.js and um so we're investing a lot in security audits there research and so on and also part of the reason why it's still in beta is because we still want to test it out much longer but yes essentially it relies on a Sandbox environment and there's a lot of security engineering you have to do for this to be safe on the back-end side certainly not easy so typescript and not JavaScript then yeah I mean typescript is Javascript right or basically huh thank you thank you very much all right all right I mean if we have one more minute okay yes let's see otherwise follow me on testnet then skit Pusher okay let's actually let's do a live look into the logs here uh something was canceled not sure let's see yeah by the way feel free to kick me out whenever um yes [Music] ah it's a very good question actually um for Twitter I mean I know people write their own Twitter Bots and so on I don't know if like what I like about this is yeah I mean if you're a tech guy you could say oh I can just write about myself right but the cool thing about this with gelato is that you can build an application that is accessible by everyone right um I'm not sure if something like this exists for Twitter like a UI where you can basically with no code just tweet but now it exists on ends actually we will deploy this to mainnet soon as well so if you have a Mainland sandal you know that's that's where the farming can happen and uh yeah actually another idea that I just had from from your question was I think a really cool thing we want to build uh with this is a mirroring so that you can post all of your tweets on lens via gelato web function uh so yeah cross posts yeah exactly all right let's see how maybe Mumbai is congested no there it is that's the finale of the workshop Amsterdam has more than 1 000 Bridges more than Venice there you go all right that's it thank you

Automatic transcript — names and jargon may be misspelled.