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

Loading player…

Safe 🛠 Build a Group Wallet to Buy things with Frens using Safe {Core} Account Abstraction SDK

ETHGlobalMon, Oct 9, 2023, 12:00 AM

Join Tomiwa Ademidun from Safe for a workshop titled "Build a Group Wallet to Buy things with Frens using Safe {Core} Account Abstraction SDK". Thank you to everyone who joined our first in-person appearance in 2023! We are incredibly grateful for the support and contributions of all the hackers, tech mentors, judges, partners, and volunteers who made the ETHGlobal Tokyo event such a huge success. Without your dedication and expertise, this event would not have been possible. We would also like to extend a special thank you to the attendees who traveled from over 59 countries to participate in the event. Your presence and involvement made it a truly international weekend, and we are thrilled to have had such a diverse group of participants. With over 1070 hackers it was a pleasure walking into Toranomon Hills and seeing such a talented pool of individuals. With over 22 workshops, 9 talks, and over $375,000 USD in prizes we hope you enjoyed the weekend full of hacking, meeting all our incredible partners and learning from enthusiasts of the space. We are proud to have welcomed over 35% of attendees who were new to Web3. We hope this event sparked your interest in the world of blockchain and provided you with valuable insights and knowledge. We cannot express enough gratitude to everyone who contributed to the success of ETHGlobal Tokyo. We are already looking forward to the next event and hope to see you all there! 🎉🚀 ----------------- Follow us: https://twitter.com/ETHGlobal​ Check us out: https://ethglobal.co​m Email us at: hello@ethglobal.com

Transcript

foreign [Music] GM Tokyo everyone my name is tomiwa and I work at safe and I'm going to talk today about make how to make a group wallet for buying things with friends using smart contract accounts and safe core account extraction SDK so a while back me and a couple of my friends we ran on a ski trip together and the trip itself was fun we went skiing we had some great food we had to stayed in a nice Airbnb but there's one part of the trip that I really didn't like and I found super annoying and where you know what it is whenever you want to go on a trip with a bunch of friends what is the most annoying part of the trip splitting bills exactly so this is some screenshot that I message text group chat that we had of trying to organize the payments on the bills hey pay me this for the food don't forget to pay me back for the tickets Airbnb why would you pay you back and I was part of the problem too about a week after the trip a friend messaged me saying hey you still haven't paid me back and so let's figure out why he's splitting the bills so hard so let's say for example me what's your name backless Brazil Juan John what's your name saki me John and Saki want to go on a ski trip to Mount Fuji together in beautiful Tokyo what do we have to do tickets what else do we have to figure out Logistics food where we're gonna stay right so just the three of us we're only going on a trip together we have a lot of payments we need to figure out so maybe I say I'm gonna pay for food John you're gonna pay for housing maybe what's your name again masaki you're gonna pay for the tickets right so I pay so you pay me back for this and I pay you back for this and this is just a huge mess and this is why we have these kind of text iMessage group chats where we're just trying to figure stuff out now what if we could just basically create a group wallet right where you know I forget all this stuff we just create a shared bank account where we all send our money into and then one of us can say hey I'm gonna pay for the I'm going to take money out of our shared account and pay for the food or you can pay for the housing you pay for the tickets and then we're just basically create something like a group wallet and another name for group wallet is called a multi-sig exactly and this is a very simple concept but you can actually think about it has very powerful implications so one example of this is you could do the same thing necessarily maybe something to pay for a trip to Fuji you buy the US Constitution sounds crazy right but then a group of people used exactly the same concept um to Constitution Dao they raised 42 million dollars in seven days that's six million dollars a day let's take it a step even further what if you created a group wallet for Investments and what if this group wallet had 10 trillion dollars assets under management what am I talking about BlackRock a lot of people don't think about it but BlackRock is a 10 trillion dollar investment company that actually has that could basically function exactly like a group wallet here's another fun example for you guys what if this group wallet at 800 800 billion dollars 125 million people contributed to it and it has 700 signers anybody know what kind of what I'm talking about Finn do you know Japan is basically a group wallet it's a multi-sig right you have the parliament it's about 700 designers population 120 million people you take money out of the account to pay for pensions student loans military or self-defense Force things like this so with this very powerful concept you can basically create things all the way from paying for an Airbnb trip you're basically running an entire country so how does it work at a fundamental level let's make a simpler again back to the group wallet example so the first thing we need to do is create a group wallet and propose a transaction and transaction can literally be anything which is I want to pay for food I want to pay for military it's anything you want to do you can propose a transaction someone confirms it so for example I say hey John I want to pay for the tickets for the to Mount Fuji then you say yes I approve this transaction it gets executed and the money gets sent out so we're going to talk about how to do that using the safe core account abstraction SDK so so we're going to be stored first of all start off with the protocol kit which and the beauty of the protocol kit is that who here has does not understand solidity very well okay okay so the beauty of the per pocket it allows you to basically deploy smart contracts and even interact with smart contracts without having to write any solidity code as long as you understand typescript you can basically write not write smart contracts but interact with smart contracts auth kit on ramp kit off kit for authentication we'll get to these later but focus on the protocol kit for now and then yeah so these are all the docs I'll I'll have some slides up later on you can link to the QR code so the first thing is sometimes you know one of the whole thing the whole a lot of people back is hey I'm looking for a design I'm looking for a front-end developer you can just clone this repo that we have which is a super super simple UI kit that you can basically just use to like add in additional features so that basically takes care of the UI for you so you can focus on the functionality so the first you want to do is install some skits so the protocol kit API kit for basically interacting with our API service and then the SDK types if you're using typescript which I recommend also super important if you're going to use ethers 5.7.2 6.0 came out which is still not compatible with a lot of stuff I see you're not in your head yeah so this is one of those things that if you don't know it's a very hard bug to fix so make sure you use a 5.7.

