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

Loading player…

MetaMask 🛠 Build with Linea: An L2 crash course - Emily Lin

ETHGlobalMon, Oct 9, 2023, 12:00 AM

Join Emily Lin from MetaMask for a workshop titled "Build with Linea: An L2 crash course". Thank you to everyone who joined our first in-person appearance in 2023! We are incredibly grateful for the support and contributions of all the hackers, tech mentors, judges, partners, and volunteers who made the ETHGlobal Tokyo event such a huge success. Without your dedication and expertise, this event would not have been possible. We would also like to extend a special thank you to the attendees who traveled from over 59 countries to participate in the event. Your presence and involvement made it a truly international weekend, and we are thrilled to have had such a diverse group of participants. With over 1070 hackers it was a pleasure walking into Toranomon Hills and seeing such a talented pool of individuals. With over 22 workshops, 9 talks, and over $375,000 USD in prizes we hope you enjoyed the weekend full of hacking, meeting all our incredible partners and learning from enthusiasts of the space. We are proud to have welcomed over 35% of attendees who were new to Web3. We hope this event sparked your interest in the world of blockchain and provided you with valuable insights and knowledge. We cannot express enough gratitude to everyone who contributed to the success of ETHGlobal Tokyo. We are already looking forward to the next event and hope to see you all there! 🎉🚀 ----------------- Follow us: https://twitter.com/ETHGlobal​ Check us out: https://ethglobal.co​m Email us at: hello@ethglobal.com

Transcript

