Safe 🛠Enabling Smart Account Portability With SafeAuth
ETHGlobal·Wed, Oct 9, 2024, 12:00 AM
Join us for a workshop titled, "Enabling Smart Account Portability With SafeAuth". Embark on a journey with ETHIndia, where innovation thrives, collaboration knows no bounds, and hierarchies fade into self-sovereign ownership. The most skilled web3 developers, designers and product builders from all around the globe came together for a weekend-long adventure to advance the Ethereum ecosystem at ETHIndia in December of 2023! ----------------- Follow us: https://x.com/ethglobal Check us out: https://ethglobal.co​m Email us at: hello@ethglobal.com
Transcript
[Music] I have something I have a Google account do you have a Google account yes and you do you have a Google account yeah and you on the back do you have a Google account and you do you have a Google account yes well then let me tell you something if you have Google you have save you maybe just didn't know but we will see that today so we are going to talk about enabling a smart account portability with safe o this is the logo of safe o our new product and we have created a formula that is very cool and I hope it's easy to understand that you'll see why this design so safe o it's equal safe you see that some similarities plus web three o well in reality it's not just a sum but a multiplication because the sum uh the the final product is much better than the sum of both of them but first of all I have some questions for you first of all do you know what safe is can you raise your hand if you know about safe okay well safe is uh a smart account protocol we are trying to build a universal Smart account standard uh safe is used by a lot of dows and companies to manage their treasuries also by individuals and it's on individuals what we want to focus nowadays uh especially with this solution Sao also the second question do you know what web 3o is can you raise your hand if you know how about them okay we 3o is uh is leading uh the wallet as a service provider they have an NPC multi-party computation solution that allow uh users with a social login like email or Google account or Facebook or whatever to generate an EA creating a seamless experience and the final question is do you know what safe o is can you raise your hand okay very cool we are going to talk about this today so let's start with some context from safe as this is a collaboration between safe and webo I'm from safe I'm Herman I think I didn't introduce myself uh so some context about this uh we have the safe core account abstraction SDK that has for libraries or kits the O kit the protocol kit the on- ram kit and the relay kit both uh all of them together will create a uh a more familiar experience for users that are coming from uh web to world so with the O kit uh first of all we uh for each of these kits we decided to go with a third uh party provider that uh supports the functionality for each of them so uh the O kit allows to login so users via their social login can create an externally owned account protocol kit offers or expose the sa functionality if you want to deploy a save if you want to execute a safe transaction all that kind of uh tasks the unram kit allows to fund uh a a save an account with Fiat and uh transform that into crypto and the relay kit will allow to execute transactions without the signers of the safe uh to to have they don't need to have gas to execute these transactions a relay can execute that for them so now let's imagine a um a situation where a user that has no wallet and no crypto goes into an application that is let's say an nft marketplace with a shopping cart where they can add uh nfts to the shopping cart and buy them but they don't have nothing how all these skits would help them if you integrate this in your app the O kit uh will allow them to type their email for example generate an EA uh also we can predict we can calculate a safe address based on this EA because it will be deployed later in a deterministic way then the protocol kit behind the scenes will create a bat transaction after the user selects all the nfts they want to to purchase this bad transaction will contain first a transaction that will deploy the save and second all the transactions if there are multiple to buy the nfts from the safe then the on- ram kit will allow uh users to fund their non-existent uh safe uh until that moment and fund this address so they will be able to purchase the uh assets later and finally the relay kit will allow to execute the spatch transaction deploying the save and executing all the uh next transactions to buy the nfts and regarding the fees they could be sponsored by the relay itself or they could be extracted from the safe this is what we had initially uh the the third party providers we are using for them are web3 o for loging stripe and monium for onramp and gelato relay in the future we may have uh more kits like recovery multichain kit and uh well whatever comes you can find this in the uh repo safe core SDK in the safe Global organization on GitHub these are the N the npm packages but now we want to focus on the o kit which is the one that contains the safe o pack the one we are showing today so what is safe o safe o is the first issue to use portable smart account solution safe O is a new NPC uh product that is developed between safe and weo that will allow safes to be portable between different applications using social loging so what are the key ke features and benefits the first of all is uh the deterministic address generation using this uh the same social login so until now uh if you use we 3o directly you'll see that if you connect to different accounts a different EA will be generated for each of them so in the end you will end up with assets distributed in different accounts and that it's a bit difficult to track and then if accounts deploy saves it will be uh well a little bit difficult to track so safe o allows to generate EAS deterministically that uh as a result will uh means that where uh wherever application you are logged in you'll see always the same save on top of that our official uh front end the safe wallet is compatible with safe o so you can log in with your email with your Gmail that's why if you got Google you got safe and you will be able to track all your uh history of activity that you did on different applications also Sao uh supports multiactor authentication and it's flexible because allows developers to choose which methods they want to use like SMS OTP or an authentication app or whatever and also safe off is built on safe meaning that is future proof and modular as uh you don't need to deploy a new safe if a new functionality comes uh to the market you can just enable that new module or uh whatever so let's see some code on how to use uh Sao there are some steps first of all you will need to install the safe o kit that is inside the O kit um then you have to create the safe of pack instance you can sign in or sign out as a user you can get the provider that the MPC solution returns you can create a safe account you can sign and execute safe transactions and you can sign messages from the EA so to begin with uh installing the F kit you can just uh type in the console uh npm or jarn install and the name of the package then to uh create an instance of the safe F pack if you go to the last two lines you'll see that we are initializing or creating an instance of the Sao pack and then we are initializing it by calling the init method and passing some configuration some options which are this object here uh if you see for example the chain config you'll see inside some uh information about the network you are connected to uh the name of the of the Native token the RPC URL the blockchain the block Explorer Etc then as a user if you want to sign in with your email and get this popup open so you can uh select your Google account uh that could be open by calling uh the safe of pack instance do signin that method and this will return an object with two properties EA which is the one returned by the NPC provider the signer and then a list of saves in case this signer already is an owner of uh any kind of save then the developers would be able to decide which save they want to uh select as a user if you want to sign out just safe of Pac do sign out you can get the provider from the MPC uh safe of pac. getet provider and here one of the most important uh things you can create a save account if we go uh from the bottom to the top I think that will be easier to follow at the very end we see a console log the save has been created by calling save get address but how do we get that safe in the previous line we see that we are calling the save Factory do deploy safe with some configuration that configuration is uh the threshold which is one in this case and the list of owners the signers here we want to use the EA we got from the MPC so uh we are calling sa for sign in response. eoa that will be the address how do we we get the save Factory to deploy the save in the preview line we see that we are calling save Factory do create passing an e adapter this adapter is just a wrapper of the libraries uh ether JS or web3js depending on what you are using on your application uh this SE adapter we can get it by uh calling the ethers adapter uh class passing in this case an instance of ethers and as signer this signer if we go to the previous line we see uh that we are getting from provider. get signer and this provider in the first line we are getting it from uh the safe of the safe of pack. getet Provider so that's how we uh deploy a save where the signer is the eoi from the MPC from West 3oth after that we can execute transactions uh and sign then previously so with this uh signer and the E adapter and also the safe address that we get from the array of saves and here is where the developer can choose the one to uh display or to use and at the very end we uh initialize an instance of the protocol kit if you remember the one that is exposing the safe functionality so for that we need to pass the E adapter and the safe address now we need to create the transaction object uh so we can build an object with the the properties to value and data here it's just a random transaction from the Save to the designer but whatever you need to execute then we call the protocol kit do create transaction and we pass this uh this transaction object then we need to sign the transaction so we can call the protocol kit do sign transaction and we pass the save transaction and this will return the TX uh object that we need to pass to uh the execute transaction method if you want to sign messages with web3 or ethers not from the safe but from the uh signer you got from the MPC you can uh initialize your web three instance or uh ethers we will see later with the provider from the MPC and then call the methods to sign a mage or sign a transaction or send a transaction so uh very similar with ethers now uh if we have uh some time for a quick demo uh you'll see that in the safe cor SDK uh package on GitHub in the folder packages in the folder oit in the folder example you'll see some code you can execute locally and it looks something like this where you can have a login uh button that will show this popup where you can sign in with your uh with your email with your Google account let's see how the internet connection goes here it will ask for my email this is also compatible with the with a save wallet so later you can see here what is uh your activity okay uh I click the wrong button well see my fault you'll see that this uh is very dependent on the connection the speed why there that D and now in the website in the application we will see on the left a list of RPC methods that the MPC is providing that you can execute on the right side there will be a console where the response for these RPC calls will be uh shown you'll be here you'll see here on the left side on the top the signer account that is generated from the provider and uh in the middle you'll see if there is any save that belongs to this signer this is taking too long because of the connection now it's going it will load in a bit okay so here you see that from my email account on top on the top right is saying hello Herman because it's information I have uh on Google then here is showing my um eoa designer I don't have any save deployed here but you can uh call from the do some RPC calls to get the user info or the accounts that are uh that I have or the chain ID whatever if we connect to a different network like girley you'll see that with the same EA I do have a a deployed save that belongs to this um to this signer so it should load well I guess you can uh try it by yourself I will continue with the slides and then if we have more time but so for the hackathon about this we have uh uh the safe ecosystem Foundation has uh 10K up for graphs and we have three um different tracks the first one is related with this SDK the safe core account abstraction SDK we have two P two prices of 2K each uh at least you would need to integrate two of these kits with a special and uh mention and we encourage you to use the safe o pack the second track is related with the safe core protocol two prices of 2K each integrating or implementing any part of the safe core protocol with plug-in hooks the manager the registry and the last one is a collaboration with Pim Lio we have a safe 4337 module that you can plug in into your safe and execute with uh using the pimo infrastructure they only have they also have an SDK called permissionless DJs there's information in our docs and on their side as well we have a hackathon success guide with some Learning Materials past uh workshops and hackathon ideas if you want to check it uh feel free to scan this QR code okay and then these are our dogs dogs.
safe. Global Discord Forum Twitter at safe so thank you very much and just one quick check here yes now it loaded uh we see that on gly this eoa has a safe account and now if I can try to uh on gly to connect on the official [Music] um with the same email you'll be able to uh well I guess internet is not working uh properly but you will uh be able to access to your same safe so thank you very much for attending
Automatic transcript — names and jargon may be misspelled.