2 then you want to basically start using um the regular packages so this is actually outdated we're not using safe service client anymore this is seen like literally a couple days ago so it's API kit not safe service client that's gonna be protocol kit not core SDK the next thing you want to know is I'm configure the blockchain network so one super cool thing about safe is that if you want to basically support polygon and gnosis chain and by the way a little bit of alpha you probably should because then you can basically get two Bounty prizes all you have to do to get it qualify for additional Bounty prize is one thing RPC URL all the rest of your code can be the same you can support multiple chains with just that simple thing recently um this slide says 12 plus networks are actually on more chains as well but from from UI perspective these are the chains we support but if you go to the safe deployments repo and you can find that linked as well we support I think almost 100 chains so if you guys are trying to like you know get a lot of money we're in a lot of bounty prizes you can easily Stack Up by deploying on Save because we support so many different chains cello as well we support cello as well all the all the different chains that if you have compatible we support most of them so then you import your packages this part is pretty self-explanatory the next thing I'm going to do now is basically um get the adapter so the beauty of safe is that you don't like do a lot of connections yourself all you have if you already have metamask installed this one line of code will basically take care of everything and it'll figure out the chain the network you're on things like this all right so then first thing we want to do is basically create the wallet so like I mentioned earlier on you want to get access to basically whoever's currently logged in your metamask you basically can get the eth adapter from that and then you want to basically then just deploy the save and so as you can see here once you've gotten the eth adapter the plug is safe is just literally to one line of code see Factory dot deploy safe and then you have your safe deployed and then another like little Pro tip I'll give you guys for when you're debugging your code is put lots of console.log statements so for example like one thing I was trying to do is I have the block Explorer the transaction service and then the safe app so this way like if you're trying to figure out like making sure it's actually deployed you have like basically three different sources of Truth you can check to make sure that it was actually deployed so if you're in the deployed safe yeah so then you can check it on on the safe app or then ether scan all right so then back to the example so now we've created our wallet um but now we need to talk we propose a transaction but the problem with this is that a lot of this interaction currently right now still requires you to like be very familiar with blockchain web3 Technologies but what if you wanted to create something super simple like so simple your mom could use it what if you wanted to create okay proportion okay I got a gallery ahead so proposing transaction as well so like I mentioned earlier on you have to propose hey I want to send money out of this you have to confirm that yes I want to confirm this transaction and then you want to have someone execute the transaction on the blockchain and then so the pro and the beauty of this is that none of this stuff actually happens on chain until you actually execute the blockchain so you don't need any gas fees anybody can just basically create a transaction sign it I'm basically using the following steps get the transaction hash you can sign it afterwards and then you confirm the transaction so basically to verify that and this is also like a to factor this is like a kind of a way of having two-factor authentication right because even if my private Keys get hacked the money could still save because then your properties are safe your private keys are safe so you can swap owners things like this so it's basically convenience and security so you can confirm the transaction using the safe API kit to get all the pending transactions and then you can basically execute the transaction on the blockchain and like I said again when you're writing your code I really recommend you use lots of console.lock statements it'll make it a lot easier to debug things and yeah so then you can also get the list of printing transactions to see what you want to confirm or um deny and then again you can always basically verify things on safe on our transaction service or on etherscan as well so now let's go back to the analogy I mentioned earlier on right so with this simple technology like I said you can do things like buy the US Constitution literally by the Constitution and run a country but then what it's still but again this still requires you to understand private keys to understand you know all these kinds of like Hive grass eat all this kind of stuff but what the goal should aim for is that we want to basically create an app and the challenge I have for all of you hackers here today is can you make an app they could just basically take a phone give it to your mom and be like Mom use it is that possible right now not really but now we'll see if it can object SDK it's possible and I'll tell you how so like I mentioned earlier maybe again we want to go to Mount Fuji maybe instead of majuki we were with majuki's Mom so me mijuki mijuki small you your mom and your dad want to go right so hey Mom we're gonna do a group wallet okay okay but then this uh okay um so you ask your mom create mom whatever okay so do you have a metamask you have sea face what's that do you have a Google account perfect you can use the auth kit okay next we need to send some money do you have a gas do you have a match do you have East you have BM no what's that okay do you have a credit card perfect use the unwrap kit okay now it's time to pay for the executed transaction you know what Gatsby's are right what are gas fees okay don't worry about that we used a lot of relay kit so every single thing that your moment or or you would have to learn to use a web 3 app has been abstracted away if you can use a bank account if you can use a WhatsApp account if you can use a Facebook account you can use a web free blockchain so it's like web to ux with web3 tech so let's dive into a bit more detail on how that works so now we're going to talk about the auth kit for authenticating ourselves on ramkit and there we talk about the relay kit and I think the beauty of this too that a lot of time people think safe is just for multi-six you can even use a save for like a one of one and so for example like you could have a safe and the B so why would you do a 101 with a safe if you're if you're private key get compromised you can just swap private keys without moving all of your assets out so let's start with the auth kit right so again maybe your mom doesn't have he doesn't even know what a seed phrase is he doesn't know what a metamask is but she has a Google account or she has an email address login with auth kit and again it's very few lines of code you can basically customize the modal use the open login adapter and they can just basically initialize and then once you're initialized with web3 auth you can basically just sign transactions using using the provider and the current signer okay now which next part is basically on ramping so again a huge problem with you know crypto is how to get people on on ramped well most of us already have credit cards so with stripe and using the um the on-ramp kit you can basically just use strap to basically have easy unwrapping it does it's only available in US but um yeah so yeah so then you can basically use the unwrapping and again and this one's even easier because a lot of the work has been taken care of by like the stripe iframe model so it's all literally just two lines of code really knit and open and boom just like that you can only ramp people with a credit card and then finally the gases transactions be so again another huge problem people have is gas fees right so you know how like even even if okay now I've unramped with the credit card and about usdc now I need to have manage I need to have polygon I need to have eth well now with a sponsor transaction you don't have to do this so you can basically just say that anybody who wants to interact with my blockchain I put maybe through usdc or five usdc and I say all the transaction fees have been covered so you don't have to worry about this and then so this is kind of an idea of what it would look like so basically here you can basically see the steps involved so basically just defining the TR and the beauty of this too is that when you look at the code actually everything that you would do to create a regular transaction is gonna be the same for relaying the only difference is the operation.call um I forget where that line of code yeah right here operationtype.call everything else is going to be the exact same as you're passing for a regular transaction and you probably won't increase the gas limit as well because it's gonna be a little bit more complex but besides that like if you can execute a regular transaction you can do a sponsored transaction as well and this is kind of just like a little bit more detail on like what kind of like what what um what data you're encoding in the execution transaction call and this is an example of what it looks like and again so the really cool part about this here is you see account 3 executed this transaction but they literally had zero marriage in their bank account we can still see here the contract was the gelato Network relayer basically moves them East from arm our um multi-sig to our destination address yes and so with all of that I'll get taken care of on-rem getting care of we like it taken care of we now have a mom wallet get a trending hashtag mom wallet and then so that kind of concludes the bulk of the talk and then so now we can have lots of time for like questions answers things like this a couple things I want to give you guys um so these are some developer docs if you guys want to scan that real quick hmm all right we want some Alpha no one all right oh you want Alpha okay I'll go you have some Alpha um so yeah so first thing is lots of bounties and I think the super cool thing about building on safe and why I think all of you should build on safe is that in terms of bounty stacking and like sponsor stacking Sarah's probably one of the best tools for that right like if you build on safe you can build on almost anything else so for example with gnosis chain um you're actually giving two thousand dollars for building on safe so if you build on safe and you build on those is automatically getting 2 000 additional bounties polygon as well we support polygon mainnet and we partially supported on polygon I mean we support polygon one by as well too so that's okay another bounce you can get ethereum Foundation you can get that as well and also where to put us on cello as well too so you can also get cello bounties so if you're trying to like you know get some bounties build on safe um so yeah another cool thing about safe is that we have um sponsored transactions on those exchange as well too and actually if you download the save space all the like RPC URL transaction Services already there for you so if you build something on Save and you actually want to get users and stuff you can actually get their gaskets covered and yes another super cool thing is super fluid so we're also doing a wave pool with super fluid so again like talking about like just stacking more and more and more and more bounties we're doing a wave pool with superfood so you can like build something here with super fluid and then and save use it at e-tokyo and then after you Tokyo submit it again for the wave pool also we're hiring so if anybody's looking for jobs you know apply for jobs at safe great place to work and that concludes my presentation arigato kasima questions yes John yeah so there's a couple ways we help with account abstraction so I so like the way the way we Define account abstraction is that basically abstracting the differences between the web between the web 3 ecosystem so we help because again like you don't have to worry about gas fees and actually with the relay kit you can use your lotto or you can basically like try to implement 4337 and I think with 1.

