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

Loading player…

Starknet 🛠 Account Abstraction

ETHGlobalMon, Oct 9, 2023, 12:00 AM

Learn about how account abstraction will fundamentally change the way users engage with web3 and how starknet is enabling that change Some of the most skilled web3 developers, designers and product builders from all around the globe came together for a weekend-long hackathon at ETHGlobal New York 2023. ----------------- Follow us: https://twitter.com/ETHGlobal​ Check us out: https://ethglobal.co​m Email us at: hello@ethglobal.com

Transcript

This is a 20-minute presentation. I want to make sure it's short, clear, and useful for everyone here. So, raise your hands, I just want to know who wrote the Cairo program here. Okay, not very many people, but I'm extremely happy to see those who did. And how many people here have transacted or used Starknet Level 2 in the past?

Okay, so still a minority in the room. Finally, uh, how many of you know what Ethereum scaling or Layer 2 solutions are or Layer 2 solutions are ? Okay, great, great, great. So, we can skip all of that. Uh, let me just start by telling you a little about myself.

I am a developer relations engineer at the Starknet Foundation in the US. Hmm, I'm not that different from some of you in Asia. I just graduated from college last year, after four years of researching DeFi and game theory. And if you want to contact me or learn something about me, feel free to follow this link tree. And bonus points for those who get the joke and the name over there.

Um, so I have a few topics to talk about today. Um, we like to say on Starket that you come for the ZK, and you stay for the AA. So the main point of today's talk will be the abstraction of the AA account, but in general we'll look at what we do on Starknet. Um, as much as possible, feel free to let me know when these slides are redundant or you already know what I'm talking about so we can just skip them. Blockchain accounts, uh, people familiar with this concept: generally, a blockchain account consists of three things: an address, keys, and business logic, or some software deployed on- chain, and then some metadata.

Um, now the whole idea of account abstraction, for those of you who have n't heard that phrase before, is different from Ethereum, where those three things are all rolled into one package, uh, you can separate your addresses and keys from your business logic and data and actually write your own accounts as smart contracts and associate them with a specific address or a specific set of keys, which allows you to create highly customized accounts. Um, I hope everyone is familiar with this idea by now. Um, this is a quick slide that I borrowed from the Ethereum Foundation website. It shows how your address matches the data I talked about. Sometimes this is also called metadata or state data.

Um, a lot of the code you guys are going to deploy as smart deploy as smart contracts will be mapped to your account address via a hash code account address via a hash code . And let's talk about Starknet, since that was really the minority in the room. People weren't that familiar with Starknet. Starknet is a second-level solution that uses Stark proofs, which are a form of proof- of-stake to accelerate Ethereum. Um, we do this by essentially performing validation and execution of program logic on a second- level blockchain.

It's just a blockchain, and then we process these transactions, hash them together, and report them to the Ethereum first layer for inclusion in Ethereum blocks, and we provide Ethereum with mathematical proof that all of these transactions have been verified correctly verified correctly . So, has anyone here ever heard of blockchain, uh, the trilemma blockchain, uh, the trilemma ? Um, yes. Um, so it's its scalability, decentralization, and security. Essentially, Ethereum as a first- level blockchain, the last settlement layer is focused on decentralization and security, and we pick up on that when it comes to scaling and borrow Ethereum's security guarantees in a mathematical sense to do that.

Um, uh, there are several constructs of validity proofs. There are various collapsings that work on Starks, Snarks, Blanks, etc. Snarks, Blanks, etc. Although now, there seems to Although now, there seems to be a narrative in favor of the Starks. Essentially, Starks are a form of validity proof that uses economical cryptographic primitives, allowing the proof generation cycle to be extremely fast and theoretically post-quantum secure.

Um, but that means the proof is a little bigger and bulkier, and it takes longer to verify. But at starknet, we have optimized the proofing process to the point that it has significantly reduced the worry for us. Um, so just to visualize, you can think of all these validators as Ethereum validators running on a full Ethereum client, Stark processes a bunch of transactions, creates proof that the validation was done correctly, and allows all these validators to verify that it was actually done correctly, without having to spend a lot of computing or storage resources on it. So, I hope you're all on the same page. Uh, I'll take a quick look at Cairo.

