Account Abstraction landscape in OpenZeppelin Contracts

ETHCC 7 · 11 Jul 2024 · 21:12

Ernesto García reviews the account abstraction landscape from the point of view of OpenZeppelin Contracts. He recaps how ERC-4337 separates the signer from the account, describes the library's past contributions, and shares an analysis of which 4337 accounts and paymasters use OpenZeppelin code. His hypothesis is that experimentation will come from new cryptographic primitives such as P-256 signatures, so the team wrote a pure Solidity P-256 implementation using Jacobian coordinates while people wait for the precompile. In Q&A he says cross-chain authorization comes down to standardizing general message passing.

Speakers

Topics

From ETHCC 7, hosted by Ethereum France.

Transcript

These contracts are audited by the m best minds in the world, uh, the people working at OpenSappelin and the security research team who is amazing. And they are basically checking uh on our job every now and then, right? So for you to have a uh like a general overview of what we do in ERC20 transfers that are using open supplement contracts. This is our best estimation, but it's around five point six trillion USD uh in total value transfer using open supplement contracts. So I'm still wrapping my head around these numbers. This is uh this is honestly unbelievable, but this is all because of you all guys building on open supplement contracts and also using our code.

So let's dive into it and let's review a little bit of uh what the agenda looks like for today. So let's start a bit with some prior context about account abstraction because it's now recently pretty popular and many people started using it basically with ERC4337. But in reality, uh account abstraction has been already there since a couple years ago. It's just that we had different ways of abstracting accounts, right? And we're gonna talk about that. Aside from that, we're gonna dive into past contributions from the open supplement contracts team and also some of our contracts that are you know around there, uh powering some of the infrastructure behind 4337. Let's uh then let's go to a hypothesis to where do we think AA is going to go in the next couple of years.

And finally, what what are the main challenges that we see on the smart contracts side, at least for Solidity. So let's start. Um basically let's start with a um a quick recap about account abstraction. Um let's recap that in the EOA model we used to have this idea, right? In which you have an account and you also have a signer, but basically these two things are the same thing, right? They are coupled, you cannot separate the signer from the account. It's basically the signer has an address, and you use that address to represent some sort of an identity, right? So what is going uh what is going on with the idea of account abstraction is that in in in reality is this sense of separating what the signer is from the account, right?

This is what we currently call usually a smart contract wallet, and we have seen a couple of implementations for this. Uh there are some out there, like the safe wallet, which is amazing and heavily audited, pretty secure. Also the wallet from Alchemy and some other players, players out there. But the idea is basically this, right? You have this separation of concerns, let's call it. You have two different identities, and these uh entities, sorry, and these entities represent something pretty different. At least in particular for 4337, uh, the verification logic side looks more like this. We have like uh pieces that are a signer or an account.

That's what we call it, it's an interface for ERC4337 accounts. And we have an aggregator, uh, which allows for aggregating signatures, and there are some pretty cool uh primitives that people are experimenting with in this regard. Um right, let's dive into some past contributions from the open supplement contracts team. Let's start by this one. Probably you have seen it before. So many of you may have had questions about this when you started writing smart contracts. But this contract right here was there initially to enable overriding the function message sender, right? Uh it's pretty confusing for newcomers that you start using open supplement contracts and then you see context over there because basically it's there for you to override this function over here.

What is the logic behind that is that you can replace it with some sort of uh identity verification or a public key verification, right? This uh wasn't used pretty much. I think it was like some of our first experiments as as a community of making account abstraction and some sort of doing that. We called it uh meta transactions back in the days, if you remember. So for this, uh we decided to keep this one for 5.1 contracts because we actually saw some usage for it. As you can see, there are a couple of thousands of transactions in different uh different mainnets.

And this is mainly driven by multiple relayers who run automations on smart contracts. So it's still a pretty interesting use case. It's not actually account abstraction, but it's it's also there, and we we have been contributing to this, and this is basically the reason why context is around still. Um aside from that, we in the past contributed to ERC 1271. Probably you know about this, and if you don't, the idea behind 1271 is to make a smart contract able to answer the question is this a valid signature or not? So what the ERC is proposing is to add uh a function, it's a basic interface that you can add to a smart contract, and then this smart contract can react to signatures and basically say, yes, it's valid or no, it's not valid, right?

This sounds pretty promising in the context of account abstraction, but there are some interesting challenges around composing these new standards, right? Because back in the day when this standard was made, there was no idea about what a bundler would be or would look like, or also what validation rules we would have on the uh validation phase for 4337, which act which actually messes up a bit with this idea of having a standard interface for validating signatures. Uh, but I'll dive into that a bit more later. Um also uh you can find this interface obviously in open supplement contracts.

