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

Loading player…

Latest update to the Scroll testnet by Dr. Haichen Shen

Ethereum DenverMon, Oct 9, 2023, 12:00 AM

Latest update to the Scroll testnet In this talk, I will share the latest progress in the Scroll testnet and zkEVM development. Haichen Shen Dr. Haichen Shen is Scroll's co-founder and the engineering team lead. A highly experienced technical leader, Haichen got his Ph.D. from the University of Washington and has worked on AI compilers at AWS. https://twitter.com/shenhaichen

Transcript

[Music] today I'm going to share some of the challenges we encountered when we are building the ZK evm and the zkrop and Hope Library like have some insight to everyone who want to like to learn more about the scroll and then about the key evm and the CK how CK drop works okay so what is scroll building so scroll is a building and evm equivalent zkrop to scale eczem as a layer two and then what does evm equivalent means that means like it will be compatible for all of the evm codes that has been using to execute all of our transactions on a CM chains and that means like also that indicates that all of the smart contracts are now deployed on the ethereum layer ones can be seamlessly without modifying any code you can deploy on the scroll as it's like the power of needs of the powerfulness of the being evm equivalent so that developers doesn't need to rely on any like a uh didn't you learn a new language or need to use some of the plugins to your compilers to compile your code to a different architectures so before I dive into any like technical details I want to First share some of the principles uh we believe in like when we're building the zkevm and zkrops so first of all we believe that the all of the blockchain projects is especially like the layer 2's should be developed through a Community Driven approach now what does that Community Driven approach means so for scroll we are building our circuit or open source from day one and we're collaborating with all of our community members to contribute to the same code repo and we have been collaborating with the Privacy scaling explosion team the PSE team from the Eastern foundation and then from the day one and also there will be other community members here to join the whole like the effort to build the ziki event together and that means like all of the code the design has been like discussed within the community and it has been peer reviewed to guarantee like there's no box and then there'll be like a more secure and a better design for for the community we are also using an open source proving system called Halo 2 that's been developed by the ccash besides of like building with the community we are also like an Outreach doing a lot of Education to the public by teaching people like how to use the Halo 2 to build circuits we're like teaching like some of the sessions uh with the zero spark zerox Park group and then to educate people how to ride echo2 circuits and I also like being like running some auditing sessions to teach about like the architecture of the zika even how should you build ckm to make it a secure and how to make it work and second we also believe that a building that blockchain layer twos need to have the security the first in your mind and then have like a steady release like not rushing to become the first and then like all of us you can grow up and SDK event there'll be like a very long run game uh it doesn't mean like At first like that doesn't mean like the anything I was thinking um so I think like that we need to guarantee the security guarantee the reliability so like people will trust the CK drop will work eventually um so to be like the uh pay more attention to the security in the scroll like we are like we're paying a lot of attention to the auditing so we have like the Auditors to look carefully uh probably like multiple Auditors and iteratively looking at our circuits uh the bridge contract and although know the implementations and then internally we also build an in-house security team so that we can uh review our code internally so sometimes like the internal teamwork we have like a uh it will be keep reading the code and they have like a different eyes of Engineers to look at the code so to give an example like the the zcash like previously find a critical box and then the bug is founded by the internal team members inside their own teams that means like it's very powerful to have an in-house security team to look over your code and then keep like the iterating and then over and over again to make sure like they will be bug free and then certain things like I would believe in is the decentralization so I think a lot of people like believe that decentralization may be like not important in a layer too but we don't think so I think like the decentralizing is one of the key characters for the blockchain to be censorship resistant and then that also like the means like a Unity like the uh as a layer tube in the future will become the execution layer so like I think like the 90 of execution will be happening on the layer twos so it's also important to make sure that the layer 2 will inherit the same guarantee that a serum provides as a layer one so that means also we need to be censorship resistant and then the decentralization will be an important part of that so for school we are committed to decentralize all different layers including the approvers with uh responsible for generating the ZK proofs as well as like the sequencers like so that all other you have the validators to validate and then the different one can propose the blocks and then process the transactions okay so just to reiterate like for the Community Driven so these are like a a subset of the contributors who has been contributed to the ZK evm circuit projects and the dialect half members of like from school and then like from Eastern foundations and from other teams who like are very interested and contribute so I think I will just make it like uh continue going and have a growing developer Community to help us to build the ZK evm and so just like share a bit of our journey to scale these serums so screw is funded about like almost two years ago and we've been like working for like about like almost a year and then we until we reached the phase one and I believe that there's a we build a key event proof of concept so make sure like the the running the putting the evm into the ZK circuit is a practical and it's a possible thing to do um and then after a few months I could build our first pre-alpha test net like running like the uh we are running both the layer one and layer 2's and to just better test some of the ZK evm initial like ideas and then running some approvers to generate proof like at the real time to share some of the statistics of our prayer for testnet we like up to now like we have more than a million unique addresses running on our pre-alpha test net we have processed I executed more than 16 million total transactions uh have like the due to the proof for uh have proved for more than like 1.8 million blocks and then we also receive like a lot of developers like the deploy contract sounds like there are 60 000 deploy contracts on a test net from 36 different addresses and a fast forward to today like the uh on this Monday uh February 27 we launched our Alpha test net it's under permission is testnet on Kodi so uh though like the for this new test net we'll be running like a more complete uh DK event circuits uh and then we are connecting to the 30 to more like having more real like the better testing and then have like a real like a good test users to come and test on our test net so as like I said like it's been live on the Monday like the it's been running like almost a week we have like a ZK proof verified on the 30 in the smart contract uh it's like it being the evm equivalent and we also like build a bridge between the 30 and the scroll uh and as as of today like I checked like there's more than 12 000 Goldies has been deposited through the bridge from goody to our school test net and this is like some screenshot I took like the last night so we already have like a more than one thirty thousand uh addresses like been running and we have already like we've seen like the first week we already processed more than 400 000 transactions on our layer choose okay so that's like about like our story so now I'm going to share some of the challenges in building the zkevm and secure graph so where are the challenges you can think about like building those things so first you need to learn how to write CK circuits and the writing CK circuit says it's harder than writing some regular normal programs and then next like after you learn how to write ZK circuits now you can build xdk event by using the tools and then using all of the uh the reason the product or ziki products and then the open CK Frameworks and then last after having the ziki um then you can build the infrastructure to run the zkrop to build a proof and to roll up and then to finalize on the layer ones so first I'll explain like a while writing CK circuit is hard uh so also like people know like writing CK circuit is hard but like I think that fundamentally there are two reasons like the ZK circuit is hard to write so when you write a regular program a normal program so what do you need to do like if your employer you could want to write a function full uh you only need to think about like when you're taking the argument X and Y and how to correctly uh compute the output Z so you only need to like to write that program for uh like the computation correct and then so that you can finish the program but in the CK circuit the logic is different so you can think like the post inputs and outputs of your original function becomes the input to your CK circuit and then what circuit outputs really is that whether this input is a valid or not valid uh Trace given the definition of your original functions so that means like if you give a valid input like x y and a 4xy then the circuitry output is a valid trace and then that should last through but if you're given a different input like the X Y and Z Prime like a random number so the second should reject and then you won't be able to generate a valid proof and have been verified by the verifier so you should actually think of it invalid so what this entail is that when you're writing the CK circuits into consider both the the correct case and then some incorrect case and you need to print or prevent all of the increases cannot pass through your circuit that's like why like making sticky writing the CK circuits are more tricky than writing your a regular program and the second things like in the CK circuit you need to work with the finite field so what is a finite field like so it's such as a field of a field that contains a finite number of elements so usually like that the number is a prime number so that you can have some properties like unique property Founders prime number so what does that mean like the found Paul you can think like it's a modular so all of the like one plus uh something like a modular a a prime number will become a finite field so take an example like the finite field we're using to build the ZK evm is from a elliptic curve bn254 and that finite field is a prime number of like a 254 bits value now the tricky things like in the Zeke in the evm the evm world has a 256-bit values that means like the the evm word cannot be natively represented inside of finite field so in order to represent the evm water you need to split into two different numbers for example you can a simple example is that you need to split into a high 130 128 bit Value Plus a low 128 bit value to represent the event world so this is something like the making like writing the ZK uh the CK circuits becomes a little bit more tricky than writing a regular program okay now second let go if we know how to write circuits and then we know like those challenges uh so what's the challenging thing about writing the ZK evm so if we consider ZK evm before like we consider ZK event let's take the CK out and then look at how evm works so the evm is the execution uh or interpreter that execute your smart contract by code like one by one like the sequentially and if you look inside the ethernet virtual machines it has like a few components first you have an Executor that interprets all of your op codes and perform some computations and then it also has like a stack and a memory for any transient data to be keep inside of the zkebm sorry to keep inside the evm and then you also need to read the database to read the by code the by code database and I have a storage space that keep the user account and balanced and also any like smart contract storage space will be keeping the storage and then like users are going to use our sense like a bunch of transactions and it will process the transactions one by one sequentially now let's put the evm back into the CK like what does that mean like how you build a CK evm so you also like to build a zkevm modularly like the evm so first if you look at the executors you're right in executor circuit which right now we just call it this evm circuit so the EVAP circuit is basically is similar to what an Executor behaves inside the evm it just process the all of the op codes in your smart contract step by step and then each step given like which op code you are executing your invoke a certain a set of constraints you can stream that the completion has been done correctly and then for the stack and the memory you'll have basically have a ram circuit to for any like a read and write you'll put those read and write events into your records like put into the circuit and you can constrain that any like the read after the right at the same message at the same address slots will become the same and then third for the any by codes you load you need to prove that you are loading the correct by code inside of SDK circuits that means you need to recalculate the bytecode hash that will be matched to the bytecode hash you stored inside of inside your state account for the storage that we know like the storage inside the ECM is like a Merkel Patricia tree so for every reader right you are generating a Merkel proof so that means like in the MPT circuit uh which stands for local Patricia tree circuit uh you need to verify the macro proof for each read and write to your storage and account balance space and then finally when you process the transactions you also need to verify that transaction you execute is a valid transaction that means that you need to verify the transaction hash is correct and I need to verify your signature the the ecdsa signature of your transaction is also correct and then we also know like Instagram using the cash function to process the uh to compute the transaction hash so you will also have an individual capture hash circuit to verify the cash check is calculated correctly so like that there's also a few other circuits inside the ZK event and then when you bundle everything together then you get your ZK evm that can fully verify all of the transaction happen inside the layer 2 is correctly executed now like let's say like if we have the ZK even how can we build the zkrop how do we build a zika infrastructures so let's also start from some simple example so in the layer one the things that has become more or like a straightforward so the user just sending a transaction to the sequencer and the sequencer will do some ordering of transactions in the mempool and process the Box uh in the in the layer one also like the I'm probably oversimplify this like you will have also consensus layers that do like more complicated things but like overall like the processing is like just having a single sequences now what happens inside the layer 2 is first stack is more or less similar to the layer one so you have a sequencer that have like executed so process all of the transactions then I can use the users like can submit the transaction directly to your Layer Two sequencers but it can also submit any transaction from layer 1 Bridge contract for any deposit or any enforced transactions that will go through the bridge and then so in the layer two sequence you you need to build a watcher to watch any deposit events from the layer 1 Bridge event Bridge contract then if you want to put up like a draw up so that means like for a row up you need to send all of the data like all the layer 2 Data is to be available on the layer one so anyone else can recover the latest status by just reading the data from the layer one that means like the inside the sequencer you need to have a roll-up agent to send any data like in batches to the Rob contract that's located in the layer one and then like if you want to put the SDK evm or like if for Optimus Drop Like You will have some flaw proof so in the zika evmk stack you have a an action node called approver so that's going to generate like running the ZK evm circuit joining the proof uh and then sending that back to the Rob to be verified and finalize any like batches any transactions and blocks happen in the layer tools and why the proof is has a separate node is because like running the the ZK approvers is like a very heavy uh computation workload so it means that you have like some dedicated a beefy servers running either gpus or a very busy CPUs or even like in the future they will be having some ZK accelerators A6 to run like that to uh to generate the proof within a small amount of times and then inside the scroll we also come into decentralize that means like uh then we have like a decentralized proofers that go into like the generators proofs but we don't need to have all the proofers like inside school like to compete for each single slot but you can randomly select a few slow a few proofers so for availability and then they want any of them like the channels uh a valid proof within the time limit then they can still like the data can still process and be finalized on the layer ones and then like even more complicated like when you decentralize both approvers and the sequences then you need to have like a mesh Network between the layer two sequence and the late uh the approvers and for that actually we are still like working on some research ideas so how to decentralize both of the uh two uh sequences and improvers so if you are interested like how fast you can also come and work with us or like just contribute and think about that we are happy to collaborate with any community members okay so that's like about all of our challenges we have so what's our next step and then I think we already have our Alpha test net and then the next step is go to the mainnet so uh so we have like some road maps Circle we need to finish before we go to the minute so first of all to be uh fully transparent so the uh so the ZK email circuit we're running like in the alpha test net it's not like very complete so I have like a missing a few tiny things one is like there are a few uncommon errors uh in the in the evm we haven't fully constrained and then we also like uh we'll add like a pre-compile support all the pre compiled contracts in the ZK event circuit and already we are already having a lot of things like work in progress we just are committed to finish that within like the next uh next like a few weeks and then we are going to do like going to auditing like we're going to order the ziki even circuits the bridge contracts and the loading implementations and I will also apply some of the optimizing ideas we have like to further reduce the proof generation time and then the proof generation uh requirements and what's beyond the minute is like we're going to commit to do like this trying to decentralize our approvers in the beginning and then to decentralize the sequences and then trying to build like a fully censorship resistant uh decentralized uh zkevm mainnet okay so this is last lecture so so helpful we are happy to have like more people to help us contribute to scaling exam uh you can join us I can you can have the hiring page and you can also join and play with our pre-alpha test net and enjoy our Discord to participate in it like if you have any questions you can join our Discord we'll have people to support you all right thank you foreign [Music]

Automatic transcript — names and jargon may be misspelled.