I think only two or three people here have worked with Cairo in the past. So, Cairo stands for CPU stands for CPU , which means intermediate arithmetic representation. If you're not familiar with this, you don't have to be . Um, ZK and proof systems can seem a little technically intimidating. I'm not a PhD myself , but I've learned that you don't need to know these mathematical details to build really cool programs.

Has anyone here ever written a zk- ever written a zk- proof or attempted to do so in the past do so in the past ? So, if you use use any of the more childish libraries like circom, zocrates, or remix, you will notice that you need to express your program logic as a circuit in order to write a proof. Hmm, and this is a pretty big departure from the traditional paradigm of writing a computer program that runs on the Vonoman processor architecture and uses the RAM model. So, at Starknet, we essentially created an intermediate layer, a virtual machine, that allows you to write expressive smart to write expressive smart contracts and software in general in a programming language like Rustl, and then we constrain, arithmeticize, and essentially turn your computer program into a provable program and automatically generate the proof by building the system. So you don't need to think about creating a scheme from scratch.

So this is a kind of old computer programming experience that transfers quite easily to the world of ZK scaling. It is very important that we have the KA Stark verifier implemented as a smart contract on Ethereum. So all your Cairo code can be tested on Ethereum. So, I just want to quickly help you imagine a naive way of verifying every transaction, uh, using, uh, if you didn't have a proof system, which would be that you would have to re- run every transaction on every node to verify what's happening at the second level; this would be of order n. Uh, whereas with proof-of-concept systems it's polylogarithmic, and as you can see, as the number of transactions in a block increases, the difference in time and resources is, to put it mildly, striking.

Uh, no one understood this, uh, so yeah, finally, let's move on to account abstraction. I want to make it clear that account abstraction is not necessarily something that only Starknet is working on. This is already a pretty big position. There is a big push to start, uh, implementing account abstraction in Ethereum. We've already talked about what this means.

This involves separating addresses, uh, login keys from the account logic and allowing people to express their own accounts. Um, on Ethereum, as many of you know, the block that you get, uh, from three things is called an external account (EOA). It is different from a smart contract. Uh, and it is supported at the EVM runtime level. Well, there are some great features of having an EOA.

Uh features of having an EOA. Uh , they've been around for a long time . So, the developer tools for EOA and integrations are very mature. Uh, you have products that have already reached billions of dollars in market cap, like hardware wallets and browser extensions that are quite user-friendly. I use them myself.

Uh, but there are some limitations. First, EOA is not a smart EOA is not a smart contract, which means you can't express, uh, program logic on it. For example, if you want to use something like a multi-party signing scheme, you will have to use the services of a third party such as NOS safe, etc. Whereas, uh, you could express that functionality in your own code if EOA was just another contract. Uh, some arguments also point out that, uh point out that, uh , EOAs create a bad user experience.

Um, because it's just a story, and I'm not paid by Braavos, but I'll tell you about Braavos in a few minutes. I see, this is a story about Braavos, a widespread, um, widespread, um, smart widespread, um, smart contract wallet on Starknet. Essentially, Braavos, because it uses abstract accounts, was able to create three-factor authentication for its wallet user interface. So, you can sign your transactions by simply clicking a button, which is a familiar UX. You can also sign transactions using Face ID.

Um, and you can do social key recovery very effectively. Um, and there was a crypto influencer in our ecosystem who accidentally exposed their, um, private keys during a Twitch live stream, um, a while back, and their Ethereum keys being exposed unfortunately resulted in their fans withdrawing most of their funds from their accounts. But because the Braavos account was set to 2FA and they needed to sign in using facial recognition, the only wallet that people couldn't use despite knowing the private key was the Braavos wallet. And finally, um, one of the benefits of the distraction factor that I really like, and I'll go through this slide, uh, too many slides to go through, but, uh, account abstraction allows you to essentially turn your phone ( whether you have an Apple, iPhone, or Google phone) into a hardware wallet by simply implementing the Cairo Secure Runtime Signature Scheme. So, this is a kind of TLDDR that I could do in 10 minutes on account abstraction.

There are other benefits, like creating a seamless user experience for people using adapts, because you can create something like a payment wizard that pays wizard that pays , uh, gas fees as meta-transactions. Er as meta-transactions. Er , AA on Starknet supports multi-contact calling functionality, etc. The main differences between AA on Starknet and Ethereum are that on Starknet, AA is supported at the protocol level, as this was a concern we addressed from day one. Hmm, we have sophisticated developer tools around AA, and I'll share them with you in a second so you can use them in your projects during the hackathon, and, uh, we can also provide commission delegation, uh, for DAP, just like Ethereum does.