Uh it's just about you know um inheriting from this contract, implementing your log your logic over there, and you will have a new signature scheme or validation scheme, whatever you you want to call it, right? Um so let's dive into the current landscape for open sampling contracts and also in the current account abstraction infrastructure that we are using, which is 4337 mainly. So this is uh the current ERC4337 volume. This is uh user operations. So as you can see, this is way far for is a lot more than we had for uh ERC2771, which is the context example for meta transactions, which is me which means that um there is people, there is more people using 4337 infrastructure rather than just meta transaction.

So this is this seems to be like the intended direction. So uh I'm happy to see that. But inside these uh user operations, uh what can we see inside? Uh we say basically the three entities. This is how the ERC4337 defines it. And this entry entities are uh I'm listing only the entities that are related to smart contracts, right? Because we can also find a bond layer and some other uh entities around there. Um let's start with the account. Um in the case of the account, we can find uh some interesting implementation. And from this implementation, probably the one that has the uh the biggest marker share, probably is is barely visible, but uh is the majority from Alchemy, which is pretty interesting.

Uh this probably speaks about the infrastructure they have and also the distribution distribution mechanism. Um they have a reach, they have reach to a lot of developers and lots of infra. So this this actually makes sense. Inside these accounts, uh, there are some notable um notable examples of usage for uh different accounts. Like this is also oh, the amount of deployments. So, as you can see, is again alchemy leading the the way. Uh, from this, we can find some notable examples of uh open sampling contracts usage. As we can see, EC DSA is multiple times over there.

We can find it here, here, here, here, pretty much in every account. Uh so this shows uh quite interesting insight that is people is not bringing their own signature schemes yet. There they are mainly experimenting with implementations of secure verification for signature algorithm algorithms. Also, we have some message hash utils. This is also interesting because it's a set of utilities uh to make Ethereum messages different to regular messages. This is for different security reasons.

You can read about that in that contract in particular. We also have the signature checker, which is is uh is a way to check whether a contract is implementing 1271 or not. And this is also showing the intention of uh some accounts to actually use 1271 as part of 4337 infrastructure to bring their own signature screens. Uh, this is kind of great and it's also amazing. Oh, also other notable mentions. Uh we have some cases of upgradable contracts also here, which is also kind of interesting because it shows that the community is still experimenting and open to you know make upgrades and improvements to these accounts. Um perfect.

Uh we can also see the distribution for paymasters, the majority of paymaster as well are coming from alchemy, but we see another uh bunch of interesting players like B economy, also Pimblico over here, and all of these are using uh open suppling contracts. Also, some other notable mentions mentions of usage. We can find uh some cases like ownable. Also, again, ECDSA signature checker. This is probably there is some mechanism inside the paymaster that is using uh 1271 for validating signatures, right? Um, also uh some important note we couldn't find the verified uh version of the Alchemy Paymaster, but we presume it's using open sublin contracts based on the infrastructure and other tooling they are using.

Um let's go to our hypothesis and where do we think this is this is going to go in the future. Basically, we think uh we need to enable or we we need as a library to provide more ways for people to experiment using accounts. Where does this experiment experimentation will come from? We think mainly for new cryptographic primitives, right? We have seen a lot of interest from the community in signature schemes like P256 and or you know, this this alternative elliptic curve. If you are not familiar with that, don't matter, it doesn't matter.

It's just a new signature scheme, right? But there is a lot of implement uh experimentation with that. We think that by bringing a new implementation of P256 that is pure solidity, will help accelerate this experiment experimentation phase. Why? Because people is still waiting for the 7 7 to 12 pre-compiled to be included in different chains. That is probably something that is going to take some time, but in the meantime, you can use a very optimized and heavily secured implementation of P266 that we will release on one of the next releases, right? Also, we are adding primitives for RSA.

Turns out that there is a lot of public infrastructure out there that is using companies and governments, so people can bring their own signature schemes to new accounts, and this is an area of experiment of experimentation that we see a lot of potential of. Also, we want to provide new utilities for 437 account experimentation. We think there is already a lot of implementations that are already very well audited and rock solid. But we would like to have like a a way to contribute to this effort. So we are putting an eye into all of the research behind modular accounts and new other standards coming to solve this issue.

We are probably going to contribute to some of this, but in the meantime, we want to focus on some primitives during the upcoming months. And finally, we have a new addition for 5.0. I'm not sure if you have already played with it. I personally loved it, but it's the access manager. Is the new evolution for uh permission and access management? If you have used access control, it's pretty much the same, but like on asteroids and for multiple contracts. And we're planning also to enable or guide you to make some workflows for account recovery or using the access manager because it's very suitable for that. So these are some of the plans.

Of course, we are planning uh concrete um work on contracts. And some of these things that we have on the roadmap are this right here, right? We we already have native AC DSA, but we want to enable it in an account. There should be a basic account that is uh capable of signing messages for um, you know, like a regular ECDSA private key. We are also enabling uh P256. Uh the implementation is a call to the pre-compile, but with a fallback to a solid implementation, so you don't have to worry whether the the pre-compile is already available or not. You can just right away use it, and that's it.

