Safe 🛠️ Building with the Safe{Core} SDK - Manuel Gellfart
ETHGlobal·Mon, Oct 9, 2023, 12:00 AM
Join Manuel Gellfart from Safe for a workshop titled "Building with the Safe{Core} SDK". This talk covers the difference between Safe{Wallet} and Safe{Core}. It explores the Safe{Core} SDK, which includes the Auth Kit, Protocol Kit, Onramp Kit, and Relay Kit. An Account Abstraction Demo is showcased, and exciting hackathon bounties are announced. Thank you to everyone who joined us for ETHGlobal Paris 2023! Paris is the city of light and birthplace of many revolutions. Therefore we were thrilled to be back in one of the most buzzing and free-spirited cities in Europe for ETHGlobal Paris 2023. A lot has changed in the European ecosystem since the last time we hosted a hackathon in 2019. ----------------- Follow us: https://twitter.com/ETHGlobal​ Check us out: https://ethglobal.co​m Email us at: hello@ethglobal.com
Transcript
foreign [Music] talk if you've been here earlier to at 3 30 at the talk it will be the exact same talk that was just the issue with the recording so um so yeah we're re-running the talk um I'm yeah I'm manuf I'm safe I'm working at safe wallet so working as a front-end developer for the wallet interface um and this talk will be mainly about building with safe course Decay but we'll also shortly look into the safe protocol kit okay sorry yeah let's quickly talk about safe like most of you probably know safe already um if you've never heard of safe you've probably heard of noses safe uh it's a it's a old school multi-sake wallet which launched in 2018 already in the first version but it's way more than just a multicult it basically we are trying to push the con abstraction narrative because safe is also an ecosystem in the protocol so that means you can there's multiple um depths already building on safe or using safe under the hood for instance World coin is also here like they're using save every World coin user is also a safe user so to say and yeah yeah this talk will be about safe course Decay safe course Decay simply put is a type chain a typescript SDK so a library just with helpful wrappers for better developer experience when you build on safe or when you try to integrate with save contracts um yeah talking about safe like we restructured the the company or the project a little bit so we split into two groups um save core we will talk about it more in this talk and save wallet that's where I work at safe um yeah save water is mainly responsible for maintaining the interfaces that means the the web wallet or the web interface for the wallet and also the Android and the IOS app displayed here the screenshots wild save core it's responsible for also for multiple things you can split it into like three groups the first is the safe core protocol we will talk a bit more about it in in a bit it's basically the smart contracts powering safe and then the save core API that's the mainly the transaction service it's called it's it's a or some other services but mainly it's Services which for instance index save transactions which index created saves and which offer an API to to quickly query um which saves are deployed what are the setups for Save like so you don't have to fetch all the data on chain all the time and then the Safeco account abstraction SDK um yeah it already mentioned it it's like this typescript um SDK just wrapper around the save smart contracts wrap around some a con abstraction kits we will talk about it a little bit let's start with the Safeguard protocol it's quite new um previously we also used to call Save core protocol or save protocol uh the set of smart contracts which are right now deployed in prod but we are pushing for a new Safeguard protocol soon right now it's in the alpha state it was announced yesterday at ECC the first time in public and it's basically this architecture so it's a new framework or a new protocol around smart accounts and the idea is that like it's it's split between accounts Registries and Integrations where accounts are smart accounts um at the beginning it will be safe supported but the idea is that also other smart account developers or other smart account wallets um could plug into this protocol and then also use the same plugins and and Registries so it's not just bound to save what are Registries it's quite simple Registries is just um a registry where you where we have audited or sets of audited contracts these contracts are these Integrations so like it's always a bit tricky to know okay which of these plugins can I trust right and that's why we need Registries but that could also be multiple Registries it could be by multiple dials by multiple protocols just so that you know who who audited it and who you can trust for Integrations um plugins are very similar to modules like which already exist in safe so it enhances a saved by some new functionality which wasn't like which isn't there in the core contract or in the native contracts hooks plug into other hooks hook in to the transaction life cycle that means there's like callbacks for life cycle events for instance like pre-execution or post execution and also some other events and you can Implement what should happen or what should get checked there right so you could build some security feature where you revert a transaction if some condition is not met post execution or something similar signature verifiers uh is what currently is implemented in the fallback handlers if you are in the compatibility for back handloads called in the current save contracts so function for instance a signature verifier that's where the 1271 signature check is implemented in so if you want to build something more sophisticated in the signature check for instance you could use it for daxes for like smart orders you could check some Oracle if some price conditions are met and only then you could say that the signature is valid and otherwise the one inch or the Cal swap order would not be able to get executed or whatever other decks sorry I missed it what what is something about the stream I was advising we're just three years of the integration store get the registry basically registers these plugins hooks Etc so that you have like a source where you can check which plugins exist like and the plugins also come with some metadata on trail like also plug and call which version is it and um yeah so basically it's a way to find and discover these plugins also while at the same time bringing security because you could have a register which is quite strict about but that every plugin needs to be audited and whatever well another registry might be less strict you know but in a way if you trust the registry then then or if you know a register with high security standards it's also a security feature but it's also for discoverability of plugins I will show a quick demo to to um like a very quick demo yeah if you want more information we updated the docs today so if you check the save docs yesterday please check them again also some there's some other changes because we just deployed a new version of the con abstraction kit and yeah for the demo I will quickly switch to a new browser tab make it a bit bigger um I hope you can see yeah basically the demo which is also linked on the docs so you can try it yourself it's basically an application that's deployed on a GitHub page also or you can run it locally and you can add it as a custom Safe app to your safe so here and important it's as I mentioned it's Alpha so it's only on girly right now because we don't want a false sense of of Readiness for this feature right so we don't want people to actually use it with actual funds um because it's still in a very Alpha stage so yeah you can edit on the girly safe and then you can open it um you can see the available plugins so this list of plugins that comes from one test implemented registry so that's why I mean it helps for exploring plugins for instance or hooks for instance and here you could now enable some of these sample plugins or like there's also an example for Relay plugin which relays transactions through gelato paying the fee from the safe and it could also pay in year C20 tokens I will not share them and show them more detail because the talk should be more about the con abstraction kit but I want to mention it because we have bounties about the safe core protocol so if you have further questions please come to our booth or use our Discord and then we can talk about that yeah or check out the demo yourself and then you can also try to relay with it let's go back to the slideshow okay let's talk about the account abstraction SDK as I mentioned it's a typescript library and it consists of multiple kits and every kit has multiple packs which are kind of the implementations so the kit is kind of the interface for a certain feature while the packs can there can be multiple for certain Integrations with it um so the auth kit is the first it as the name says it's for authentication that means it's a kid to to create an ethereum address which then becomes a signer of a safe um So currently um you can for instance use a Social account like or your Google account or your Apple ID to create a signer using NPC through a provider and use that as a tape signer for deployed safe then the protocol kit like the Portugal again are the the save contracts so this is a wrapper around the save contracts like you need to give a designer and then you can sign transactions send transactions or deploy saves also to this kit yeah oh yeah for instance you could also deploy save and already do a transaction in the batch with it then the on-ramp kit it's a name says it's quite simple you you can buy uh crypto with Fiat and put it into fund your save address through it in the relay kit I already also mentioned the provider like gelato um the idea is that you don't pay cash from your UA or from the executor of the transaction or from the signer of your save but you for instance could pay directly from your safe or through something like a third-party provider which offers to pay the gas for you here's some examples of of the current existing packs we plan to also extend these packs by new providers as we go so far the offfield currently we have the web 3 ask it uses web 3 of IO to create like assigner using NPC from your Social account like I mentioned the stripe pack it only works in the states currently because stripe is only available in the states for on ramping but there it works and the malarian pack is quite new um I don't know if you've heard of numerian but they are in Europe and they use a Euro stable coin and you can on-ramp to a bank account which is then connected to your safe and the gelato relay Peg used gelato to relay um you can pay it directly from your safe with it or you can also pay through one balance yeah we also plan to add more kits in the future like right now we're looking into recovery kits or a multi-chain kit like a recovery kit is as the name says to to recover uh the safe if if you lost access to a signer for instance or to add a custodian if you if you use a custodian service then it's like half not not self uh custody anymore but yeah and the multi-chain kit um yeah we're also looking into supporting multi-chain better for for uh saves because right now save is only deployed on one address always and it's a bit tricky to interact with multiple saves on multiple Networks and of course the future will tell we will also have more topics which are important and add more kids to this SDK yeah the SDK is deployed or is available on GitHub and on npm it's called save course Decay from safe global and it consists of these dimensional packages like here's also another list of the packages and the only one I didn't cover before is the safe course Decay types in the safe course Decay types are basically just like some typescript types which are used to cross the other kids so we don't have to copy paste them everywhere so just some types yeah let's also do a quick demo of the kit like we have a demo app you can also try it yourself um it's a small react app um I hope it's big enough zoom in a bit yeah um and then in this in this demo you can use some test Network for instance like Mumbai you can start the demo I already did before I hope the Wi-Fi will work properly um and you can try out the different kits like this is the auth kit so this is the rep 3 Alice model which opens and you can say you want to continue with your Google account for instance then you log in with your Google account it will create the this hierarchy from it for the signer address and takes a bit okay here now you see the owner idea that's the signer connected to the safe as an owner that's the ID generated with web 3 hours and the save account is deployed with that owner um and we also see the address here in this small demo app it also shows like some code snippets on how this is built I mean it's not the exact color but you can also check the demos also open source to see the exact code but this is basically to explain how they work so here we import the um three hours kit or two objects from the reptile kit then we need a bunch of options they come from web3l so they required on web 3 hours site like the client ID like you need to register as a customer then you get a client ID you have to put it here um or you also can configure which chains should be used and then some UI options which are not super important inside the explanatory yeah and some some other small options for web 3 hours and then in the end it's always a similar um structure like as I said like the interface is basically always the kit and the packs of the implementations so here we initiate the web 3 else model pack and then we initialize the kit with this pack um and then we have opt like methods like sign in sign out get provider Etc I can use those to interact with the save them next is the on-ramp kit I can certainly not show it because right now we only integrated stripe in this demo app because monarium just launched I think like last week um but basically if you click on it we can see the model but it won't work because we're in Europe right now um if you want to try this there will also be a link if you're if you're safe has no funds yet to the Mumbai faucet so you could also find it with a Mumbai faucet and then continue in the demo uh here it's similar like the the how to use shows you a small snippet so there's some variables required on stripes and like the stripe public key Etc um some session data also which contains like the chain supporter that which currency to use Etc um and then again you create like you initialize here the kit with the pack and then you have functions which you can use like saveonrem.open will open the stripe onboarding model yeah next the relay kit also small demo we can I will already click because it takes a bit but all that happens if you click is the web 3 or signer will be used to sign a transaction which transfers 0.01 Matic from the Save to the safe itself so and it relays the transaction cost from the save so as we saw here it was as one click I did need to sign emitter mask or anything else and the transaction is being executed on chain so this kind of shows the power also of account abstraction yeah as we see its success so we could check the transaction if it's included here okay for the gunskins a bit slow you have to trust me just try it yourself um okay let's continue with the slides and talk about the hackathon like um this year we have like ten ten thousand dollars in hackathon bounties for for the safe Foundation and they're split between these two projects I presented um like if you want to be eligible for the bounties you have to build either on top of the safe core protocol or the save core account abstraction SDK the bounties have the same tiers projects but it's several bounties for each project so you can decide on what you want to build on if you want to build for safe also important for the Safeco protocol it's the new protocol which where I showed the diagram where we updated the docs for it's not the old smart contracts like we would prefer if you try out the new project called build a plugin build a hook be creative about what you could build with those or you can also build a registry or alternatively you could even build a new small wallet implementation which uses this um this new protocol like to show that also other smart accounts could be used and not just saves um yeah if you have any questions about this please come to the booth we'll be there all the time I'll try to be there as much as possible uh to answer your questions and we also have a Discord partner Channel like partner Dash safe on the safe on the East Global uh Discord yeah here's some some more links like links to our docs to the disk our own Discord our forum and our Twitter if you only want to participate in some discussions around these topics or if you want to just check out the docs or just need some help um we also have a small hackathon success guide which we try to always maintain between our hackathons which has a lot of learning materials has infos about like past workshops or past hackathons so you see like which teams won in the in the previous hackathons what did they build just to get some inspiration but also to know what not exactly to build because it would be good if it's something new or not just a old project revamped yeah uh this QR code leads to the notion page with this hackathon success guide if you want to scan it otherwise we also have this QR code at the booth um yeah I will leave it on this page this was the presentation if you have any questions feel free to to reach out or to ask them now or otherwise you can always come to the booth or escal Discord thank you hey thank you um have you considered the building a metama snap leveraging your SDK like to have a contact abstraction with snaps if you are a wearable snaps I'm I'm aware of snaps um I guess so like the the only requirements to be eligible is that you use the SDK and I think in the snap you could also use the sdks or dependency to for instance if you want to sign a safe transaction and you have made a mess you could fetch some context right about the safe transaction some snaps on it definitely like the only requirement is to use the SDK or to build on top of the new core protocol so yeah would also be in the Geo fix that then well the the smart accounts in the new protocol is that a different contract than the current safe accounts no it would be also the the Chrome safer cons I think that demo like apparently as I mentioned it's only deployed on girly okay so uh only on girly test net and I think they're they're used together with also the new um safe version 141 if I'm not mistaken um but you can yeah is that kind of uh based on the the 443 37s at the abstract standard or is it is that still a different day um I think the news safer the new safe version also supports 4337 I think also through a module if I'm not mistaken um but it's it's it's a different protocol like this this save core protocol is not directly related to 437 it's more the idea to um have a new framework or have a new architecture or protocol um to include multiple smart accounts and have a way to of a composable modular architecture to easily extend these smart accounts by new features and then it would be cool to use them also across different smart accounts and not be bound to to a safe like for instance this example we saw like all it does is um it relays through gelato like it's a it's a plug-in so if you send the transactions through this plugin it will check the gas costs and it transfer the the amount of esc-20 tokens or the amount of native tokens to gelato in the same transaction and then gelato can relate um that's the demo like I also if you want to check it like there's a repo like this is for instance this demo plug-in like the relay plugin so it's all like it's linked on our docs you can find it there and there's a contract folder and there you find the contracts used for this small demo which you saw here you can also try it if you deploy a safe and girly you can try to enable this relay plugin um and then and then try to relay some transactions so these basically replaces marginal is that the right way to think about it okay I think in the future yes yes because the modules right now only work with safe right they're like part of of of safe the safe contracts but they're not part of I don't know the Arjun contract so the idea is to at some point like have a have a standard protocol app or push for a standard protocol which can be used across smart contract wallets and build plugins for those so there's different implementations but they're very similar like then in the in the short term you we will still have the module safeguards and stuff like that and in addition that you can also get out of enable plug-in uh or folks yeah I think in fact you could build a plugin which is a module and a plugin right because in the in this app if you enable these um it will in fact just enable a module oh okay also like it's kind of both but it will also be applied um I didn't prepare a full demo with a one out of n Save right now I don't have uh I can demo it at the weekend I can prepare demo at the booth and then we could do it at the booth I returned with on some of the links and I I wasn't getting okay yeah we can we can take a look at it yeah this is all like very new like this was the first time I think this was this demo was presented two days ago and the the general presentation about this Safeguard protocol was given yesterday at UCC the first time so it's all brand new or Alpha but we want to gain like very early developing um feedback to see if it's like good to build on it or if it's like if you could improve something because right now it's Alpha we can still change it right or if there's any issues with it I'm not telling the the needy ball I don't know um you have to open it as a custom Safe app that's important like here it's embedded and safe so it's like in the safe you go go to apps then do custom apps and then you add the URL of the demo app and then you should be able to enable them otherwise you only see something else I don't have it open right now but yeah yeah yeah no you have to open it as a safe app then then it should work cool thank you I've seen a new website that you are deployed in 12 12 Networks is that right uh save contract yeah no he has a safe contract and that's the save contracts yes so if you want to build on the cont abstraction kit you could build on those 12 networks also I mean there's even more networks I think there's a repo it's called save deployments um if you check that out you see actually all the networks where we deployed per contract so if you go here to the nurses save contract you see this is a list of contracts where we actually uh of chains where we deployed so this is a lot of chains because we whenever there's a new chain we try to deploy them but we don't support them in our interface yet but it's just the idea that we still deploy them already so this is the full list of contracts so if you want to hack on it you could use any of these networks okay but the new slave core protocol which with the plugins and hooks that's only on girly right now so if you would want to use that somewhere else you would have to deploy it yourself I'm right for now because it's still Alpha it's um but if you want to hack on the existing productive contracts right the better proven ones they're deployed on All These Chains It's called safe Dash deployments have you planned to deploy the linear uh do you know the chain ID by heart no and you can check in this report yeah okay now I was live yesterday so yeah so I I think not let's see when the last update was here four days ago so probably not yet yeah okay thank you thank you very much thanks very well that concludes our workshops for today happy hiking
Automatic transcript — names and jargon may be misspelled.