KL Mini Hack 2023: Scaling Ethereum with Rollups and ZK Proofs: Intro to Scroll and zkEVM | Feb 16
Ethereum Malaysia·Mon, Oct 9, 2023, 12:00 AM
Scroll is a L2 scaling solution on the Ethereum layer. They strategy is to construct a zkEVM which allows executions to be only run once, and then provable via a proof for those that would want to verify it. We are pleased to have Daniel Helm, Dev Rel from Scroll to share with us more about Scroll and zkEVM
Transcript
all right I've recorded So hi everyone uh Welcome to our and our another workshop for KL mini hack and today we are very pleased to have Daniel from scroll a devrel uh to share with us about scroll and ZK EVMS and I hope you guys enjoy this topic because this is something that I personally have been looking for and without further Ado I will let Daniel take it away go for it Daniel all right thank you so much for the introduction yeah so this talk is called scaling ethereum with Roll-Ups and zero knowledge proofs um you know for context we are going to really stay at a high level try to get some fundamentals and understanding more about what layer twos are and all these things um if you came to see an architecture Deep dive into scroll um sorry there'll be a little bit of that but check out YouTube videos and other places as well um but let's dive right into it I am Daniel Helm I lead developer relations at scroll and if you haven't heard of scroll here's what you would see if you went to our webpage it says the native ZK evm scaling solution for ethereum scroll is a ZK evm based ZK roll up on ethereum that enables native compatibility for existing ethereum applications and tools so if you're not really deep in the ecosystem uh that probably makes you feel a little bit like this right you have all this jargon what is ZK what is evm why does ethereum need a scaling solution solution at all um and so that's what we hope to address a little bit in this talk right we want to kind of demystify this and I hope at the end of this talk you'll be able to go to our homepage and be like oh I get it now um and if you don't get anything else out of this talk I want you to take this away for users and devs scroll is pretty much ethereum we'll have lots of little caveats here and there but for most users and devs Scrolls just like ethereum and what better way to to see that and to experience that than a quick live demo I think people get freaked out by the ZK stuff they feel like it's over their head but let's just do a live demo to show what it looks and feels like to just use scroll right so if we were to go to like scroll.io we could click join the pre-alpha test net and I've already connected my wallet I've gone through the faucet I've bridged things from layer one to layer two but once you're kind of in the scroll ecosystem you can use apps like our uniswap V3 demo that we deployed and so you can connect with your wallet we can see what that looks like in metamask I bet it's locked but let's see if it'll pull up here and so you can see I've connected to a scroll L2 test net and just like you'd expect I can type in a number of Ethan I could trade those for say uh usdc here get an exchange rate and swap and do exactly what I would do in an ethereum there's nothing really different here I pay a little bit of gas and typically I could count to like one two three and it's done so we have a four second transaction time which is actually it's like feels more Snappy than ethereum okay so I did my little scroll demo here just so we can say you've seen scroll being used it's not that intimidating we're gonna get down to some fundamentals but if it feels too much don't worry about it okay so to tell the kind of story of scroll why scroll what we're building um gotta start off with blockchain scalability and understanding what this problem is why we're trying to solve for it so we can start off looking at the promise of ethereum I think all this is probably pretty well trodden territory for an ethereum Meetup but we'll get into it we've got a platform for decentralized applications it's like a single Network where we can share code and data we can create all these new possibilities in code where we can kind of solve consensus problems it's open to everyone anyone can join in right this is the promise of ethereum and anyone can join in just not too many people at once right if we get too many users at once we run into this issue we run into making a swap making an nft trade or a mint and we see that our estimated gas fee is in the hundreds of dollars and we say oh it doesn't feel that open to me now in this moment understand what's going on here and to better understand scalability in general we need to look at why that happens right we have ethereum blocks and when we go to make those transactions or token swaps our nftments well we're asking the network to do is a certain amount of work right the whole network as a whole is doing a bunch of work is a kind of a unified group and so this work is measured in gas and these transactions are put into blocks these blocks can only do so much of this work in any one time so the block does the work of the transactions that are going to pay the most for that work right so if you have so many transactions that you fill up a whole block you've got to start figuring out who gets in who has to wait and so this is what happens the blocks are going to include those transactions of that pay the most so this is the kind of general idea of block space right we have a finite amount of work that ethereum is going to do in a given time period And if it fills up fees are going to increase so yeah this is the this is the the simple version of the story right and so we're all Engineers here lots of Engineers as a hackathon and so we want to come up with a solution when we find an annoying problem and paying a hundred dollars for a transaction is an annoying problem so I think the first naive solution you can think is okay well let's just make the chain do more work right we can do more work for each one of these blocks foreign okay well ethereum is a decentralized network there's all these nodes validators and each one of these nodes to make sure the network keeps going has to do every single piece of that work right uh this block is going to do or sorry this node will do all the work for a transaction this node will do all the same work for the same transaction because they all have to come to consensus and agree on what the the difference is going to be from one block to the next and so what you're actually saying when you say make the chain do more work is not that you're saying make every single node in the network do more work right which maybe we could here and there uh and really if all the nodes are super computers uh or living in data centers they're going to shrug their shoulders no big deal we can take on way more work than ethereum does people using Raspberry Pi's not so much right these smaller computers slower internet access machines maybe without as much hard drive space you can only push the amount of work so far before you start pricing these uh these these participants out of the network as well and so what happens is you have a network that used to look like this but now a bunch of them can't participate and it becomes much easier for nefarious actors to kind of hop in and um you know have issues in the network all right there's a name for this this is one little piece of something larger called the scalability trilemma if you're interested in doing a deeper dive into this concept um uh vitalik I think has a blog post from 2019 where this is introduced he goes into depth about it but the quick overview is this when you have a blockchain you get to pick two of these three things we've got scalability decentralized Network or a secure network but you get to have two right so Bitcoin and ethereum traditional chains prioritize decentralization and security okay when our hypothetical engineer said well just make the chain do more work that's kind of the model of high transaction per second chain so that's kind of moving away from the decentralization uh in into this kind of solution territory which is not exactly what we want right so another solution we could come up with is just to say well okay we can't make the existing Network do more work let's just spin up a second Network right and then we've got twice as much Network twice as much block space and we're good to go all right back to our trusty diagram here we would essentially be saying okay we have a validator set we have all these full nodes all these Network participants let's put half of them over here and half of them over there this side will still be ethereum and that side can be ethereum prime um right and you probably already start seeing what the problem is here we've cut our number of validators in half making it easier for one set to be compromised and so the security of these things gets reduced not to mention you have to also now figure out how to bridge that divide and everything else okay so here you know we've gone in the route of a multi-chade ecosystem and again we're trying to move towards scalability but at the same time we're making sacrifices in our security and maybe in our decentralization so how are we going to fix this well um this has been a subject of research for many years this is not a new issue but layer twos and Roll-Ups have kind of emerged as as the go-to way for solving the scalability issue and so we saw our Network before we can label this as ethereum and this whole thing we can consider like the ethereum network here and we also mentioned that you know ethereum is doing a big chunk of work right every block uh it's going to process these transactions the transactions will have logic in them there's programs running on this machine but it's doing this big chunk of work and so if we start Imagining the the different pieces of this big block of work that gets done um you know this could be the nft mint this could be the token Swap this could be a flash loan who knows um but what if we did a thought experiment here and we took one chunk of the work and we dedicated that chunk just to making sure that some other new network doesn't break its rules right we have a whole protocol blockchain whatever else off of ethereum um we can call these this an off chain protocol but we dedicate a piece of ethereum's work to making sure that that protocol isn't lying cheating and stealing that it's following the rules that it's set out to to to do okay and so this is the idea of how we can use ethereum to secure off-chain protocols and so layer twos is what these can get called and and they exist as their own off-chain protocol but use layer one as an important piece of the architecture right there it's people say that the layer 2 is deployed on top of the layer one but it's like this just separate Network that gets tethered in in some way to to the the base layer right and here we're talking about ethereum so I'll probably just start saying ethereum instead of layer one when we talk about a roll-up we're specifically using our layer one to make certain types of security guarantees right so Layer Two generically could do whatever at once but a roll-up is going to make security guarantees happen on that ethereum work right the the work that ethereum is going to do is going to help our rollup do things like ordering it's going to provide things like data availability it's going to help with censorship resistance it's going to help with correctness of the protocol and so that's what is really exciting about roll ups and we're going to dive in to this a little bit more as well and so the language that gets used for this is that you know a roll up on ethereum inherits the security of ethereum Roll-Ups um you know ethereum allows Roll-Ups to just kind of lock down the security piece because ethereum's got it locked down so that it can focus on the scalability things so again back to our fun trilemma issue here we've got ethereum locking down our secure angle so that now the solutions of make a new network or make the chain do more work these start to make more sense right because we've got the security locked down and we can move towards scalability here foreign if you've been around ethereum very long uh or at all you have heard of these Layer Two networks right you have all sorts of them all kind of competing or cooperating to increase the capacity of ethereum and some of them are you know totally different than ethereum but still use ethereum to try to get this security element so as long as we're playing protocol engineer here and coming up with new ideas I'll come up with a totally unbiased way to to describe what scroll does we could ask ourselves what should our roll-up do right what is we're going to make a roll up it's going to help scale ethereum it's going to provide more block space but what should be what we focus on well we can look at ethereum and say what makes it so great right well it's great because it has this incredible ecosystem we've got amazing tooling educational resources user communities smart contracts pre-existing projects like it's uh ethereum's got a it's a special place and we love ethereum that's why we're building a theater on ethereum in the first place and so for our roll-up why wouldn't we why would we stop at just inheriting security why wouldn't we also want to inherit the tooling the educational resources the users the communities the smart contract code and so that's kind of what we're looking at right where where we can we should make our role of just behave as closely as possible to the ethereum virtual machine and the evm is is that which does the work in the network there's all this other stuff about the communications and everything else but but the apps that we're writing in the smart contract code that's all going through the evm and so that's really the core of the of the network that that the seed that we can reuse in order to to maintain all this incredible ecosystem benefits and so no surprise I've described uh Scrolls approach to building on ethereum and building a roll-up okay so before just to kind of bring it home I talked about this big chunk of work that ethereum does we're going to devote some of this block space to making sure that a new network doesn't break the rules well more specifically we can look at how this works with Roll-Ups and you might have heard of projects like optimism or arbitrum and what they do is um they are called optimistic Roll-Ups and they use something called fraud proofs and the fraud proof is kind of this mechanism for someone to say like no the network broker Rule now I need ethereum layer one to kind of be the judge of whether or not the the off-chain protocol actually broke this rule or not um and they're kind of uh the process is lengthy because the idea is that anyone can get involved here and we're not going to focus on optimistic Roll-Ups but just to kind of give context that is one option you can take but the title of this talk talked about ZK Roll-Ups and that's what scroll is building and so we need to figure out like what what's the security mechanism that actually makes this all work right like what's happening on the layer one where we can make this claim that we can have a whole new ethereum and still have it secure and to start understanding that we're going to have to move into zero knowledge proofs now zero knowledge proofs is a big terrain with lots and lots of use cases you're going to hear the most kind of like simplified and biased version of this where math is not welcome um so if that's what you're hankering for there's lots of great educational resources and more coming out all the time and maybe in the questions section I can um help push you towards some of those but let's start off with a thought experiment especially for folks that are new to ZK uh let's let's try to break it down again I love this big box of work we don't have to label it we don't really know what it is but we have a a big chunk of work to do and this is a lot of work and it's going to be done over some sort of like data some sort of input to to the system and this is so big of work that we need like a whole data center of super computers to do this um and so here's the thought experiment what if we had a magic wand and we could create a receipt um and we could call this receipt a proof and what this receipt is is it's like not a log of the work it's not something to do so you can redo all the work it's just a way for you to kind of be able to have something somewhere else a smaller computer just be able to verify that all this work was done correctly that all of this work you know we don't trust this big super computer but we just want to know that at the end of the day what came out of all that work is correct and we want to say yep seems good seems right um you know the magic wand here is here because this seems kind of magical right a small computer verifying a whole network worth of computers well if you have heard of ZK proofs and are aware of zero knowledge um the magic is going to take us in a time machine but not forwards but backwards to the 90s and even the late 80s when we had papers like this we had checking computations in polyrhythmic time poly poly logarithmic time mouthful um but you know at the time there was research and writing going on doing cool stuff like coming up with a setup where a single reliable PC can monitor the operation of a herd of supercomputers working with extremely powerful but unreliable software and untested Hardware right so this is kind of that idea we can have a very simple machine that is able to you check the receipt of something that we don't trust that's unreliable that's way more complex uh but at the end of the day because of the beauty of mathematics uh we can we can check these things so fast forward to today um this has changed a lot there have been a crazy amount of developments uh in this field mostly pushed by blockchain applications um and you know I think to look at the scroll version here let's kind of Erase Away the super computer and the small computer but keep this idea of the proof and the proof verifier so for our work here what if our work was literally just the ethereum virtual machine right um all the ethereum virtual virtual machine is just a program run by computers uh so there's you know there are special things about it but it's not all that unique or special right and instead of just our data or input we could bring in things like new transactions or past blockchain state um instead of our herd of super computers we could have a brand new off-chain protocol we could have its own blockchain uh with its own computers processing all these transactions and then when it created the receipt instead of passing it to our Raspberry Pi we passed that on to ethereum itself right ethereum can run it is a simple computer that is what it can do and what it can do is allocate a little bit of its work to verifying the proof and saying yes all of the transactions swaps everything else I don't have to redo that as ethereum I can just double check that they were done correctly and so that's the magic that kind of is happening under the hood here all right big caveat I you know in this past bit I have our input here and these are all very public inputs right everyone can see the transactions being submitted but zero knowledge proofs can also use private inputs that don't ever have to get passed along to the verifier um if you see things about privacy protocols and privacy ZK VMS um they're using this aspect of ZK proofs but for what we're doing kind of emulating the evm a ZK evm does not need those private inputs and so um yeah we are using ZK proofs zero knowledge proofs specifically for this succinctness quality this way of kind of Smashing down the proof of the of the computation and the representation that everything happened according to plan all right so coming back full circle we've got our roll up it's a ZK roll-up and what we are committing is a ZK proof and that proof uh or rather the work being done on ethereum is is a program here actually it's a smart contract that is verifying the proof from our zke evm that is the computation being done on the L1 okay so we're getting through the parts we've talked about all sorts of things right we've seen the problem with scalability we've seen layer twos I did the world's fastest intro to zero knowledge proofs uh now let's get into scroll let's try to understand what we're building what we're thinking about and to lead off the kind of scroll conversation I'm going to give some value props for scroll why scroll why use it why build on it so the the main thing that makes scroll great in my opinion as a developer relations person is the developer experience how we have designed this net secondary Network this zkevm roll-up is that the code on that network is bytecode equivalent with ethereum zbm which means if you write a smart contract that byte code is going to be the same for mainnet as it is on our rollup if you're used to using you know tooling uh hard hat Foundry your favorite wallets all of those things you can kind of reuse them just fine on scroll and you can even copy paste you know your favorite solidity contracts and you can re follow your favorite tutorials and just deploy the scroll instead which is a great thing for a hackathon um all right so why else well we get compared to layer one we have a lot more throughput right we are creating more secure block space for ethereum which is going to save users gas feeds right we want to bring down these costs so that we can onboard the next generation of users and developers into the ethereum ecosystem and lastly one exciting thing is is because of this architecture we actually can reduce the time between blocks by quite a bit we on a good day we've got three second block times and and that's what we are shooting for at normal operation which means that when you're using web apps um it's not like I make a Transit transaction on my app and I twiddle my thumb for 10 seconds I only twiddle my thumbs for three seconds which is not quite as bad and it can really give a make the difference between an app feeling responsive and usable or not another I think important aspect of why scroll is is alignment we really are trying to build on ethereum's Vision build and coordination with the ethereum community with the EF and and some of their research teams and yeah I I don't need to go too far into that so I want to give a few more diagrams of what Scrolls kind of doing get a little bit less vague and kind of talk about it as a network um but this is I think really the most you need to know as a developer right we have scroll as our Layer Two down here transactions are going to come into a node most likely they're going to come into Scrolls public RPC but we also have some infrastructure providers and partners that have RPC nodes you can submit transactions to and it's going to interact with a smart contract on ethereum right we said we're going to commit data like these transactions will actually get written back to ethereum and then we're going to generate these proofs and those are also going to go into the smart contract this vastly simplifies the architecture this is actually a better representation and I'll speak through it quickly but again if you really want to do a deep dive go look for some videos from our Founders there's some from Devcon and other times that get more into it but a transaction comes into the sequencer and the sequencer is going to do a few things there's the executor which is essentially Geth if you're familiar with that go ethereum client and it's just going to take and process these transactions and it will output the What's called the trace and so the work that's being done uh by uh the the transactions coming into the network that kind of record of all the things that happen when that transaction gets processed that record gets passed to something called the coordinator who then will choose a prover in our decentralized prover Network to take that record and pass it into their zkevm this is our magical proof generator that will get passed back to a coordinator and that coordinator will commit that to the L1 in our roll-up contract some other things are going on at the same time we've got um our transactions as they come in getting passed to a relayer and those get kind of committed over here in the bridge contract as well we have a Watcher in our sequencer that is watching for assets to come into our L1 because you know you got to bring stuff off of the L1 into the L2 and so things will get locked up in here and then regenerated here so there's a lot more going on and a lot of things to coordinate and considerations to make and but we're not going to go into the architecture here I just want to give you a taste of of all the things kind of behind the scenes yeah and then to kind of see what it looks like as a block by block version um I think seeing it happen through time is is really helpful so we have another view here where we have scroll as our L2 and it's you know spitting out blocks every three seconds and these blocks will actually get kind of batched together and once a certain amount of gas is used across those blocks the transactions will be committed to the L1 so the like you know my nft mint and my token swap that data of me doing that will actually get written onto ethereum layer one just the data it won't get executed there but the data will be always available back on the ethereum mainnet then later in time once we've you know gotten our decentralized prover Network to run the ZK proof uh you know of maybe a few ethereum blocks later then the same batch will have a proof committed to the L1 so let's um we'll we'll see what that looks like step by step as well because I think it's kind of interesting but um we can think of our L2 blocks as having three different statuses we have pre-committed meaning that those transactions in the block um have been like taken on by our sequencer and they're true on our L2 chain but they haven't actually been committed to our L1 yet and so um you know it's hard to we don't really have that security of ethereum quite yet for those transactions then once those transactions get committed to on on the layer one once they've been written to that smart contract we call those blocks committed and then we only consider them finalized and like really fully secure once we have a proof that has been posted back on the L1 so that's going to be a little bit longer while the um you know decentralized prover network is working through the zero knowledge proofs in actuality that time that it takes to generate those proofs um it it varies but I think as of today there's always kind of improvements being coming out but I think as of today it's like can range between like five and 20 minutes for for this proofs to be generated um which can sound like a long time but compared to optimistic Roll-Ups you've got to wait about two weeks for for that finalization to happen so okay so let's see what this looks like step by step we have a block created by our sequencer its data gets committed to our L1 roll-up contract and so now it went from a pre-committed block to being a committed block that committed block gets passed to a coordinator and it gets then sent off to prover number one for proof generation T1 here means trace the trace of this okay so next we have block two it gets committed on chain we get the trace it gets passed off to prover number two and you know prover number one is still doing proof generation for batch one but it's okay it doesn't matter these things can happen fully in parallel because we know the sequence of events uh here on the roll-up contract and you know prover 2 could finish generation before approver one it doesn't actually matter um all right so now we've got batch three we've got batch four and then something maybe more interesting happens all of these provers have finished their proof for their batch of blocks here and then we can actually aggregate these proofs so instead of making the the ethereum network verify one two three proofs we can actually then throw all of these into another proof uh we have proof some proofs and so we pass these to another zero knowledge proof called our aggregate proof generation circuit uh and once that is finished that is what's going to get committed on chain and the smart contract will verify that that is correct uh or it will reject it and if it rejects it bad Network wrong we've got all sorts of issues but it will accept it because uh we we've also guaranteed that we're not going to break the rules here and so what we have is now we've verified that smart contract so batch one two and three here have become finalized right um number four Stills got a proof generation and verification to go but we can consider all of these finalized and so that's what it looks like for the scroll Network to be doing that if you want to like explore this more we have something called a roll-up Explorer we have chain explorers just like you would see on ethereum or somewhere else but we also have this roll-up Explorer which lets you look at what the last pre-committed block is committed block and last finalized block and you can kind of track these things in real time and so you can see you know we have an L2 block number and it's been committed on to the L1 but it hasn't been finalized yet and so we can see the commitment hash on L1 but it hasn't had a proof generated so we don't have a finalization hash on L1 and then this would be you know uh this is I guess proofs that are somewhere around 18 minutes at this point in time and so we have um this block being finalized and committed at this hash on the L1 and so we've changed States here okay so we went deep down into it if you if you're not super comfortable thinking about uh blocks and transactions and commitments that's fine let's come back to where we started for users and devs scroll is pretty much ethereum but faster cheaper and hopefully more accessible to more users at the same time so that's the goal that's what we're building for but right now we're not on Main net so we are still in our pre-alpha test net but you can use it it's open so um just like you saw me uh go to scroll.io and click the test the pre-alpha test net you can go and do that as well really all tooling should work just changing your RPC URL is what it really takes in this pre-alpha test net we're not using ethereum for it and we're not even using a public ethereum L1 test net we're running our own L1 test net until our Alpha release which is going to be soon no dates but soon if you're interested in trying this out from kind of the user perspective check out scroll.io pre-alpha where like I showed before there's buttons to set up your metamask wallet get funds from our faucet and Bridge those over we have a user guide that will walk you through those steps as well at guide.scroll.
io but much more interesting to me is some of our developer resources so we have developer docs at that same location so guide.scroll.io slash developers or just click around um you'll see a quick start guide for hard hat Foundry scaffolding and lots of other tooling um also a deployment tutorial if you just want to clone a repo and get going if you want to learn more about our architecture check out scroll.io blog and if you want to join our Discord Community Check out discord.gg scroll okay at this point in time I kind of planned a quick deployment Workshop I don't know the best way if in this format we are taking questions or anything but I also don't want people to have questions but also want to jump because I get kind of deep into code or anything so um let me check the chat at least and see if we have any questions seems like we are good on questions uh I think you can just go for it and at the end we'll have like a q a session and also like a small fireside chat I think that would be nice Perfect all right so let's dive into the workshop piece uh it's going to be quick right because I don't need to teach anyone salinity here we're just showing how to like get scroll going so what I'm going to do is clone an existing scaffold eth project um if you haven't seen scaffolding it's amazing as a as a way to get hacking on ethereum quickly we're going to adjust the deployment settings to use the scroll pre off of test net we're going to use the developer quick start to walk us through that we're going to adjust the front end because we have a web app that goes along with our our project it's not just the smart contract and those will use this the test net as well and then we're going to do a few things like fund our deployment wallet deploy the contracts debug an issue that we're going to run into and then try out the project so let's dive right into it this is the fun part Okay so we're going to go to guide.
scroll.io to start us off here and if we come down we have our developers section and this will kind of tell us all about building on scroll but we're going to go to the developer Quick Start and we don't need to read this because I'm going to tell us how to acquire chestnet ether there's a faucet no big deal but let's go to scaffold eth on our instructions here and this is what we're going to use to kind of guide us through how to do this deployment so to get started with scaffold if we're going to go to the scaffold e3po and we're going to clone it and I'm going to kind of fake it I've already cloned it and installed the dependencies because JavaScript is slow but what you'll want to do is write type your get clone commands and select it into a certain folder actually this is the base repo let's select a specific project um on scaffoldeeth what's really cool is all these hackers have different branches of the repo that do all sorts of crazy things and all sorts of experimentation cool smart contracts you can check out but there's a real simple one called dice game and that's what we're going to start off with here okay so what we would do is clone our repo into something like dice game I'm going to call the spikes game fake because I'm going to cancel the command and then we're going to act like I did it into dice game and so now we have our repo here and then we'll want to select this specific Branch or the repos I'll say get checkout dice game and then we're going to run yarn install and this is going to install all of our dependencies and I've already done it ahead of time because like I said it can take a long time otherwise so now we have all these dependencies installed and if you haven't used scaffolding it's really cool you can open up three different terminals one to run a local chain one to be building your front end and one for deploying your back end or deploying your smart contract to the local hard hat chain um but we're not going to have to mess with all that because we're just going to deploy straight to scroll because uh we're wild like that so what I would like to do is come back to our instructions here and also open up our terminal to take a look at our code and so the first thing when we're configuring scaffolding is that we need to configure hard hat imagine I probably need to make this a tiny bit bigger for the screens here and it says that we'll need to go into packages hard hat and our hard hat configuration file and what we need to do is just add this scroll Network as a network that's available to to hard hat and so we're going to copy paste this it's bigger for everyone we're going to come back to that so we have our networks we see local hosts here and now we've added scroll pre-alpha you know this is our arbitrary name we can call it whatever we want we want to point it to the scroll layer 2 our PC node um and this is a really cool function uh here on hard hat that lets us use kind of a hard hat wallet that we'll see in just a second the other thing we need to do in this area as mentioned here is we want to set the default Network for hard hat to be using scroll pre-alpha cool and I will save that we're going to need to to fund that wallet here in just a second but let's go ahead and already configure our front end as well um what we can do is go to hard not packages react app and we are going to go to the source folder and as mentioned here we have constants.js which defines all of our networks and so we're going to be able to open that up and copy paste the scroll pre-alpha Network and here again we're giving it a name we're sitting with the RPC is where to find the block Explorer defining the chain ID and even giving it the scroll brand color fun stuff all right and then the last thing we need to do to get our front end ready to go is go into our app.jsx and Define uh hey we need the we want the default Network to be scroll pre-alpha so let's open that up great um and so we for the most part should be good to go so let's see what happens if we try to just deploy the sizes we can say yarn deploy what's going to try to do this in the interest of time and leaving time for questions I'm going to tell you that it's not going to work because we have not created a a wallet to deploy this from right to deploy this we need funds in a wallet so we can run yarn generate and it's going to through a bunch of warnings but it's also going to create a public address here and if we type in yarn account it actually does this cool thing where we get a QR code for our wallet and the account that where it's located at and it'll start checking actually a bunch of our our balances and different networks and so scroll pre-alpha we don't have any balance yet but I've already pulled from some from the faucet and I've already bridged those to the L2 and so I can send that address some testnet if I don't think I mentioned this in the talk this is says TS eth and mainnet you know this is just going to be bridged ethereum you're not it's not some special scroll token or something where all this transaction is is happening in the same currency as the layer one which is ether right um so here we go we should be sending funds to that account and that looks like it was successful and so we run our Command again when we say yarn account now our scroll balance should be higher so now we actually have proper balance in that account great so now let's try this again I also forgot earlier when we go to yarn deploy we need to Define our Network and we're gonna say scroll pre-alpha and so now our smart contract is compiling it's all going it's finished compiling we're deploying our contract we've made a transaction and then we get errors we get all sorts of errors let's see what's going wrong it says error processing and ether scan endpoint could not be found for this network Okay so we're in early test net we don't have etherscan we actually have something called block Scout um and so if you're wanting to explore the network we've got an L2 block Explorer you can check out it works very similar to etherscan but it's not the same so but what we do need to do is actually go into this file packages hard hat deploy and then this is the kind of script that is our kind of default script for deploying our contract and there's a bit down here that you know basically does stuff with etherscan and we could be elegant about it and say don't do it for the this network but we're just going to totally drop it um and try to deploy again so let's clear this run our deployment again and I think actually technically it deployed earlier but those uh those errors were sure we're nasty so great we've published our contracts uh we're good to go um I guess we've deployed our contracts maybe this is acting like we interacted with etherscan but we didn't okay anyways the next thing we would want to do is is get our front end going we could deploy this online but I'll just run it locally remember we adjusted our front end so that it would point to scroll pre off a test net so I can type in yarn start we're going to wait a while for this to get going but it's going to be end up going at localhost 3000. and now we get to wait on create react app to do all of its fun stuff which can sometimes take some time um could have kicked it off maybe a bit earlier here but yeah so if you haven't seen um scaffold eats front ends they're really cool what we'll end up seeing here in a second is all sorts of modules that are look into our smart contract in different ways and really simple uis that make it really clear how to interact with them uh when you're developing on localhost you have like faucets and all sorts of things to be able to quickly hack things together and test them out but now that we've switched over to pointing at the the scroll pre-alpha test net um we'll see a few less of those because we'll we won't just use a wallet that lives in the browser will it use metamasks specifically for our wallet to interact sometimes compiling code like running code feels slow it feels three times as slow when you're on a live stream but um maybe while that keeps kicking off um I mentioned before the rollup Explorer if you go to guide.
scroll.io um we've got links to our block explorers our rollup Explorer um the the deployment tutorial I mentioned different smart contracts you can be interacting with that are already deployed to our test net so we've got the bridge different tokens unit swap V3 uh contracts things like wrapped ethereum and and all of those are are available to to jump on and get started as a developer so this is odd I don't know why it's taking so long I'm nervous to try to cancel it at this point um oh here we go beautiful here's now our scaffolding front end where I'll log out here it's going to ask me to connect my metamask I've already connected but we can see I'm on the scroll L2 where I have some test net ether already and I can interact with my roll the dice contract here just like on ethereum or any other test net be be interacting with those things without changing any tooling except for pointing at a new RPC and you'll notice you know these blocktimes are nice and quick and uh the gas is kind of fake because it's a test net but that'll be uh nice as well so that's what this looks like um and I don't I could poke around in here uh maybe I could just one last little thing pull up the smart contract on block scan here and we can see it was deployed and I've called it twice and you know the usual theory of smart contract stuff I don't need to spend any more time on it so thanks for thanks for amusing me while I go through that so I think that's it for my for the workshop um yeah let me know if we have questions or anything else thank you thank you Daniel I I think that is a very very great talk and you walk through it we walked through school from a to literary Z from how it works to how to deploy or scroll and I have never seen such a great talk and I think that's fantastic I think everyone who watches this in the future would definitely benefit from it thank you so much Daniel for doing that yeah uh I don't know if you have time do you think you have a cup like maybe 10 minutes to go to like some of the five side chat so that people get to know you in person get a no scroll and get to also ask some questions because from my experience uh people normally ask questions after the first question has been asked so I'm doing everyone an honor yeah let's make it happen let's go thank you so much Daniel uh so okay just to get to know a bit of yourself how do you get into the space and why scroll yeah so I came into the space as a mercenary Miner it was 2016 and I've been doing video production heard about this stuff called Mining and I was like yeah I've got a I've got a GPU sitting around I'll test this out um and I actually read you know the ER like you know a very older version of the ethereum website around then and started mining ethereum but didn't get it I didn't get it at all uh and I was trying to like click around and try to like what is the what is this thing that I'm like actually producing money-ish out of and um I think the reading about the Dao uh before the Dow hack and like throwing some money at the Dow was kind of where I first started getting it I was like okay we can do these cool coordination things that are were not possible outside of this context before it and I think that's when my imagination kind of got caught um fast forward a few years I had been like still a hobbyist outside of the space in terms of working full-time I went back to Computer Science school for money reasons I uh ended up going to art school and I thought I was going to be teaching students art students how to code when I graduated with my masters and covet hit and my teaching position I had been offered kind of like disappeared and so I was like was job searching for a little bit freelancing doing development work um and after a little while I was like oh wait the space that I've been like a hobbyist in for what four years at this point like people make a living there they like actually just do this work and I actually ended up finding a developer relations job at a company called Skynet which is in like the Saya decentralized storage ecosystem and that was also one of my first projects in the space to discover back in like 2016. so it had it really came full circle uh and was there for a few years uh and and when um when with Skynet as a company shut down I knew I wanted to move into ethereum full time and um you know I wanted to be an infrastructure had been hearing about ZK stuff but hadn't quite got my head around it yet and the more I researched scroll the more I got excited about their approach and eventually I just kind of um bothered them until they hired me as their first ever and so now we're building up a really exciting devrel team here at Sproul so that's good to hear I always believe that probably something some sort like a teacher whether you're teaching at the committee on how to uh like code like what you did just now like which is amazing so definitely uh you you're utilizing your teaching abilities and in a ethereum ecosystem so that's great thanks so okay uh well well as expected there are a couple of questions now there's this one by uh way can chew he asked who maintains the scroll protocol that's a good question um so there's lots of pieces to like I guess the protocol but if you're talking about like the infrastructure the computer's running scroll right now um scroll does so Scrolls a company that exists uh beyond the protocol that is being built and so we um are not to that decentralized goal yet we don't have a decentralized prover Network it's still centralized and all the all the provers are run on giant machines with gpus that we run um we're getting there uh it is on the roadmap but um right now the most you someone an outsider outside of scroll can participate in the network is at the uh the node level and so you can be a peer and run a full node with our sequencer but even that we're trying to keep limited to Partners just because we're still pushing out updates so fast and we don't want to give infrastructure participants uh a bad experience right so we're trying to make sure that things get more stable before we start trying to invite in more participants in that way um but if you're talking about like the code and everything else all open sourced check out github.com scroll Tech um and you know the ZK evm pieces are built in collaboration um it was originally actually a project I mean it still is a project by the ethereum foundation's privacy and scaling Explorations team sometimes called the PSE um and so like if you look at their repo for their zkevm um I think probably half of the contributors there are are from scroll so we really take seriously this goal of making sure that this is a collaborative effort to build something that uh you know is in line with the ethereum roadmap and not some sort of distraction or competition against it thank you thank you Dennis for the answer uh that's another one that's not in the chat but it was being uh us to me to our school team uh it's about the difference between zkevm so we know we are aware that in the market there are a couple I link three or four scroll title I think I'm not mistaken polygon Hermes and uh Singh uh would you share a bit about how score is different from the other Technologies and why do you think scroll it's it's something that we should uh we should check out on yeah um so I this is always a difficult question to answer and for two reasons one like any comment I make I'm not trying to throw shade on these other teams right I'm not trying to say bad things about them they're all I think full of brilliant engineers and non-engineers doing really good work and I think everyone in the space is wanting to push the ecosystem forward so that being said I think we all have our kind of different uh approaches and biases for how to do different design trade-offs and I expected this to be asked so I prepared a slide here um and to be honest like I am not designing and building this protocol and so I might get nuances here wrong um and if anyone tells you I'm wrong trust them and not me here but the general idea is that um scroll and polygon Hermes which is now actually called polygon zke evm you are writing solidity and it's going to be kind of compiling down the byte code and and both of these this byte code is is equivalent with his evm right so again like I mentioned all your tooling all your tutorials all your uh everything else it's gonna all that byte code that gets created out of your solidity is going to look the same as it would on ethereum and mainnet um you know starkware and ZK sync are different and and start where you know you're going to be working in Cairo I think there's this kind of like solidity that can get cross-compiled to Cairo and so it's kind of just like a different ecosystem overall and we could probably call that more like a ZK VM going on um and then ZK sync you have uh it is they call it language compatible so you can still write solidity but it's not being represented in the same way at the bytecode level it's not like when you get out into the Machinery of it op code by op code is it's not going to match what you see on the evm like you do in scroll or or polygons project so that might introduce different security assumptions right if you've already written a smart contract for mainnet you might need to re-audit that in the context of ZK sync or maybe you might have unexpected things in that transition layer um I haven't seen reports that that has happened I don't know if Auditors have told people that they have to do that but that's kind of one of the value props that might be a little bit different um I think the thing that really for me I think sets apart the scroll team and why I'm so excited about it is really the emphasis and the like necessity around this decentralized prover Network and then eventually the decentralized sequencer um those are the big things that I'm super excited about in our roadmap and getting that Hardware acceleration going so we can really get a robust network with lots and lots of participants Beyond just scroll right so yeah I agree that decentralization roadmap is something that I think all of the layer tools are are striving to achieve and I don't think there is a single can I say like a single consensus as to what decentralization uh is uh roadmap that someone is going to use probably stock worth to me seems like the closest to achieving that I could be biased again uh do you have any insight on like maybe some some plans like it doesn't have to be like concrete but what are the talks behind decentralization for scroll what are the ideas yeah so you know I think I'm still such hopefully I'm still sharing my screen so I'm not yeah okay yeah so like if you come back to kind of this this view here um you know I was talking about the decentralized approver network um and so one aspect is like that right you can participate if you have this like a little bit beefy machine with a GPU um you can kind of like allocate your resources to be selected by the coordinator to make these proofs and I think that's the closest on the road map um but then there's also going to be um a challenge of decentralizing the sequencer I've been to various talks internally about the like latest research of what we're going to do there I hesitate to like speak about it in a recording because I don't know which one's the latest and I don't want to like put out wrong information so um a lot of sense and thank you for trying to share and I know I know I know it's about he's putting you on the top spot it's a bit of a cheeky question by me sorry about that uh we have one more by LaLa um he's wondering if let's say uh because in uh in circum there's this thing called verify.so file which is normally very expensive to execute on on mainnet well we know so he's wondering if if that were to deploy on the scroll would it be much cheaper to uh try to verify uh second proofs graph setting proofs are generated by circum circuits that's interesting I think yeah I mean essentially you're looking at like a layer three where Layer Two is your scroll and layer one is you know ethereum at that point and that's definitely um no one's tried it uh but yeah if you have cheaper computation costs on your L2 then then that's going to translate uh as well that being said I don't know what the growth 16 op codes being heavily used are and so those might be charged more gas if they're hard to do in the ZK evm context um but if that's something you're actually wanting to try out get in touch we like to do weird experiments or help developers do experiments um and I know we also have been talking about you know what what pre-compiles can we offer developers so that you know um you know we're super excited about hopefully building an applied ZK ecosystem within scroll because we're excited about the field right so I don't enough it seems like that would be a fun a fun project to work on that's uh that's fantastic because you mentioned pre-compiles which is something that I also want to ask uh graph16 from what I understand from the code has uses some pairings and easy they say uh some elliptical curve at multiplication and add so I wonder if I I know that this is another tough question so you don't have to answer it but I have those um pre-compiles been supported by scroll yeah so we or if you say probably that's a way for us to find out later yeah and and we I we're not ex I'm like 99 sure on our test net we're not exposing any of those things as you know contract addresses that are pre-compiled um so the answer is going to be no at the moment uh but you know later on um I'm not sure and then also like I think one of the differences here I can say a wrong thing because zero knowledge is not actually my expertise at all so you know I don't know what that looks like to have that support for something like Roth 16 when our proof system is actually using the kzg commitment scheme and so as those things switch I don't even know if that's going to be something easy to to bring in um but I know we do also have like ecdsa circuits so maybe there's spaces there where some of those things can be optimized and other ones don't need to be but cool excellent so Lala if you really want to find out uh this deploy one on scroll and see if it works if not I'm pretty sure score is more than happy to get in touch and uh probably you guys can collab on in that area what do you think that is yeah absolutely like literally um let me put this back up this is actually my Twitter and my telegram so if you want to send me a telegram at DG Helm I'll I'll get you connected with someone that can better answer your hard ZK questions so sounds fantastic and uh well we don't have any more questions and I and again thank you so much for everything that you have given us to the local community uh I I yeah I think that's that's the end like do you have any last words to say Daniel um no thank you thank you for giving me the time and um I hope someone will follow up with me and show me some of the the best hacks from the mini hack because that's always fun too oh yeah I'll keep you updated on our this our telegram group don't worry about that go and all right uh last words from me thank you so much scroll for being a sponsor for our chaos mini hackathon and also uh willing to come by as a guest speaker it's late on that in Daniel's time so everyone just put an emoji a club Emoji or like thank you to Daniel that would be very very uh much appreciated and I'm gonna stop recording and well I'm gonna share a bit of like a final uh briefings on um the KL mini hackathon on what is to happen
Automatic transcript — names and jargon may be misspelled.