Uh similarly, we are adding RSA with with some protections. We know RSA is uh is a controversial signature scheme, uh, but we think there is some market for it, definitely, and uh eventually we want, of course, uh more people to move to new signature schemes, but this is still relevant, and we think there is a nice use case for that. Similarly, we're planning to add a multi-signature, but this brings some new discussions, right? Like, for example, how to use different multi different signature schemes within the same account and recognize each one of them. So there is probably some upcoming research on that uh that we have to make.

Uh, but this that this is roughly the plan that we have for the upcoming months. Similarly, for the paymaster, we want to enable a paymaster that you can uh use by paying with ERC20 tokens, of course, from OpenSabling Contracts Library, and similarly an ERC721 that you can think like a subscription for using a paymaster or something similar to that. Um main challenges that we see, of course, security. We think playing with all of these primitives is pretty hard, and using different signature schemes is really hard, right? It's about combining uh hashing algorithms with signature schemes.

Not every signature scheme uses the same hashing algorithm. We're pre-used the to the catch act 256 that we have have used like all this time, but there are also new other algorithms coming, right? Especially with all of the zero knowledge proofs and all of this cryptographic research that we we've been making that is amazing. But all of this is hard, so we want to kind of provide you with the primitives that are like the correct abstraction for you to start experimenting in the most secure way possible. So that is our goal uh to keep in-depth security for you as part of the offering in open sampling contracts with optimized contracts and the best we can in terms of security.

Uh, we also want to follow community standards. If you have standards that you want to discuss or ideas that you are planning, or if something of this sounds like a problem you already have while playing with account of traction, we're happy to hear uh to hear your your comments and I'll so chat with you. Also, we want to provide the best tooling guidance, and let's finish then with uh another thing which is interoperability. We have we still have to do some research on this, but definitely we see some challenges on things like this. Like, for example, with 1271, it's most likely that people will need to load a public key, right?

From somewhere. Where is this public key going to be? Probably in storage. Well, that is violating 4337 validation rules, right? So we have a couple of challenges to overcome, but this is uh I think a really interesting topic, and we are definitely very excited to keep working on that. Also, some other things. Um, we will see hashes and rehashes everywhere. Like, for example, some modules, like for example, the safe wallet module for 4237 is forcing using KetchAck 256. Um, this is probably normal, we'll see it, uh, but if we don't take care of sort of standardizing and reaching consensus of how to do this, it it kind of will become a mess.

So we'll keep an eye on this, and this is basically what we will be working on. So thank you so much. You can scan the QR code for a POA app and I'm open to hear any questions from you. Thank you so much. All right, so we have some time for questions. Yeah, thanks.

Just wanted to ask you something about the P256 uh implementation that you plan on releasing. Uh I know there is already a lot of uh very hard work and exploration on on that topic, and we have people working on providing very optimized uh things that are not really readable, I guess, but extremely optimized. Where is Open Zeppelin trying to be in that spectrum? Are you going to try to work on something heavily optimized as well, or maybe on something that is uh like more readable like most of your uh implementation, I guess, and other questions. Do you already have a date for the release of that thing at some point or or an actual approximate date uh for that thing to happen?

Yeah, sure. So I I will start answering with about the release date. So we're planning a release for uh starting Q4, end of Q3. That's uh probably likely the the date. And regarding P256, that is a very interesting question. Um because yeah, it's going to be readable as all of our implementations try to be. But in the case of P256, uh my co-worker Edrien, he made an I an amazing work uh doing an implementation at the high level instead of optimizing, you know, on the very details. Uh the implementation is really technical, but basically instead of using one type of coordinates that are called affin coordinates, he started using Jacobian coordinates in which the space is an spacing with the operations are way easier to do.

So it's definitely not the best, um not the most optimized implementation because two days after that we find we found out that uh like an optimized implementation of ours, but it's definitely very competitive in in comparison to what is already out there, especially because of this high level approach what that we decided to take from the beginning. Hi. Hello here. Oh, yeah. Where is it? Uh so my question is that do you see any rising protocol for cross-chain authorization, like case store contract or case store layer two just uh launched by Coinbase? Any kind of those protocols do you see promising for the future use of smart accounts across chain?

Right, good question. Um I think all it all comes down to standardizing general message passing. And I I think that itself is uh is a challenge. Uh we are doing also some research on that because some of our plans, it's at some point bring back the cross-chain library that we have for before. But we currently wouldn't have anything concrete yet, right? Especially because yeah, it's difficult to coordinate with all of the current uh already deployed solutions. Uh but ideally we will come out with something for general message passing that will translate to other mechanisms such as access control even and access control is also related to owning an account, for example. So yeah, I think um we still need to do some research on that.

I think it all goes down to general message passing. Okay. Uh I think we are running out of time, yeah. Okay. Well, thanks. Thank you.

Related talks