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

Loading player…

Biconomy: Meta Transactions & Cross Chain Transfers

ETHGlobalSat, Oct 9, 2021, 12:00 AM

Join Chirag Titaya of Biconomy for a workshop on meta transactions and cross chain transfers, all part of HackMoney 2021 - ETHGlobal's virtual 3-week hackathon for hackers looking to build decentralized finance applications. HackMoney 2021 runs from June 18th to July 9th, 2021.

Transcript

okay thank you everyone for joining um i know some people are going to trickle in but we may as well get started we have chirag from bikonomy who's going to give a high level workshop on how to integrate bi-economy into your hacc and today we're going to cover some sub-topics such as meta transactions and cross-chain transfers if you have questions for turag please save them for the end and we'll have a question and answer period as soon as he's finished his workshop or presentation okay i'll let you take it away thanks chirag uh hi hello everyone uh thank you heather and andrew for having me here today and very excited and proud to uh you know present uh at this event and let's let's get started so basically i'm going to be talking about bikonomy which is a multi-chain transaction infrastructure so there are so many infrastructure projects to bring you know d5 closer to like drive more adoption on the usability side so i'm going to be covering uh these topics uh to like broadly start with uh you know some of the challenges and how do you you know improve the experience and drive more users for your hack so that's the idea and bikonomy allows you to do a lot of uh cool stuff by uh you know if you are adapt developer you can integrate from like multiple different approaches and make the user journey as easy as possible for any of your hacks so let me go ahead and share my screen quickly all right sweet so by economy is a transaction infrastructure for you know it doesn't matter which chain you are developing on and you want to simplify the user journey and reduce some of the friction points in your dap then it has like sdk and api solutions so i'm going to walk through the workshop of integration so it will be like more on the technical level but let me just come back first and uh you know start with the challenges and how do we like you know end up here or realize the need of having a you know transaction layer in improving usability of the applications so let's get started sweet all right here are some stats on d5 so there are plenty of use cases and very impressive projects that have come out of different hackathons and since the d5 summer the volumes have been increasing uh number of users and taps have been increasing and uh still like if you want to you know uh like get your project to the uh like next level and have more and more users there are still some challenges at the uh at the interaction level or the number of steps involved when users are interacting with your dap so uh so like this says that even if you have like a best ui and the user experience in terms of uh the other interactions which are not web3 uh but the blockchain interactions will turn out to be a very big pain point for the users uh for here are some examples like you need to pay the gas fees uh i need to like download a wallet and i need to understand that okay this is a native currency for this particular blockchain and you could be building on any chain and i need to set the gas price for the chain and i need to worry about you know resubmitting the transactions whether my transition will succeed or fail or i'll have to uh you know i'll miss out a particular chance if let's say if you are trading and there are a couple of other pain points uh which i'm going to talk about in the next slide so you can have like another aspect is like you when you want to like go from one layer to another layer two to you know interact with a particular tap of your choice be it like a gaming use case or a social use case uh for which like layer twos are very popular so then like in order to move your funds these uh there are like very long processes but you have that wait time is very long for you to you know actually be able to uh do something on those tabs so this is an idea where like you think of d5 as a highway and there are various checkpoints where you need to like stop and you know pay for the gas fees and gas fees is just one of the things where like user needs to understand but there are some other pain points in terms of you can think of different use cases but uh you know it's going to be interest for the users so the idea is uh and before i talk about usability so this is the idea like since 2017 uh we have seen the market rise and after the network congestion uh so far block blockchains to like grow in the next uh you know rapid growth growth cycle uh there are key challenges like scalability so there are so many layered solutions optimistic roll-ups or victrum are in the space now so there is a very good progress there and second is interoperability where you need to like move from one chain to another chain and do the cross chain swaps or cross chain uh you know smart contract calls and these can be like a big challenge in like several use cases where uh you know the user is not like blockchain or networking or your application itself and the third important uh aspect is usability so that's uh the pain points which i just talked about and i'm going to talk more about that followed by uh you know high level workshop or integration with economics so uh these are uh the goals in terms of uh when you think about user adoption for your adapt where you basically need to like capture the market of users which are like not crypto savvy and you can also delight the users which are you know used to interact on d5 protocols but you give them more options based on their use cases so that's the idea or like throughout this workshop you should think about some design you know ideology or principles and also think of usability when you are building something uh so these are the pain points and you can uh you know these should be the goals to give the web to like experiences for example amazon or any other web to space application on uh vet3 layer so that's the idea and by economy is a transaction infrastructure for uh you know like multi-chain uh doing the so and it is achieved by meta transactions and there are some other offerings where you can you know integrate and delight the users and so besides that like in terms of pain points uh i forgot to add that let's say since so if we talk about usability in uh so before there used to be like you know long hexadecimal addresses user needs to remember their address and share it with someone so there have been some progress in ethereum domain name service where you can like link your domain uh with your ethereum address and it is way easier to you know give out someone and not remember your whole address uh so that's that's on the addresses level and then on the violet level there are some solutions out there like wallet connect or magic wallet which allows you to you know interact with any dab from your mobile phones uh you can share a qr code or you can have a decentralized identity without having the complexity of having a browser extension and these sort of things so these are like owning your ux on the wallet level and apart from that what we are doing is on the transaction level uh so on the transaction layer there are some pain points and if you can like uh you know simplify those experiences so that's the key idea and let me give you some more examples so let's say if you uh if you are a freelancer and you have not worked with uh d5 blockchains before and you own some usct from a crypto client then you need to you know transfer this usdp and you know you do not have an ethereum and you know don't know about like how to set up set gas prices uh how to download the wallet etc so i need to go and you know make this whole round trip of going to an exchange buying heat and then this poor guy will possibly you know make a unisoft trade to convert this usdt into heath by having those heat and what if the deadline expires then the transaction also gets dumped by wasting the gas fees so here are like multiple challenges can be thought about uh with bikonomy integration in your dap it says few lines of code and some amount of that like registering your artifacts on the dashboard so i'm going to cover those steps like what you need to do in order to have a cashless experience for your users so that's a first key aspect of offering a guest list or sponsored transactions by your dap to the user so and it is very cheap on the layer tools and you can like you know sponsor plenty of transactions and drive more user base for your use case and the features are like there are gas optimized transactions there won't be like any pending transactions uh you get to uh you know uh you get to own or know more insight about the transactions that are going through your dap you can have the user limits you can have the meta transaction limits and uh sort of control your data which is uh of the user interacting on the application so this is just uh you know another like infographic to showcase like what are the benefits of using uh or having like few lines of code for like any layer and there are many supported networks so it's multi-chain and network agnostic so even if user is on the ethereum main network they on metamask for any wallet they can directly integrate with or interact with a dap on the polygon mainnet polygon mumbai etc and this that is the idea like user just sign saw uh you know kind of messages and these messages are being like exchanged with each other uh and there will be like a third party layer which will actually pay on behalf of the user or it can like drive many jobs which let's say you want to set a particular constant or update something in your smart contract or you can have like you know any defy job to provide liquidity or you want to like run a bot and uh you know manage your transactions through a dedicated relay so the trailer infrastructure is pretty scalable and this is the idea of uh you know on a technical level like you need there is there will be a transaction signer which is the end user and then they will just see the uh you know structured message in the browser or in the wallet app which they can sign to like sort of prove their identity and that's it so after that they do not need to worry about the transaction so transition is going to be relayed by a relayer and there are so many things which are happening uh behind the scene like for example you need to be managing announces you need to have like a resubmit module to submit the failed transactions you need to monitor the gas prices and you need to bump up the gas prices so all of this is being handled by economy in the back end uh so once the user sends a transaction it comes to a generic trusted forwarder so this is more standardized approach you can have like different custom approach as well where basically user just like says that okay this is my smart contract this is the method i want my users to call and be you know meta transaction compliant or enabled and that's it so it appends the user's address and it retrieves that address in the smart contract in your recipient contract and it just verifies that whether it is from the right user so that's the signature verification and another is the nonce verification for replay protection attacks so uh that's the first step like you need to modify your recipient contract to have this message center feature so that it can you know realize whether it is a it is coming from the relayer or an end user uh so this is the idea and in terms of like integration with bikonomy so there are three crucial steps where uh first step which i have as i mentioned that you need to make the changes in your smart contract and second thing is you need to register the artifacts on the dashboard so by artifacts i mean you need to add your smart contract and you need to specify that okay which method or which type of meta transactions you want for this particular contract or its methods and then you sort of like register all of those methods in the dashboard and that's it then you are done you get the api key which you can use in your backend code integration so i'm going to show that part of the code through uh maybe like a pull request or the code example and so that's the third step where you basically use the bi economy sdk and you can also have an api integration where you can just directly make an api for your transaction call so user just uh you know signs a message from your front end or they can also it can also be done using the private key in the backend so these are the steps uh which i'm going to show uh you know moving forward so in terms of changing the uh just like yeah so here uh so this is the example of the changes you need to make on the smart contract which is the first step where this is a very simple contract where it maintains the storage variable code and uh user can uh any user can come in and like set this particular storage variable and become the owner for the particular code so this is the contract before and uh these are the additions with uh if you want to like make the contract meta transaction compliance so you need to uh inherit from like a certain contract it can be based really recipient or eap712 meta transaction uh so yeah which allows uh uh you know to like sort of like verify the nonsense and verify the signature so that's uh that's what like and it allows the support for the trusted forwarder and the forwarder's job is just to verify the signature the the nonsense so you need to be uh just make these small changes in your contract and wherever you are using message or sender you need to replace it with like underscore message center and that's it you are done for the first step and this is just one time the second step would be to like i said to the dashboard registrations so if you go to the website you can go to the dashboard from here and you can like create okay so you can create any new dap with your name and you can pick a network that you want to you know that your dap is on and or whichever project you're building you can give it a name and these are the steps to integrate a smart contract so you give the contact a name you paste the api so all of this uh you know i have done from the back end code here so i am going to paste the api i can place the smart contract address and uh with that like i can specify the approach so there are different approaches trusted forwarder is more generic approach for like access transactions and elc 20 forwarder is something that allows end user to pay gas fees and stable coins so shortly i'll come back to that also so once you register your contract then you can go ahead and register your methods so let me just show for the existing tab so these are the steps involved in like in terms of registering methods and your artifacts so that's the second step and that we have covered and the third step is to sort of like write or like modify your code to use the bi economy api key so the idea is like what's happening in the sdk is when you send a rpc call to uh sort of uh you know to send out any transactions so sdk is going to like you you can replace that provider what whichever provider you are creating for the network with the economy provider by using the bi economies api key and once you have that provider you can create your contracts using the new provider and when you send a pc call each sign transaction it's going to intercept that rpc call and it checks the you know artifacts or registrations on the dashboard and accordingly it sends that api call to the server and then everything is managed by the relayer infrastructure there in uh where we talk about like these submitting transactions or the nonce management or and ultimately getting the hash risk transaction has response back so you can show your end user then you can enable any watcher you can pretty much do like other composable stuff in the d5 uh so getting the subscription for block native or reading the data from graph for the particular transaction uh so that's that's the idea so ultimately you get like the receipt in the transaction hash and so this is the code which uh shows the integration part so you need to have like uh your contract object you create by economy by using the api key which you get in the dashboard so that's like few lines of code and then you replace your web3 with the bikeonomy object you just created and once the bi economy is ready you can initialize your contracts uh whichever you know operations you are doing in your apps in the backend so this is uh this is all you need to do in the client side and let's say if i am sending a transaction uh using like yeah so if i'm sending a transaction like you know populating populating for a data for a particular method and then i'm sending a transaction so this code also remains the same you don't need to change anything it will just uh you know ask user for the signature so everything happens at the back end and at the end user will not uh you know end up paying for the gas fee so this this is the gasless use case where you can sponsor the gas fees on behalf of your users so this is just the third step and you can play around with this uh demo so it is hosted and there are several variations there in the uh playground branch which i am going to share as part of resources and if any questions you can come back to us on discord so this was the uh this is to you know basically showcase how to integrate by economy and a very uh simplistic use case for uh uh for this step and besides that uh what you also can do is so for on some layer ones it does it probably doesn't make sense to you know sponsor the gas fees on behalf of your end user or what you can do is like enable a switch where gas prices are very low or you can have like a happy hour's thing where uh for that time you are sponsoring gas fees for your users and for other times you can allow users to you know uh pay gas fees from that site so in this case gasless is not free right so you need to like pay something but if you do not have ethereum then you are also allowed to pay these gas fees in esc-20 stable points so whatever supported docker tokens you have as uh you know as allowed fee tokens for erc20 forwarder contracts so that's the idea like you still have the trusted forwarder which still verifies the signature and verifies the nonsense but you what you also have is an erc20 forwarder which you know facilitates as a fee calculator so for example i am calling a certain method on my smart contract and there is x amount of execution gas for this method call so what what this contract does is it calculates that okay this money and this much let's say 200 k amount of gas is going to be spent for this transaction so basically it calculates all of these eighth amount uh into efc20 token amount and identifies how many tokens are to be charged and then it charges these tokens from the user's wallet so that's the idea and it has like a different protocol level contracts so there's a fee manager which allows to uh allows adapt to charge uh you know a bit more as a fees for providing this service or give the users rebate also uh the users who are like you know most active on that apps and then there is oracle aggregator which basically sources the live feeds data from the uh changing price feeds so these feeds look like uh usdt to die a uct to eat die to eat usdc to eat and that's how like you get the price and so there is a concept of gas price and there is also token gas price so with the token gas price you can identify that okay this many tokens i need to charge here is a sample transaction where uh the end user was able to swap die for a certain token on unisof by uh not paying any heat but just paying some extra die as a gas fee so this is the idea so this transaction uh relayer has paid the each fees and the user address is this one the user has paid only like die and they have made the transfer to the fee receiver for their dry stable cones and this is how like you know this is just one of the use cases facilitated besides that what you can do is you can also have erc20 token transfers you can batch the token transfers and build you know certain ui where user can send out a batch and a batch of let's say 10 addresses and 10 destinations 10 different amounts to send your city and pay the entire fee gas fee for this batch in usd by like spending some extra token so that makes sense in some of the use cases where you are like depositing some liquidity into a liquidity pool interacting with any method which already involves you know some erc20 token interactions and by paying the fees also in these tokens which makes uh very delightful for the user and on the ui level you can still give the option to the user okay these are going to be fees in each these these are the fees and stable coins and uh you know you choose like which coin you want to pay with so that makes a good use case in some scenarios where there are already some token transfers involved and third thing is on the crossfind transfer so currently the problem is uh like i mentioned in the beginning as well so between uh moving your liquidity of certain tokens from layer one to layer two you want to go to another dap and uh uh you know you want to let's say mint and nifty so these uh probably artists do not know how to like uh you know like like they need to worry about the gas fees they need to worry about like moving the tokens it takes a lot of time uh and to not and also to move back to ethereum to sort of like you know sell back some of your assets uh uh it takes it is a very long process to like it can go up to like uh you know hour to a week so hyphen allows you to do like instant uh transfers between the across the blockchains and it is cheaper and instant so and how it is facilitated is like there are liquidity pools maintained on the both chains and it just like rebalances liquidity and once you like you know decide to like move tokens from chain b to chain a ah there are uh you know at the back end there are some executed nodes which are going to like listen to your withdrawal transaction and they facilitate the liquidity for you on the other like so that's the idea and uh you just need to pay like liquidity provider fees or the network fees which can also have like a guest list or like a forward experience where you can pay using those tokens as well so that's the idea here is a simple ui which is uh hosted as one of the resources uh i'm going to be sharing this on you know the channel as well so you can like play with it like between godly and mumbai and uh just soon live on the main net as well so yeah i'm pretty much done and these are like some of the case studies of uh you know improving the user onboarding on different tabs and nailing some use cases of trading social use cases uh d5 use cases etc in terms of resources you can go through the economy talks dashboard there are some other resources which we can share on like telegram or discord for you know like i encourage builders to like go through this so i'm done i am ready for the questions i think they're out of time maybe two three minutes thanks truck yeah so we have about 10 minutes left um just first off would it be possible for you to share those links in this sponsor in the buy economy sponsor channel just so people can access them yeah yeah i'll be doing that perfect so there aren't any questions in the chat i thought i would open up the floor if there's anyone in the call who wants to jump in unmute yourself turn on your video if you're comfortable um and ask the question yourself i've got one question that just came in from gawain which he asked does biconomy interact directly with venly wallet yeah yeah so uh these wallets basically you just need like uh to modify your website provider or ethers provider which is like implemented in a specific wallet so yeah it can be done with pretty much any wallet any other questions okay we will give people one more minute if they want to jump in jarag what's the best way for people to ask questions um we know we're on our discord so there's the dedicated bi-economy channel and where else can they find you uh so they can come on by economy discord channel as well or on the telegram group of economy so the team is always you know active there and it is distributed so anyone would like come and ask you guys great so unless there's any last questions um thank you very much gerard that was a great workshop really appreciate it i'm excited to see what hackers build using viconomy and if you have any more questions for drug or the dichotomy team jump in on discord or telegram perfect thank you so much emily thanks triad cheers cheers bye

Automatic transcript — names and jargon may be misspelled.