ZK&AA, private smart accounts and other examples
ETHCC 7 · 11 Jul 2024 · 17:56
Silur, who says he co-founded a layer one, looks at combining zero-knowledge proofs with account abstraction (ERC-4337) to add privacy to smart accounts. He compares the owner-based model used by Coinbase Smart Wallet with plugin-based accounts, then walks through case studies: social recovery with ZK Email, ZK KYC, fiat gating with TLS Notary, stealth addresses and anonymous group wallets with Semaphore proofs. He cautions that better UX widens the attack surface, and that bundlers and gas sponsors are extra third parties.
Speakers
Topics
From ETHCC 7, hosted by Ethereum France.
Transcript
Thanks. Thanks everyone for uh coming to this talk on the last hours of the last day. Also, thanks for the organizers for having me again. It's really delightful and I'm honored to witness the evolution of UCC from the beginning. I brought you this year also an independent topic, namely zero knowledge account abstraction combinations with a little with some case studies. The subtitle is that now we are able to do web two and web three apps with concept traction using the alternative mempool. But it also comes with privacy issues that we need to tackle on top because as usual, better UX means less security.
And I also co-founded my own layer one and a couple other uh crypto startups. So the agenda, we're gonna quickly go over the novelty of smart wallets, the necessity of the latest and the ruling EIP on account abstraction, why it was the winner, what capabilities it brought, why is that bad, and why do we need ZK on top of all this? Then a little about the intent-based transaction, which uh in my opinion is the generalization of what account abstraction actually unlocked on a user level for us. Categorize a little the different approaches on top of this EIP by the various developer SDK that offer these solutions, and then some case studies on top of this.
So smart card tracked wallets. Um, if you started Web3 development long enough, you know that uh bunch of uh developer focused and industry focused companies tried to tackle this issue for a long time for recurring payments uh and um uh security, uh accountability reasons, access controls, uh, but none of them managed to do it in a standardized and uh comfortable way for both end users and developers. But the concept itself is is old enough.
The way we approach this problem is what was subject to competition and now finally standardization. The two uh runner ops over account delegation which introduced two new opcodes into the EVM, but we don't really like those because for those that you have to fork, and that's kind of like a natural disaster on blockchains when that happens. And uh account abstraction, kind of safe to say, that won this battle by using the alternative mempool. And the reason they did it is because now we finally can do intent-based uh transactions.
So user operations that you send to a bundler or the executor are finally decoupled of the life cycle of how an Ethereum transaction is getting uh eaten by the mempool and the network and the miners, and especially if you have to consider MEV on top, it was just too much as an onboarding experience. But user operations finally unlock this, you transact, and you are cut off the underlying engineering of the network finally. But the problem is that as there is a new participant in the whole uh transaction flow, and most likely it's gonna be a centralized one. This is just a personal assumptions of mine, so user operation providers are yet another party that you have to carefully navigate when you are doing the transactions here, and you generate more metadata if you unlock more capabilities with social recovery, and you suddenly start to connect web through identities and KvIC into your account abstracted wallet.
You just generate more metadata, and we have to be really careful about these. So on-chain intentions are easier to express in zero knowledge, especially if you have a helper smart contract that can execute almost arbitrarily anything that's touring complete. Of course, you have the constraint of the guest cost, but you are not constrained anymore in elliptic curve mathematics when you have to express relationship around the transactions. So far, you had to do it in the not so small area of elliptic curve mathematics.
So the two most popular um smart wallet models models around uh EIP 4337 that I encounter is the owner-based, the easier way. This is what Coinbase SmartWallet uses, which has a really uh good developer experience and community. It's a naive model, you just enlist uh other owners into a smart account, and then account kits, which is using another type of VIP, the plugins, which is a clever generalization of the above model. You can have time locks and all.
So we are back. Thanks. One more. Okay. So the naive owner model, the Coinbase SmartWallet model. You have a smart account, which is a smart contract.
And you can authenticate other smart contract owners. So if you just enlist another private key, uh public key or an address as an owner to the account, the problem is that they can empty out your smart wallet, so it's not so smart anymore. But the trick that Coinbase SmartWallet figured out here is that this because you can do it on an address basis, so it doesn't need to have a corresponding public key, you whitelist another contract for which you can verify that it has very limited capabilities on top of your wallet. So for example, it can only do monthly pull payments for a streaming service or up to a certain level, or it can only do a number of uh automatic uh pull payments from the wallet before reverting.
So it's super easy to integrate, but still not the most elegant way because you are still whitelisting owners to your accounts. The more elegant way, but harder to integrate, is uh what account kit uh took into consideration. You have to install, which is an on-chain transaction. You install plugins into your account extracted wallet, which will have a very sophisticated uh session called session keys uh that can have time-based or intent-based or address-based uh group-based account control over the wallet here. So now we know both of the approaches to take with the smart wallets.
Let's go to the case studies on combining it with ZK. First, most popular use case on account abstraction is the social recovery one. Embarrassingly many addresses on all blockchain networks are dormant because of lost keys, so this was obviously one of the most gaping issues to solve with the cost abstraction how to uh recover funds after private keys are stolen. So the Clave wallets way, which most likely you are all uh familiar about, they were one of the first. I can't risk to say they were the first, but one of the first to solve uh social recovery with the content abstraction is kind of a naive way to do.
So you whitelist Twitter contacts friends as guardians into your account, and then you report that or you make another flag transaction on your smart account that you're you lost your K, or someone does it, you have to collect a threshold of these guardian accounts into the clay wallet to recover or be able to enlist a new sign in key into this account, which technically works, but uh you have to prepare for the incident beforehand, and we know that in security that never happens. Most people don't invest in their security before a breach.
Uh that's why security experts make most of their income after breaches happen. So the more elegant way to do this, and I think we had representatives from this project uh today is ZK email. So with uh DKIM signatures, you can selectively disclose that you received an email from Twitter that said that uh you are able to recover a password with this username without actually putting uh sensitive data on chain. So if you just store a pre-image of this uh on chain, you don't have to leak your username or email yet using ZK email.
You can prove in ZK that you received such recovery email. And you can have once you have a proof, so ZKML have an on-chain verifier. It's part of your smart account, and once it verifies such a proof, it unlocks you the capability to enlist a new signer K, which might be an embedded wallet into the website or bring your own wallet situation with MetaMask. We also have an even more elegant way. And I think one of the talks today was also about TLS notary, a really underrated project that I'm not related with anyway, by the way, but I used them since the beginning. Now it's a little difficult to use it since TLS 1.3 because the handshake takes a little longer and they needed to introduce the multi-party computing aspect to be able to prove that you've seen something online.
So you log into your bank and you can prove that the bank's backend at some point at this date told me that I have X amount of dollars in my bank account, and you can uh with an additional layer prove this in ZK to the wallet to unlock some more capabilities. Because the negative part of TLS notary, uh sadly I missed the talk, but most likely they also talked about this that it's an interactive protocol. And so it doesn't solve the Oracle problem instantly that we want to do with the contestation model here. But thankfully there are these new notions of zero knowledge proofs called verifiable oblivious linear evaluations.
So wall proofs uh excel in interactive proofs, and there are now even projects that combined the best properties of wall proofs and TLS notary, so the MPC based TLS proofs to unlock this capability on chain. So case study two, ZKKYC. I think one of the exhibitors were really interested in this use case. So with ZK email connected to some sub, you can prove that some sub gave you an authorization email that you are above a certain age or you are not from the US, put it into your smart account on chain, and as long as the DKAM public key of some sub is whitelisted in the whole protocol without disclosing your actual age, you're able to prove on chain for a future transaction that you are not on blacklist or you are authorized to participate in an airdrop. And this can also be done with start addresses if you store them in your smart account.
Second is fiat gating that I just mentioned. So using TLS notary, the MPC node in between, and on top, you have to make a wall-based or a hybrid-based ZK proof on top of TLS notary to break the oracle problem here. But if you manage to do that, you can prove to your account abstracted wallet and store a proof indefinitely, or you can put it put a timestamp like an expiry date if the policy requires that you have certain amount of assets or a number of assets on your bank account on your fiat payment systems. So it's especially useful for real world asset tokenizations and the T Rex protocol, which does have a little uh concern on regulatory aspects.
So next one is how to enable stealth address uh anonymity here. Vitalik has an excellent summary article on how stealth addresses work on smart contract level. With account abstraction and ZK on top, now you can store your meta addresses. So if you remember stealth addresses are derived by a public meta address that's not sensitive data, and just like following the Monero or the Zcash way of out-of-bound transacting on the blockchain, this is the same idea. The address that you're sending your assets to is basically the result of a key exchange and then a key derivation, which only the two parties can do.
And using account abstraction, you can store these initial meta addresses in your smart address that anyone can go to and derive an infinite amount of stealth address. Second good outcome of this model is that if you remember from the article by Vitalik, you need to use view tags to scan for transactions that happened on your stealth address, which is a little costly, and it yeah, uh, if you do have to do it on a paid RPC, it costs a lot of token because get logs is one of the most expensive developer calls on an RPC. But if you do it on a smart wallet, you only have to filter for a single address because you know that your meta addresses are stored on a single collective address, so you don't have to use the view case from the original idea anymore.
You can also benefit from the guest sponsorship idea behind user operations. So NFTs are no longer a big issue with stealth addresses because most likely the resulting uh stealth address behind the meta address will be empty. It doesn't have any guess. But if you fund it for guess, then you made a link, so it's not a stealth address anymore, you lose privacy. But uh, if you use it with the guest sponsorship Mohital behind user operation, then problem is uh easier solved. And also if you can implement uh other types of public key encryption uh models uh in Solidity, then it gives uh way to alternatives. The other the next case study on ZK account abstracted is anonymous account abstracted group wallet.
So using semaphore proofs, uh you can prove prior sending the user operation to the to the executor, especially if you use store in between, so you are also anonymized on the network level. You only have to prove that I'm part of the whitelisted groups that are authorized to interact with this contract, but I don't want to disclose which one of these I am. So if the anonymity set, just like with Zcash and Monero, if the anonymity set is large enough, then with some proofs and nullifiers, you can uh go through these transactions and validating uh semaphore proof on-chain inside the account of tracted smart toilet is super easy, literally two lines of code, as you can see here. So, shortly, the conclusion.
As I told in the beginning, more UX is amazing because we want the next one billion users on Web3. This is the narrative for a while. It was it's a double-edged sword because as soon as you bring in a feature that kind of allows to do so, you bring in a much larger OTAC surface that uh we are not really prepared for because we weren't preferred for prepared for Web3 in general. You have to select your executors, bundlers, guest sponsors carefully because they are still another third party that you have to rely on. And the whole protocol is uh you can't be sure that it's completely trustless on a network level executor level.
So ZK can especially unlock good uh anonymity and privacy uh properties here because validate operations are flexible enough that you can include uh proofs into your um into your user operations. So most of the time, why I brought the case studies depending on other projects, namely TLS notary ZK pass and ZK email, is that we are thankfully past the times uh where I started ZK that when you wanted the ZKU case, you had to engineer the circuits yourself. Uh if you really want to go deep into that, you still have to learn uh circuit engineering, but now we have the RISC zero and a bunch of other projects that lifted this responsibility.
So by using developer tools already present in the ecosystem, you can unlock uh almost every privacy use case that are waiting for account abstraction for privacy. So my slides are online as usual. Uh feel free to drop me a telegram regarding the slides or the talk after. Thank you very much for the attention. Does anyone have a question?
Related talks
- Zero Knowledge & Account Abstraction
- Meetup #08 - ZKP & Starlight
- Privacy Panel
- In Praise of Shadows: Why Ethereum Needs Privacy | Zac Williamson - Aztec
- Privacy, the Missing Link
- DAPPCON 2019: Why zkSnarks Aren't Enough, Taking a Holistic Approach to Privacy - Harry Halpin (Nym)
- private compliant DeFi protocols - myth vs reality
- Non-interactive, Unique Nullifiers: The Key to The Next Era of ZK by Aayush Gupta
- Ultrasound Privacy: How to Harden Web3 with Aztec