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

Loading player…

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 us for ETHGlobal Lisbon! After being away from Europe for almost a year, we've decided to bring the heat and excitement back to the stunning historic streets of Lisbon! All over the world, hundreds of thousands of developers, users, hobbyists, creators, artists, and market makers spend their days and nights thinking, building, talking about Ethereum because we are... excited. We're excited by the idea that Ethereum can change things. This May, we invited you to come learn what all the talk is about. We were joined by the leading teams in the ecosystem such as Polygon, Metamask, Aave, 1inch and Gnosis Chain who have a number of prizes up for grabs! This event is focused on building a new product/protocol, learning at the summits through talks and workshops, and giving opportunities to gain valuable feedback from ecosystem champions at the beautiful Convento do Beato. Find your future team at our Hacker Café and create even more meaningful connections while engaging with some of the most notable speakers in the industry at Pragma Lisbon. At ETHGlobal Lisbon you'll have the support of a huge community of experts, mentors, sponsors, developer advocates, and other community members who want to help you build something awesome. ----------------- Follow us: https://twitter.com/ETHGlobal​ Check us out: https://ethglobal.co​m Email us at: hello@ethglobal.com

Transcript

foreign [Music] hi guys I am Emily I am the developer advocate for Linea so Linea is a ZK roll-up I'll be going literally from Ground Zero all the way to light let's talk about arithmetization what does that mean so uh let's get let's break down the second right Linea will be a type 2 ZK roll-up what does that mean so starting from the literal base level right so blockchain trilemma is essentially the a pick 2 situation right so you have scalability decentralization and security um essentially you have to pick two of the three right so in the case of ethereum what they've done is they've chosen decentralization and security what did this mean then if we're sacrificing scalability that is what causes um High transaction fees as well as like uh what do you call it uh slow speed right so how do we fix this um moving forward this is the layer two solution so we've started from the ground we are going one layer up well actually I guess one layer off from blockchain trilemma though now we're talking about layer one so layer one is the underlying foundation and base blockchain right so layer ones take care of your node operators The Producers um the transaction data and the consensus mechanism so examples you might have heard of Bitcoin ethereum I hope you've heard of these Avalanche Etc right and so when we go into Layer Two so Linea is a layer two this is a completely separate blockchain right so this is the part where we're solving scalability um one thing to note specifically is this piece of data availability right so the way Roll-Ups work is they're going to roll up a bunch of transactions and the thing that makes them different is they actually post that transaction data back to ethereum so something people often get confused by is like if you've heard of polygon polygon is a side chain so polygon has its own consensus mechanisms that data is not posted back to ethereum so you're not deriving it security obviously this has changed now with polygon zke EDM that is a layer two but polygon proof of stake is not a layer two um so that is basically the layer two solution um there are multiple different implementations of layer tooth but right now Roll-Ups are the most popular um so now now that we know what layer twos are let's actually get into the roll-up space right so what exactly is a roll-up what is it made out of so roll up has a few different components the first piece is they have an on-chain contract so this is a roll-up contract that exists on ethereum this stores the roll-up box mounted here's the state uh tracks the deposits I'll get into deposits and withdrawals later you have the off chain VM so like I mentioned before roll ups layer twos help with scalability the way they do this is they take the execution layer off of ethereum so they do all this through the off chain virtual machine and the last piece is like it's a bunch of things operators validators aggregator sequencers but essentially you can think of them as the people who take all the transactions and then publish that block so this is the anatomy of a roll-up um like I said I was going to touch on deposits and withdrawal so this becomes extremely relevant when we start talking about optimistic versus ZK proofs right so at the transfer process the way Roll-Ups essentially work is you basically lock up eth on this roll-up contract and then equivalent amount of eat is minted on the L2 so then that's when you start using lineae um or I guess like uh scroll eth or whatever eth on that L2 the other piece is when you go backwards so now it's like I've done all this stuff on Linea I actually want to withdraw it back on ethereum what is that called it's called withdrawal the way that works is it's brought onto the um the Ethan the L2 is burned and then released to your account this is super key when we start to talk about optimistic versus ZK Roll-Ups so now let's talk about optimistic Roll-Ups right so with Roll-Ups we're posting that data back to ethereum what does that mean is before we do that ethereum needs to know whether or not this is true or false right so there's different ways of doing it optimistic proofs are optimistic Roll-Ups to use something called fraud proofs so here specifically they're called optimistic Roll-Ups because they just assume it's valid that is a less secure trust assumption the way they get around this is they say hey there's a seven day challenge period right and so in seven days someone can post a fraud proof to say hey this doesn't look right let's prove it true or false and if it turns out to be false that will be rolled back if it turns out to be true it will be pushed down so again like this is really problematic for immediate liquidity right because of that challenge period there are existing Solutions like trusted bridges that will do that immediately for you the problem again is like this is a bridge the other pieces they haven't solved the use case for like how do I immediately withdraw like an nft for example um so things you have heard of are like optimism arbitrim bass which is like felt on top of optimisms like super stack so now we're talking about zero knowledge roll up so this becomes relevant for linear right so instead of using a fraud proof you're using something called a validity proof specifically when we're talking about zero knowledge Roll-Ups that validity proof is a zero knowledge proof um they don't require a challenge period that information is essentially set into that proof generated and then submitted down um I want to know when I talk to a lot of people who kind of aren't familiar with the space they hear zero knowledge and they immediately think privacy that's not the case Zero knowledge proofs in this case for Roll-Ups are just helping for compression of the data whereas zero knowledge in other cases that's going to be a privacy thing so don't get the too confused I can talk about that a little bit like offline or you can ask a question later but examples include like obviously Linea but ZK sync polygon ZK EDM scroll and Stark net so now we've covered you know layer twos roll up zero knowledge what do I mean when I say A type 2 ZK roll-up so first off we need to talk about what is a ZK EDM so zke EDM is that virtual machine that will take that smart contract transaction utilize the ethereum infrastructure and also translate that into a way ZK proofs can understand so this is actually when I talk about arithmetization this is also why ZK like Roll-Ups came out after optimistic rollups right because ultimately what a ZK proof is a math proof how do you like translate um what do you call it computer programs into polynomials that math can prove that's really hard right um and then alongside that like ethereum itself is not very compatible to being able to translate into these math parts so this is where the ZK VM comes from this is where we also start to have the different types um so I'm going to touch on the different types so at the highest type that's a type four this is high level language equivalent so for those of you who are ethereum devs that's going to be writing in solidity that's writing in Viper this is actually going to be written or compiled down into kind of a different VM right so it's not byte code compatible what this means for you as a developer is your tools will change a little bit so how many of you have deployed a smart contract before okay so most of you right so you might be feeling a little like hard hat Foundry stuff like that they are not natively able to handle a Type 4 zke EDM the work around there is these people actually have plugins so you might have seen like a VK sync hard hat plug-in right um that is because they are not byte code equivalent their thesis is like hey actually ethereum is not great for ZK proofs we're going to be faster because we're changing it right um the next piece is Type 3 is kind of a transitionary stage this is where most of the type 2 Roll-Ups are right now and so by that I mean um Stark or not let's start that um ZK polygons linear scroll are all going for type 2. so what that means is we are language level equivalent we are also byte code equivalent right so we are the closest to ethereum which is a type one um then I guess if you say as you go farther away so in terms of like I think the thesis of people or the projects that are chasing type 2 ZK edms is you're taking advantage of the existing developer tooling space you can change the fastest as ethereum changes because it is constantly changing right um and yeah that's kind of the different types so um kind of in the sphere of is it still not okay um cool you can pretend that you saw this oh yeah okay whatever it's there nope well hopefully you have good memory so you saw what that meant but it's basically a grasp of I guess compatibility versus performance right so the assertion is essentially the less compatible it is the easier it is to make it performant the more compatible it is it is harder to make it perform it that is true I'm going to say um I think within the ZK space like the tech is changing I don't think the assertion that being farther away will make you faster um so I I mean like if you just take social proof of like people didn't even think ZK Roll-Ups could exist we are the place where people are building type twos um there are projects that are also building type ones um that's not the case anyways uh I'm gonna move to the next slide and you're not gonna see it which is really sad because I have another really cute Kermit GIF but essentially the slide says the same thing from the beginning Linea will be a type 2 ZK roll-up hopefully all of you know know what that means now right um and so now I'm going to talk about exactly like what Linea is specifically right so Linea is the product of four years of research and development at consensus we actually started out just doing like ZK for kind of like uh what do you call payment privacy and then kind of as we were working on that ZK uh research we realized hey actually the tech we're building is really compatible for Roll-Ups um and that's kind of how we moved into that space like I said we are on the way to zkevm it's really interesting because our approver is powered by an award-winning ZK circuit Library called banark it is open source it's used by other projects as well uh we win public test net in end of March at this point we have over 11 million transactions uh one million wallet addresses 196 000 deployed contracts so the engagement is huge right um and and cool so kind of like that's the overview of Linea kind of where you build so I think something I get a lot is like there's so many Roll-Ups how do I choose right so there's a few factors to consider right so the piece they said finality uh how is that transaction when can you withdraw it um that's the optimistic versus ZK kind of question right so challenge periods optimistic Roll-Ups have that that's not the best thing for immediate liquidity when I talk about liquidity it's like how much people have like already bridged onto the roll-up so my users who are on the roll up already how easy is it for them to get stuff and interact et cetera now the other piece I said is Network effects so this is a lot more so in the sense of as a builder um how easy it is for you to basically develop adapt there is a really robust ecosystem around ethereum already uh if you've heard of projects like starknet for example that start off in Cairo that creates a whole new world where someone needs to learn Cairo to do smart contract security auditing uh so what we're saying right here is like EDM equivalence compatibility I think that's the winner of something to think about uh the last piece is users oh I have two lessons users so how large is my addressable audience so as a like entrepreneur like I obviously want to go where the most people are right so that's kind of a thing to consider and the last piece is security I think again leaning back on trust assumptions optimistic Roll-Ups aren't as trustworthy I'm not going to say that I feel like that's really spicy awesome thing about it the next piece is you know when we start to talk about like centralized sequencers versus decentralized sequencers you know where does that fit into the security narrative I'm not going to dive into that because we're talking about how to build but essentially kind of how does Linea fit into that system those images aren't sitting up exactly but essentially like I said zkdm type 2 you I've covered why that's cool I think the last piece that is really interesting about Linea specifically so when we tie into that part about liquidity and user base right Linea is a consensus product we sit within the same ecosystem as metamask inferior like diligence our own like eth clients I think that piece with metamask is incredibly interesting as like an L2 proposition is we are there already being able to take advantage of the benefits of the most popular web3 wallet right so when you think kind of to the Future in that sense I think that's the highest value prop in what we offer um please tell me if you guys actually care more about how the prover Works than like how big the audience is because that would be a really interesting conversation but anyways La Thief I guess is I kind of wanted to go over what that looks like specifically when we talk about language equivalents by code equivalence and then BM so as you can see the farther you get away the little bit is different um ultimately this is kind of where the type twos are living um and the last piece then is like I said on the linear side um we actually don't think type fours will be the fastest um so circling back right type four is their thesis is we have to depart in order to be fast um I think Linea what do you call it our Tech right now this we're really focusing on the arithmetization part um so the cool thing about ZK proofs especially in comparison to optimistic proofs is you can put a ZK proof on top of a proof on top of a proof on top of a proof and make things smaller and smaller smaller right so you get infinite scale with ZK role of so recursive ZK ropes as compared to like a fraud proof for example so there's really interesting use cases there um so our thesis is not necessarily that um you have to make that decision between Type 4 and type two uh so we're going to get into the section of actually how to build on Linea my Wi-Fi has been kind of funky so I'm not going to do this necessarily live but I'll just show you kind of the different ways to do it um the slide didn't immediately change oh here we go so the first thing you need to do is get Linea East so there's a few ways to do it you can Bridge it over to lineup Gurley East to Linea the other two second method hasn't come out yet but we are building an inferior faucet to drip test if directly onto Linea the third method specifically for you eat Lisbon Builders out there is I am a Linea eth whale so please feel free to leverage me as your faucet you can find us on Discord reach out to me afterwards I will literally send it to you right now um Emma's over here he's BD at Linea he also has a lot so take advantage of both of us yeah yeah but only at Lisbon if you talk to me afterwards I'm just kidding I'll always be nice to you but essentially like when I talk about the ease of use with a type 2z Canadian it's literally just swapping out your RPC right so when we talk about um truffle like that's a smart contract tool um if you are starting with truffle I recommend using their next JS box it's basically a fully full system of smart contracts connected to a front end with tests and everything the only thing you need to do actually maybe I can demo this I'll show you yeah okay is this big enough okay so uh so this is truffle dashboard um you can use this with hard hat as well uh let me open up code uh Dev slash Linea demos is this where it is I don't remember um I'm just gonna say it was here okay no I don't know where I'm at right now uh so I'm just gonna exit out here do this first because I know where that is okay here's the terminal so I'm gonna do a truffle Dash board here is the thing so this does deployment through your metamask wallet if you wanted to deploy on girly you would just use girly in this case you can just switch the network over to Linea um I need to click to connect uh and the difference here then would just be CD truffle and then truffle my great Network dashboard [Music] so this is cool because I didn't have to show you my private key at all to deploy which is really nice this is also usable with hard hat but as you can see the difference between Gurley and linear was literally just switching your metamask wallet right so when we go back to kind of the different tools um the same thing I don't know how many of you guys use scaffold eth it's pretty common I think for hackathon devs literally just changed the default Network oh all the screenshots aren't showing up okay I can try and open up the code we'll see if it's working [Music] um yeah okay so basically this is the scaffold yeast repo uh you just change your default Network like girly versus Linea or something you just swap out the RPC URL so if you look at the girly one this is what it is that's a fake infuri API all I did was say hey now let me rename this and that was Deploy on Marquette um so kind of the same thing you can do dashboard with hard hat if you want and the last piece is Foundry download it again wow so easy you just swap it out damn no one clouds with me that's really awkward foreign cool okay so anyways uh feel free to get in touch there was a QR code with my information but that's fine um let me know if you have any questions I can and I don't know if I have time right now okay I have I have like 10 minutes for questions so we can talk privately um but yeah that's my information feel free to message me for Linea e if you are hacking uh we have a bounty specifically that says just Deploy on Linea if you're deploying a smart contract swap out the RPC ask me or Emma for some linear Ethan you should be eligible so yeah that is it thank you so much for listening I hope you learned something today are there any questions what what's going on no questions okay we are good thank you so much for listening I wish you the best of eat Lisbon I hope I recognize your face during judging okay foreign

Automatic transcript — names and jargon may be misspelled.