Connext 🛠How To Build a xApp in 10 Minutes - Sanchay Mittal
ETHGlobal·Mon, Oct 9, 2023, 12:00 AM
Join Sanchay Mittal from Conext for a workshop titled "How To Build a xApp in 10 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] I think I've already gave my intro I can do it third time uh this is Sanchez mittal and I don't know if Mike is working or not I'm gonna shout it up yeah yeah uh so we are building Crossing Dom domain applications everyone is aware of tabs I'm assuming that's the case everyone is aware of how the smart contract works if not we will go through that don't worry at all uh but let's start with the mindset that if we are building a adapt or any applications uh they are not existing only on ethereum now we have polygon we have optimism we have multiple chains which are coming up and they have their own incentive the whole liquidity segmented is all across these trains uh one has bigger or one has another these uh there are they have these incentives which are run uh multiple times and that's why people are getting more and more interested and zaps are we call it Crossing daps uh let's start with a basic intro we will which we will be using these terminologies a lot uh we are not going to say chain because we know that there are multiple uh networks which are not exactly a chain there are we can categorize in a protocol or it could be a roll up which is very dedicated to a specific problem so uh any along L2 side chain and non-evm comparable we'll just call it domain right uh so I I'm assuming you're you guys are with me right now and uh uh as I said slap is a cross scene domain native app so this uh any application which we will be building right now is going to be a cross-saint app that means it is available on ethereum polygon uh any of the evm chains any of the non-evm chains as long as we are supporting and we are checking accounts agnostic as long as it's secure right uh so let's start with the second part uh yes we are a bridge and people have this question are we secure is it uh we have seen a terrible year last year and we saw three billions of hack uh and uh are we are we the same no no no no but we everyone says that so let's explain how we are different but let's start with why Bridge art unsecure why we saw this three million three million oh sorry three billion three billion of hack which happened last year what happened is that we are there are bridges which use these trust assumptions which are basically validator sets uh multi-six so you are depending on these 10 people okay can I Bridge my like million of dollars for and I will trust you guys okay you three I love you and you will uh you will you will take care of me right and that's the trust assumptions which we are making with these stupid uh Stupid Bridges which are using multi-six or validator said that's a that is simply third party and uh how we can sub it and yes there are some code bugs which uh which we have to make sure that we have simply much more large audience we have these tvl caps and we have much more audited power uh audited contracts so people can go through ad and they can report any security issues which are which they are seeing uh so let's all let's jump on to why connects and uh how we how we approach this problem so connects uses modular stack we uh we don't create any new cross assumptions we are not adding any sort of value data set we are not adding any multisex what we are doing this is the interoperable Dilemma if you guys are not aware of I'll run through you very quickly so everyone um if people don't know about scalable Cinema that's okay so when we are talking about interoperable trilloma that is that is where we are talking about cross minimization journal generalizability and extensible so when people try to create these Bridges they try to take these shortcuts where they do trust assumptions and try to Avail generalizability and extensibility so they can use a common interface for the bridges and they can have like a bunch of money goes from one side to another but don't don't never think about the cross minimization but we as connects we take pride in it we we absolutely take pride in is that we 100 focus on Cross minimization we make sure that this is happening and then the user interface or the user experience yes it's very important that if it's going to be horrible I'm like you are secure guys but that's right so we want to make sure that we have cross minimization we have good user experience and how we can expand it to more chains how we can make sure that anyone who is coming Crossing can easily come and they they don't even think about it like okay which roll up or which chain I'm using I just have these six five params which I have to put in and I'm all done all good so what we do is that first let's start with how we are focusing on security we focus on security by using transport layer which are underlined which are present for these Bridges so we don't create a new messaging layer we use these uh existing messaging layer which are pretty secure already or they are the securest one for those bridges so when I'm talking about polygon the POS Tech is the Securities the use value data set but that value data set actually runs the whole chain so even anything happens to POS Tech the chain will dissolve itself right so be the POS Tech is the security one right now in for polygon and same when I'm talking about Cosmos ecosystem it's going to be IBC right and when I'm talking about Roll-Ups it's going to be Roll-Ups so V uses that as a transport layer and then when we we have another security layer above it where we have watches at whenever you are sending a message from one side to another when we when we have when we are receiving this message from polygon to ethereum we have this Watcher set we have we have 20 minutes where you can make sure that okay anyone sees that this information is not correct guys even if you are using amb if it's falsified we can make sure that doesn't happen to us we can report it and stop that that bridging uh which is coming up so uh running too quickly how we can do it we have pause button so on each contract we see that this something is going wrong we have this pause button press it so right nothing is stolen everything is secure we have TBL caps we make sure that we have a TBL caps we know that we will start with like some table cap and once we are increasing it we will have another audit we'll run through the community that please if you see anything report US we have incentive for them and we have five drills which we run through every time where we see that if anything happens how we can do it I mean uh you have to run through it right you have to be prepared if anything worse happens we have to be there and a formal verification additional audits we do it all the time uh generalizability we have an arbitrary message passing that means that you can pass any message it could be any piece of information it's not only token it could be nft it could be a simple I love you message I don't know anyone wants to do that and if they want to send like a uh do a dow governments uh they want to see like uh do I send if if there is away in case right now we have polygon uh ethereum on on multiple chain it's existing but how do they do go adult governance they can use cross shape and they can have the voting mechanism properly done from this so an extensibility we are present on all the chains um how connects works so it's very simple for a user or a adapt developer what they have to do only is that use this x call I will run through the interface itself they have to go through the x-call and that's all it's needed for the dab right you have these seven columns you have to put in there and everything is taken care of the connects uh you can absolutely understand how the architecture works and uh you we have these providers what they do is that they see okay there is a request of completing this message I will run through it I will wait for the message centering layer for one and two hours but for users for the DAP it's going to be one to three minutes at most at most right so you're you're having these transactions which are happening from polygon to optimism in two minutes in a single call and you can have like multiple features available you can put it in the encoding and you can have like a uni swap trade happening you can have uh uh like abundance of use cases available where you can do anything anything cool in a single call which can happen in one to two minutes right uh let's run to how we can do this uh so let's start that 10 minutes which is on the clock uh she'll be on this app so why uh it's one click ux as I explained better liquidity what we have right now we can Avail better liquidity if we know that there are incentive provided to the routers and there are used once you use it uh cheaper and faster transactions of course if you go like each and every train it's going to take like a huge time at also it's not going to be cheaper at all you have to make these three to four or five calls where you have to execute it right you go make polygon ethereum optimism on optimism you make a swap so four calls already added right four Transit is already added here uh we are doing arbitrary message passing so you can do a lot cool stuff and that's what it is and uh we don't pick anyone winning we are uh chain agnostic users are going to use these multiple platforms so we have to make sure that we can actually onboard a lot of users and that's for the dabs right and uh we have a unify interface for all the chains so it's not going to be different for anyone and uh we can pass as I said we can pass any message and that will that can be encoded into call detail uh okay uh so I will run through really quickly how we can do everything uh on these uh on these slides I was gonna do a live example that would have been so clue but uh cool but the internet is not working over here so so let's start with the anatomy of a zap uh when we are talking about these that one simple use case of interaction would be that you can use a simple x call which is available on cunning sort soul you can make provide the parameters and then you can execute it another one is that you can have something cool over here happening on source.so right you can have some functionality over happening here and then you can transfer the money so you can like maybe do some uh swap which happens over here and then you can use x call and then you go over there and then do another swap or anything whatever you like right and let's let's jump on to what we can build with this right uh we I will run through this really quickly and uh I will put in every we have these code examples where I will explain like how exactly you can do it uh it's over here right so um uh what we can build we can do token bridging we can do simple x call where you have to transfer your money from one screen to another you can have Crossing governance where you can do voting uh yield optimization so ethereum has already consumed everything like any better apis is already available so let's find out crossing right we can have it we can have really better API which is available on optimism arbitrum or any other chain which is popping up right now right they provide these incentive for the users to come and provide the liquidity over there so you can Pro get much better epy all across These Chains uh Dex Arbitrage you can have different swaps rate Dex liquidity you can provide the liquidity to the decks again better apy uh Crossing Vault strategy it's really cool really really good so if you have these walls and strategy management you can have these fonts which are already available on these multiple chains and can execute really uh I mean uh it's it's more like LP providing as well as you can have these uh have these strategies which are already given through yarn possibly and you can uh really amazing I'll go through that in one second and we have these chain Crossing loans so you can borrow on one chain and provide like uh paying on on the train right uh we have Crossing nfts so let's make it crossing right so if if we have an nft on ethereum do we want to use it on a game of optimism or the marketplace is going the chain the gas fee which is provided on polygon is going to be cheaper so we want to like make a Marketplace which is available on optimism we can trade on polygon so once we have these these things crotching we can have much more functionality available um uh guys I know that we don't have internet but you can scan the QR code you can start with this template which is available on zap starter where you can uh I'll give like 10 20 seconds just uh this scan the QR code or read the link or click a pic and then you can go through that later on right uh uh okay yes so uh connect with us but we can show this QR code later on let's jump onto the straight on the code side right now um yes so we have dots which are available you can open that as well uh quickly click epic and I will just go through the next slides awesome so when I said X call X call is the main function which uh dap or the user needs to understand a user doesn't even need to understand it adapt needs to understand that so we have these this x call function where we have these seven parameters which you need to provide to make any x uh cross scene call right so you're providing a destination chain where you want to execute this function or where you want to receive this these funds and then you have these Target address uh this is to address so it could be a receiver address or where you want to execute like a new functionality that would be your target address erc220 the token which you are transferring if it's uh if it's not related to token you can address zero this and uh you can send any arbitrary message through that uh delegate uh this is of say functionality if something happens I will go through that later on amount slippage and call data call data is one of the main way you can actually encode something if you are not encoding it's a simple simple front so you can dot just zero exit slippage maybe mentioned three percent so we know that if it's going through the amm we won't suffer loss um so there are like two types of building which would be simpler for you simpler uh which we can do uh that is X call through SDK so you don't have even have to jump on the contract side and if you are doing a contract integration that is going to be a asset transfers on authentic unauthenticated calls where you don't you don't know you don't have to know on the target side from where the uh where this call is coming up let's start with SDK it's pretty simple right so we have these X cards available we only uh we we are doing an approve for the token and uh once we have done that we are here simply creating a call uh it's called using the NXT SDK base so you can download the SDK you just create this simple call and you are done with it and that's all you are already acrossing app uh for this uh as I said there are like lots of lots of functionality I will mention one of them which is like very popular to you guys is that Dex Arbitrage so uh on if you are talking about a price uh probably of it and on ethereum it could be way different on polygon it could be way different on optimism and you have to spot these decks Arbitrage and you can make a good trade you can make money out of it and that will happen in one to two minutes so you spot that you make these transactions here on money and that's what the Dex Arbitrage is going to be about uh this is the simple transfer as similar to the SDK but we are not using SDK we simply want to use contract you can just under encode everything which is happening over here so you have allowance happening you transfer the tokens and uh you have the approve happen you just ex call it let's jump on to the really cool part uh so as I explained initially we had the source contract we have these Target contract right so in Source contract what we are doing over here is that we are sending a simple message that is a new greeting we are sending a simple uh hello world over here and we are just creating X call over here right so when uh we already saw like if we can try if you want to transfer a token that can happen right that can easily happen you just put it where the address 0 is you can put the transfer the token address and you can put the amount and that's that's what it's needed but when we are sending an arbitrary message you don't even want to use the token transfers you can do this where you can uh simply have these Target contract created where this is going to exist on destination chain and this is the target address which will be on the source contract once you do that we have uh you are simply checking that okay uh did I receive like a suffice amount if you want to and you can receive the message but I simply decoding it so you encode the call data you do decode it and send it to the function so we have a simple very simple example where we are sending a simple message but ex just think about this if we are encoding a swap data for uni Swap and we are sending that we are encoding that and decodes over here and then we process that function further here so you can put any functions on the destination side and easily can execute it to this so you can uh you're talking about a one three minutes of execution uh you where you are doing in a practical where you have to do five calls five transactions if you are not Crossing and you can do simply through this and yes uh these are the three examples which I'm providing over here making you do yield optimizations you can spot the best yield out of all the networks cannot move Crossing loans you can borrow one side you can give it to another side uh think of it this way we we have uh we have a position created on ethereum but I have phones on polygon right so I want to complete my I would just want to like send the funds from polygon and complete my position on the ethereum and that can happen in single call that's what the processing loans are about Crossing nfts have already gone through this uh there is another part of this in the Target contract we can have authenticated Target calls so sometimes we want to make sure that this call where it is coming from we want to make sure that this is the address I want to transfer right so the source called Source address where I'm receiving that I want to make sure that On Target that it is the one and that is required in case of Crossing governance or in case of Crossing balls on even craze of Crossing nfts we want to make sure that the where I'm from where I'm receiving this address uh these fonts or these nfts are I'm getting a call of executing or transferring the funds from this destination to like a c c chain that is coming from this Source address and that time we have to use these uh this authenticate call uh so we here we have a modifier where we are putting only source and we are sending these origin sender and origin that would be a part of the reconcile call which happens underlying the bridge and it will provide you the address where the call came from and that's that's what will authorize that authenticate does and that will take 30 minutes so you have these two cases where you can execute things in one two to three minutes and where you uh where you have use cases where you can do 30 minutes one hour depending on so you have these two really cool ways to actually Implement multiple ideas thank you very much guys uh that's all from me uh we can run through this all the ideas I would love to hear from anyone if you are online you can send us the send us these eggs ideas on the discount which is available on the connects so you go to the connects.network you connect with us on the Discord and we can chat more over there anything else I would love to hear the questions right now
Automatic transcript — names and jargon may be misspelled.