Yes Ethereum does. Yes , that's exactly what I was talking about. You can use a secure enclave. This is the name of the secure execution environment on an Apple phone, and essentially turns it into a hardware wallet solely through account abstraction capabilities. Uh , I understand that I don't have much time.

So there's a great story about account abstraction that you can listen to, if time permits, by following this QR code. I highly recommend her. Uh, and so, now, how many of you have Braavos Wallet on your Chrome browsers? Good. Uh, so I'll get to that in a second.

First of all, I want to give some guidance to developers here who might be interested in building something with Starknet in the next few days. few days. First of all, if you're interested, uh, the resources are pretty concisely compiled in this book about the darknet, um, which can also lead you to our documentation. Um, everyone here is an experienced hacker. You're all carnivores, so I'm not going to, uh, go into too much detail on this .

However, if you need more help, blogs on Medium are a good place to consider. Um, there are two directions I would like to encourage people to consider over the next two days. The first one is zero-knowledge DAPs or verified machine learning DAPs, um, which can be implemented quite easily using the Giza ZKI toolkit, uh. Um, you can basically build machine learning models in familiar frameworks like Jupyter notebooks and Python, then transpile them into Cyrote code and test them on Starknet very efficiently. Actually, if you follow this QR code, you can see how you can implement a neural network that can recognize, uh, distinguish between different texts in less than 10 minutes.

And if you're interested in on-chain interested in on-chain gaming, the hottest narrative, one of the hottest narratives in the Starnet ecosystem right now is the Dojo gaming SDK. And in the last few months, some really cool games have come out using the Dojo SDK. Actually, if you think you can do it, I would even consider combining these ideas and creating games that use an AI agent in a gaming experience, like playing chess or something like that. Perhaps these QR like that. Perhaps these QR codes will lead you to some sample projects you can consider.

Hmm can consider. Hmm , yeah, as I understand it, we have four minutes left, so I won't go into the coding right now, but if you quickly scan this QR code scan this QR code , it will take you to the article. Hmm, I would just recommend following this article. This will take you no more than 10-15 minutes and will help you set up a local development environment for Cairo. Setting up a local development environment for Cairo is as simple as typing two lines in the command line interface.

Hmm, all you need to do is set up a command line tool called stark lii and a package manager called scarb, and that's it. And then you can execute it, uh, to essentially create. So, I created a wallet just for this demonstration. This is Braavos. Uh, it's a pretty useful, uh, mobile wallet, but you can create a wallet with some, uh, you know, testnets.

Uh testnets. Uh , I recommend using started girly gurly 2. These are our two, uh girly gurly 2. These are our two, uh , test networks. Just set up this account.

You can easily integrate it with your CLI. Uh, you can define your own account however you like. Uh, if you want to use, uh, RPC calls, uh, I highly recommend using Alchemy, it's extremely easy to create a new application and configure it. You don't have to, so it doesn't matter if you do any of these options, but, these options, but, uh, you can create your RPC node here. Here's where you can download Braavos.

And finally, I want to introduce you to a block explorer that I highly recommend, it's called Stark Scan. Hmm called Stark Scan. Hmm , basically, yes, I'm sure you all know how block explorers work, but you can get pretty good information. Hmm, just playing around with this. Hmm, yeah, the instructions here are pretty, uh, clear pretty, uh, clear .

Uh, my team and I are going for a walk going for a walk . And you can find us with Starkware t-shirts or IDs and just stop us, ask us questions. We will be happy to help you with your projects. Hmm, as I said, I highly recommend taking a look at the Giza ZKAI framework and the Dojo Gaming SDK. So yeah, I have one minute left.

Uh, if anyone wants to ask a quick question, we can wrap this up in the afternoon. Yes. So, warp is obsolete. Uh, that was before we had Cairo as it is today, we had an old version that was a little more like Python. Not exactly, but it's a bit similar, and it was a bit more difficult to use, so we created a transpiler from Solidity to Cairo.

But now you can write Cairo programs in the almost identical Rust framework. So warp is no longer needed. Yes. Something else? Perfectly.

OK. I think we're on time then. I will stop sharing. But thank you very much for listening to me.

Automatic transcript — names and jargon may be misspelled.