foreign [Music] Emily I am the developer advocate for Linea azk roll up and here I'm gonna give a crash course on L2 so it's going to be high level but also low level and we'll see where we fall in terms of how much you understand what I'm saying um so I'm just gonna go ahead and get started there's a lot of information to cover um so first off from the start what are l2s if you guys aren't familiar basically um hopefully you've heard of these blockchain trilemma why is ethereum like it's a pick two situation right we have decentralization we have scalability and security we need to choose three what has happened is we've chosen as a community to focus on decentralization and security but we don't have that scalability access right so what that means is we are going to be pricing out users because of high transaction costs and slow transaction finality what does that mean Layer Two to the rescue so layer twos are specifically the scaling solution for ethereum what that means is we are decreasing congestion by pulling off the execution layer from ethereum and then creating that data and posting it back when I say posting it back I mean specifically this concept called Data availability so basically what data availability is is the guarantee that all this data is going to be published to ethereum so this is what powers trustlessness right so one common misconception is how many guys are like familiar with like polygon proof of stake right how many of you guys think polygon is a Layer Two okay actually nobody that's great um but like I think it is a common succession right they have their own consensus mechanisms they have their own like security flaws basically layer twos right now data availability is the key to defining the difference so that's something to think about um kind of an image of like we all love visuals so just to kind of show you what that looks like right is ethereum is uh the monolithic version is taking care of execution settlement consensus data availability it's doing a lot of stuff like I said again Linea or like Roll-Ups in general pull off the execution layer ethereum is handling settlement and consensus data availability how does it do this here's another really fancy visual um basically there are various ways to do layer twos the kind of willings winning solution for it is Roll-Ups so when a roll-up it's pretty self-explanatory definitely what it does is it rolls up all these transactions together and then takes that and then post it to ethereum once but how does it do this right so when we talk specifically about Roll-Ups there are two types ZK Roll-Ups and optimistic Roll-Ups how they differ is specifically on the proof verification part so the proof verification is basically telling you how do I know a theory like how am I proving that this data I'm proving uh posting is correct right um so now we're going to dive into oh actually I forgot about this slide to further explain Roll-Ups um it's composed of a few parts so we have the on-chain contract so you're gonna have a roll-up contract on ethereum that basically does the storage monitor States tracks deposits the second piece is the off chain VM so this is where that execution is happening and the third piece is you guys have might have heard of like operators validators aggregators sequencers that's a lot of words but you can basically think of them as the people who aggregate transactions and then post that on um specifically when I talk about sequencer that is a little bit of a second separate concept they are the ones who have like the authority of actually posting it um next okay so now I'm actually going to talk about optimistic versus ZK um so optimistic Roll-Ups basically um do uh prove verification by basically not proving verification what does that mean so they're optimistic because they assume that everything is valid um in order for it to be invalid somebody has to send in a fraud proof they say hey wait that doesn't look exactly right let's run a fraud proof If it is if it proves that it's correct then it'll post if it proves that it's incorrect then obviously that transaction is rolled back what that means specifically is this concept of a challenge period right so in order for a fraud proof to be submitted or like that transaction data to be posted we have to wait seven days basically to give time for fraud posts to be submitted um there are workarounds for this so something you might have heard of with regards to optimistic Roll-Ups specifically is something like a liquidity pool um so that's basically kind of a separate entity that says like we'll actually just verify it all for you um if you want to post it and withdraw your ease immediately um from the L1 we can do that for you the only issue here is like that doesn't really address the issue of like nfts the other piece is that is another like kind of hackable element if you care so liquidity pools is something you might hear as a solution for the challenge period of an optimistic roll-up I don't think it's foolproof and that's why we're going to go into ZK Roll-Ups so ZK Roll-Ups essentially basically instead of waiting for a fraud proof to be submitted we um I guess Pro actively submit something called a validity proof so what that looks like specifically if you go back to this side right here the proof verification is done via a zero knowledge proof so if you guys have heard of zero knowledge proofs it basically means proving the correctness of a statement without revealing the statement itself I want to step in here again in case um you guys are a little I have heard a common misconception with ZK Roll-Ups specifically I think when people think about ZK they think about scale uh privacy a lot and they're like oh all this is um but there's a difference between a privacy solution and a scaling solution so ZK proofs are using we're using it specifically to like keep the data small make that faster that's for scaling that's not the same thing as a ZK proof for like obscuring your information so those are two separate things we are a scaling solution so I want to point that out the other piece about ZK proofs that makes it really cool specifically is we think about your you can there's a concept of like recursive ZK proofs so essentially with a ZK proof you can have like this information and you can actually put a ZK proof on top of that and make it smaller and you can put a ZK proof on top of that and make it smaller right so there is like what you could call like infinite scaling that is enabled by a ZK roll up versus an optimistic roll up so when we talk about ZK Roll-Ups we want to dive in a little deeper so there's this concept of the ZK evm and so basically like this is executing um I guess solidity or like evm by code and what does that mean specifically so vitalik put out this article um of four different types of zke EVMS so when you think about the roll-up space you might have heard a lot of things like there's like Stark net um what else is there in the ZK sorry ZK sync I am part of Linea polygons UK VM scroll there's a lot how do they differ from each other is specifically in the ZK EDM portion so at the highest level we have type four so Type 4 is language equivalent it is not bytecode equivalent so basically what that means is you will be writing in solidity but that will compile into something that is not readable by the evm like the ethereum virtual machine as we move further uh down I guess further down to number further up this um I guess table we have type 2 evm equivalency so that's basically it is language equivalent so that means you can write like solidity everything is going to be directly portable from ethereum to the layer 2. and it is also bytecode equivalent the difference here specifically um is you can think of like pulling uh being farther away from the evm I guess is a bet that you know evm uh I guess inherently is not super compatible with proof like ZK proofs so performance is not as easily achievable whereas type twos and then type ones which are fully ethereum equivalent then you're thinking about like the easier it is to interact with the ethereum ecosystem the easier it is to have the network effects of all the tooling that's already been created around it um like everything you know that has already been built around ethereum works out of the box right and so that's the really strong point this is kind of like a that's the win versus I guess a type four um and I'm not going to read everything on the slide but it's just kind of the graphical representation of what I was talking about versus compatibility and performance um so I4 uh the least amount of compatibility or it's on the side Type 4 but the highest performance as you go up that's that cool so now that we kind of have a basic overview of how evolved that works what it means what is linear specifically um so just fast facts Linea is the product of four years of research and development at consensus it's actually pretty interesting when we first started we were thinking about um I guess Payment Solutions like Anonymous Payment Solutions uh the idea that ZK proofs could be applied to scale was actually just kind of no one thought it was possible so we're doing a lot of ZK proof research and then through that research we realized actually scaling Solutions are possible with ZK proofs um and so that's kind of how Linea first got started the other piece like I said uh we are on the way to type 2 zke evm equivalency or type 2z kedn which is evm equivalent right now we are at type 3 you can think of that as more of a transitionary stage when we get to mainnet the goal is to be type two um the other piece is we are powered by an award-winning prover so when you think about like the technical um I guess underpinnings of how linear works we want an award that's pretty cool and the second piece is we actually are very new as compared to the other ZK Roll-Ups that exist in the space so you might think like uh I think polygon recently came out with mainnet uh we actually just opened public test net March 28th so that was like three weeks ago I think or less than three weeks but in that a little amount of time we have like a lot of activity right so I pulled this this morning we have over five and a half million transactions uh 560 000 wallet addresses a lot of deployed contracts I just guess for comparison um I think polygon might have like less than a million transactions right now uh there are different reasons for that I can get into later but there's been a lot of activity there's a lot of real big assignment excitement like why exactly is that like why are people so excited about Linea so I'm going to dive into this portion of like how do you choose where to build um well the first piece is there's a lot right like I mentioned I was naming all these eks there's actually more than this there's more optimistic Roll-Ups things are developing how do you choose um when I think about what I build uh and why I care about a roll up there are a few factors that I'm considering right so I think the first thing that people consider is like the reason I'm choosing a roll up is because I care about finality and gas fees right so speed of the roll up um how cheap it is stuff like that um but the next piece is you want to think about liquidity right so how much like liquidity is on that protocol so if you're focusing on building like a D5 dap for example you want to think about how much transaction volume you can get from there evm compatibility slash equivalents so this is where I was talking specifically on like whether or not you want to leverage the network effects so specifically with like Linea for example um because we are evm equivalent nothing changed in terms of when we were bringing on Partner dapps literally all they did was just redeploy right because nothing had to be changed if their code is written in solidity it should work on Linea the other piece is users so when we are thinking about building a Dap You obviously want people to use it so how many people are actually building or like I guess in transacting on that L2 the other piece is security so I think this is kind of where the reason people might focus on optimistic Roll-Ups versus EK Roll-Ups often Mystic Roll-Ups have been around for a while so you could say they are battle tested to an extent VK Roll-Ups are a very new technology are there going to be bugs probably we've only been around for like three weeks um in a public test net wise but but you know something to think about I don't think um I I think this will be a solved problem but um we'll see and then the second piece is future proof so I think this is kind of where I'm talking about where do you think the future of this um roll-up will go um you know like is that evm equivalency super important is it going to be able to be fast enough um the other piece is like is that ecosystem just going to be supported in the long term um other things to think about so I mean like I said I think for the most part ZK Roll-Ups have won against optimistic Roll-Ups I spelled optimistic incorrectly ignore that but yeah um I think specifically when I talk about the differences between the ZK roll-up on the Linea side um The Vortex is our prover technology so when I talked about how you know you might think about a Type 4 being able to be more performant more easily our assertion is like actually our proofer Tech is gonna be fast enough you have a confused face maybe that's not true but like that's our bet no but anyways what does that mean exactly so this is kind of like the a high level of what it looks like so I'm going to name these important parts I can't explain them uh directly but basically we have arithmetization so you can think of arithmetization as taking like all the tape proof can actually prove it um the inner proof system is kind of where that proving is happening Arcane and Vortex is basically our Tech to recursively make that proof smaller and smaller and smaller so that when we submit it to that verification contract on ethereum it is as small as possible so it is faster and cheaper um that's my understanding of this if anything is incorrect I will let you guys know when I talk to our researchers um but yeah so this is also just like another slide of what that looks like it's very complicated but basically what you can see is the language equivalency versus the by code equivalency and how that compares to ethereum um so that's kind of all of them but they're all really good in smart projects so I'm not here to say what is better than the other um but specifically why Linea um like I said so I think we have the basics of a roll-up right cheaper faster secured by ethereum when we talk about ZK versus optimistics we don't have that challenge period um zero switching costs so that's when I was talking about being able to take advantage of the existing ethereum tooling system um something I want to speak to specifically um and I think this is kind of in line with how future proof you think it is with Linea um the Linea girly or Linea is a default Network on metamask so right now when you deploy to other networks right now you have to go through the ux of like hitting add Network manually finding that RPC information adding it all there user ux is gonna be smoother we live in the same company as metamask so there is a partnership in that sense of we're very close to like the most popular wallet in ethereum or in web3 but yeah um that's that the other piece I want to know as well I think there is a lot of what you call it people like to fight between l2s I don't think that's necessarily true so something we are exploring is something called the multiprover theory so like I said before like things might have bugs right so at the end of the day like we're sending it through approver if that prover has a bug in it that's problematic right so what the multi-prover is saying is we're actually going to send it to multiple approvers so scroll linear polygons like people were talking to if there is a consensus on this is true we've verified it in three different ways so that is a lot more secure than for example if Linea was the only L2 that existed in the space um and so this is what I say when like you know we're competitors but actually it's very important that we collaborate so yeah that's kind of the future the other piece to this too I guess a sneak peek right we are in L2 but we are thinking about like building l3s in the future um that could be anything from more specific like app chains um to again doing that recursive proof so that it is faster um the definition of an L3 is actually still in flux which is pretty interesting so keep an eye on the space um but yeah so actually what is the look to build on Linea I think the Wi-Fi is really bad so I'm not going to do this live but the first thing you need to do is actually get linear e let's see if I can access if it'll go oh okay I guess so yeah I mean basically what happens is you're going to need to bridge eth from Gurley test net over to Linea so this is kind of um I hope you guys know how to use a bridge but you can just think of it like this and then send it over um if this is not working like I think it will work you can come to me I have 2 000 lineage so I'm happy to share but definitely like try out our Bridge um but yeah so the first thing you need to do is get linear ease to actually transact the next piece is going to be choosing where you build your smart contracts so I have an example specifically for truffle Foundry and hard hat but because it is evm equivalent by code equivalent you should be able to use Like Remix brownie um I don't know what other people use but like wherever you build that's where you choose so specifically uh with truffle so to actually I can I can probably do this uh let's try this so um let's do a truffle a knit project oh I'm in a project already whoops okay truffle init project code project and I don't have any demo code in here actually so pretend I opened this and then whoa I added all this stuff amazing wow what does that look like to actually deploy um so to deploy and I'm gonna show you what this looks like actually oh I already opened it uh so here's truffle dashboard running if we go to truffle dashboard specifically you can choose what chain to deploy on on metamask uh uh I chose Linea if you wanted to play in Girly mainnet Etc you can do this all here I'm choosing to use dashboard because I don't want to expose my private key to you um and then you can just do a truffle migrate Network dashboard uh and if the internet works something should show up I don't know if it will so I'm just going to show you this is what it looks like um it actually sends in the transaction you just hit approve and then it spins uh with hard hat actually you can also use the dashboard you would just fit it in here and then deploy uh with npx like hard hat Dash deploy RPC like truffle dashboard with Linea specifically this is our RPC endpoint rpc.early.lineia.build we are permissionless public test net right now so that's how you would do it have any of you guys actually deployed a contract before oh actually most of you haven't damn I'm just saying stuff as if you understand yeah um okay I will briefly touch on contract deployment so essentially you have various tools so like I said truffle Foundry hard hat that help you manage the deployment process so that's going to be writing it and then giving you the opportunity to deploy to a network configure what those networks look like so if you want to deploy to multiple networks that would be part of like a configuration that you add to your truffle hard hat or Foundry project the other piece is like it offers testing functionality specifically when you choose where to deploy that's kind of where this network configuration comes into play if you guys have deployed a contract before what it looks like is this URL will just be replaced with like early test net will be replaced with mainnet will be replaced with polygon what we're saying here is actually just needs to be RPC dot gurley.