4.0 I think Richard probably can confirm this we can also support 437 out the box too now and it's to put on girly test net foreign yep so there's two ways um you pay yourself so like in the previous example I had a balance up there so like for example I could say I'm gonna like cover like three dollars worth of gas fees for anybody that interacts with my with my smart contract or it could be sponsored by like the chain right so like again a lot of these blockchains like the same reason people are doing bounties they're trying to incentivize people to use their chain so like just like read it with no such chain nose has changed basically covering the cost of all transactions on the noses chain Network so I don't mean so for example for me I would put like yeah in your way so I would like deposit like few dollars into the Safe digital Auto like bank account like I credit basically and then and you prepaid exactly exit rights yes so ask the question again um and so like so like giving extra price to Adele in this account abstraction yeah um if I understand your question correctly you as an individual can have an account abstraction and your doctor's like an account objected wallet and the Dow could also have an account infected wallet so a dollar like two separate Concepts the Dow uses a wallet and the wallet can be account abstracted so the Zodiac so zodiac has like modules that you can add on to this so you can Google like gnosis go zodiac will show up and you can basically add zodiac modules onto your safe to add rage score functionality foreign there is like it's still like an experimental stage so there are some modules that like it's not really ready for production you basically like try them out and I think if you use like 1.4.0 which is on girly now you can support 4337. you have to add your mod add the modules yeah foreign I think you'd either have to whitelist it or I could maybe show you an exit code example afterwards and I can show what I'm talking about any other questions okay I guess that's the presentation thank you very much

Automatic transcript — names and jargon may be misspelled.