lineia.build it's exactly the same you don't have to change any facility code so that's when I'm talking about stuff like starknet for example they are building in Cairo so you will have to write a different language and then do it differently but with Linea you can do this [Laughter] yeah okay cool um and so Foundry is kind of how you use that too I would be Pro to explain all of that so anyways talking about how you can use Linea in your project so basically we have a very open-ended Bounty basically all you need to do is Deploy on linear so whatever smartcraft contract You're Building um just go and change this address to linea.build show us the actual deployed contract on the Explorer like the blog Explorer and then that's all the proof you need to actually and then one more thing um put keep calm and love Tokyo on your GitHub repo so that we know you actually read these instructions but um otherwise yeah it's super simple I highly recommend doing it um basically whatever you build should be able to be deployed on Linea so yeah um this is kind of information I have quick starts on actually the full deployment process of like how you set up a project and then actually write a contract and then deploy um I'm sorry I just assumed everyone was already a smart contract developer that was like very bad of me but um hopefully you guys will try it out and that's all I have to say ah does anyone have any questions yes more of a general question about LT is no specific about linear on the roadmap for ethereum uh for essentially vitalik's whole vision is to bring everything onto l2s and whatnot and the first step was that all the Roll-Ups are being stored in the call data that the first step would be actually making the call data size larger I'm still trying to ride my head around as to how increasing the size of the call data translates into directly the throughput like the TPS increasing if you know about that that actually surprises me too that you would want to expand the call data I don't know I have three very good friends who are like the experts in the room do you guys have any idea if not I can write down your question and then take it back to my team call data can be treated as a data availability space and by expanding call data you this was like the simplest way without any any more complex Solutions on ethereum to just give more space for storing the the proofs you are sending the proofs through the call data instead of storing them in the storage on ethereum you were just passing them in call data because it didn't really need to store them on storage but instead now for the 4844 on ethereum you providing additional space for data storage that is outside of State outside of call data so instead of creating that in the transactions you created only separate transaction type so so it's like continuation of the same thought process it'll like give more call data but instead you're providing like this specialized blob transactions that only have called data and only care about that but they are quite big and they have different roles of propagation so this is scamming potentially in uh most likely in Cancun extension in few months in ethereum yeah thank you thank you very much bull so that's my presentation let me know if you're building on Linea I can help you with solidity development I can't help you with call data explanations but uh that's where I am okay have a good hackathon

Automatic transcript — names and jargon may be misspelled.