Scroll 🛠Get started with building on Scroll
ETHGlobal·Wed, Oct 9, 2024, 12:00 AM
A Scroll workshop! Embark on a journey with ETHIndia, where innovation thrives, collaboration knows no bounds, and hierarchies fade into self-sovereign ownership. The most skilled web3 developers, designers and product builders from all around the globe came together for a weekend-long adventure to advance the Ethereum ecosystem at ETHIndia in December of 2023! ----------------- Follow us: https://x.com/ethglobal Check us out: https://ethglobal.co​m Email us at: hello@ethglobal.com
Transcript
[Music] hello thank you everyone for joining the scroll Workshop um just as a heads up this is kind of a beginner level workshop for really introducing the idea of what a layer two is what a rollup is and how to really get started with scroll deploying contracts um and hopefully just better understanding what ethereum needs to do to scale and how to scale securely I'm Daniel Helm I lead the developer relations team at scroll uh if you want to find me on any socials anything else DG Helm down here in the corner so agenda we're going to talk about ethereum having a scaling problem we're going to talk about what scroll is building to kind of solve that we're going to talk about deploying your contracts on scroll and then of course prizes additional info relative to the hackathon but I'm going to leave this up here for a while I will show it again at the end of the talk it is a QR code to get you in a telegram group for hackers uh we also have a faucet bot in here so you are able to show up say drop your address and you'll get some uh scroll sapoia eth to get started hacking uh which is the first step so all right so let's talk about scr if you show up on the scroll website you've never heard of us you're going to see that we're seamlessly extending ethereum's capabilities with zero knowledge Tech and evm compatibility and L2 Network devs devs scroll Bridge a lot of jargon right you see this you don't understand what some of these things mean it might make you feel a little bit like this but if you walk away with one piece of knowledge from today's talk is that for users and devs scroll is pretty much ethereum right like the experience pretty much ethereum and I'm going to show you quickly what that looks like we have a clone here of Unis Swap and we can see that I'm logged in with my wallet and I can get in here and grab some go swap SW that for ethereum see what my best price is here great we're going to swap this thing and if you've used Unis swap before this should be a similar experience right your metamask pops up you confirm the transaction you've done your Swap and instead of waiting 12 seconds for an ethereum block you wait 3 seconds for a scroll block so that's the idea of what it looks like to use the ZK evm let's get into talking about like what it actually is though why we're building it um and yeah so anything you're using on scroll uh like all these projects that are deployed either to our test net or our main net which came out about a month and a half two months ago should all have this similar level of experience for you but let's talk about blockchain scalability we are all here because of the beautiful promise of ethereum we are a platform for decentralized application it's a single Network where you share code and data you create all these new possibilities it's open to all and anyone can join in just not too many people at once right if too many people try to use scroll at the same time you see a situation like this you go to Mint your nft swap your token and it asks you to pay $132 in gas fees right this is a mess this is not accessible this is not the ethereum that we want What's Happening Here well if you're unfamiliar we have this idea of an ethereum block and what we're doing is we're sting a transaction and we're asking the network to do some work and that's measured in gas each block can only do so much of this work and so the block the person creating the block is going to pick those transactions that are going to pay them the most to do that work we're paying the highest gas price this is the idea of block space and once that block space fills up once the block is full it becomes an auction and the price goes up right a a lot of hand waving here but that's the general sense okay so we have a problem we're Engineers we say let's make a better system then right so let's put our protocol designer hats on I think the first thing anyone wants to say in this situation yeah this is easy to solve we just make the chain do more work right just make ethereum do more work well let's remember how ethereum works right we have this decentralized network and we can imagine each one of these dots is nodes in that Network right as a transaction comes through every single one of these block or one of these nodes has to do the work of that block right they have to that verify what you know a transaction does and ver redo that work on the network so what we're actually saying when we say make the chain do more work is make every single node do more work right and for some nodes you know supercomputers with 10 gigabit Ethernet cables they're going to say yeah I can do more work this is no big deal but for maybe resource constrained smaller PCS people running things at home they're going to get priced out resourced out if we just try to keep cranking up the constraints or the requirements it takes to run a node and what happens is our happy healthy graph that looks like this gets a lot of people priced out which makes it more vulnerable to Bad actors right we don't want that what we're doing there is we are sacrificing decentralization and this is one aspect of what is get labeled as the scalability trilemma the idea of that is that when you design a blockchain you get to pick two of three things scalability security decentralization right and so in this situation we've cranked up the requirements for our nodes and this is typical of high TPS chains we have sacrificed decentralization for scalability and have maintained some level of security so solution two of our protocol designer right okay we can't make the chain do more more work but what if we just made a new network right so now we have our graph and we just say like all right let's cut a line down the middle we'll take all the nodes and validators from now one network we'll still call it ethereum and then we'll make another one ethereum prime and so now we have two Networks we've doubled up the amount of work that we can do without increasing the network requirements um but there's an issue here too right now we have half as many validators putting up stake half as much security there not to mention we have to figure out how to bridge the gap of this black line which is a non-trivial problem and then this is the idea of maybe the multi-chain ecosystems the sacrifice on security they maintain their decentralization and they scale this way uh but it's still not ideal so part two of this story is when we come in and save the day with l2s and rollups as we mentioned ethereum is this network of nodes doing a bunch of work and we're going to symbolize that as a big block here so uh I very mature Graphics thank you um we can think about this work as the block and we can break it into subw work right so maybe this top uh block up here is minting an nft maybe this is swapping our token these got things of smart contracts do on ethereum right now thought experiment what if we just dedicated a piece of the work that ethereum was doing and we just dedicated that to making sure that a different network was not breaking its rules that something offchain was not lying cheating or stealing and a smart contract was able to consistently verify that well this is the idea of securing an offchain protocol using ethereum so a layer two exists as its own offchain protocol using a layer one as an important piece of its architecture and we say that is deployed on top of it now rollups specifically use l1s to have certain security guarantees here from ethereum right we have to like really constrain uh uh the the some of these things and so we have things like ordering data availability censorship resistance uh State transition correctness like a rollup has to inherit all of these things to be truly secured and know that we're not lying treating and stealing as a protocol and rollups on ethereum we say that they inherit the security of ethereum the idea here is that when you use a rollup like scroll there are no additional trust assumptions beyond the trust assumptions you make of ethereum H and and this is a little bit of a bastardization of the of the tremma here but we can imagine this as ethereum really locking down the security side of this triangle and so we can say now okay we've got security locked down well now let's make a new network an offchain protocol let's crank up the constraints of it the the the resources of it will make the chain do more work and through that we can become more scalable while still building on top of traditional chains that are highly secure and highly decentralized um and this is uh my wonderful Graphics about l1s and l2s there are a lot of l2s in the marketplace you've probably heard of a lot of these uh and there they are listed on a wonderful site called L2 beat but coming back to our like protocol design game right we've said okay we're going to make a rollup this is good but like the rollup could do anything right we're just using ethereum to for the security but our rollup could do whatever we want well let's look at maybe Scrolls biases here we look at the situation we say ethereum already has this incredible ecosystem right you're here part of the ecosystem um and it also has all these Tech parts of its ecosystem it's got great tools educational resources wonderful users and communities and smart contracts that are ready to deploy so we're already inheriting ethereum security why not also just inherit all of this from SEC from ethereum and so as a choice we can say wherever we can let's just behave exactly like ethereum's virtual machine um the thing that does the work on the network so developers don't have to change change their mindsets learn new gas or anything else and that is kind of the basis in the idea of scroll thinking about how to scale ethereum uh in a a reliable way without being a bad developer experience so coming back to this model we can see that still we have this idea of you know ethereum doing work making sure that a new protocol is not breaking its rules um let's look at different ways you can do that so uh on the bottom here we have what we call optimistic rollups and what they do is they say here's all the transactions that came into my chain ethereum layer one let me show them to you and I'll just show them to you we'll sit and wait for seven days and see if anyone raises their hand and says no no no no no this is not how things are supposed to work we call this fraud proofs and it's this like economic incentive this game where you expect there to be one honest actor that's going to like say no uh uh you know the chain over here the off chain protocols lying cheating or stealing now scroll takes a different approach right what we do is we put all that data on chain um and for something that we call a ZK rollup right we are not an optimistic rollup we're a ZK rollup and um unfortunately this means I now have to talk about zero knowledge so let's get into part three zero knowledge proofs all right is everyone still with me we're going fast all right zero knowledge proofs here we go let's talk let's do another thought experiment we've got a lot of work we've got some input or data that we're going to put into this work and it is a lot of work it takes a whole host of supercomputers that we don't really trust to do this work and it takes days right and we can imagine we have a a magic wand and out of that work we can have a receipt for the work right um and and the receipt for the output of that work can be verified by one of these really simple Le computers and that simple computer doesn't have to go back and redo all the work of the super computers it can just verify the proof cryptographically and say nope I know I can guarantee that all this work was done correctly right this sounds kind of magical it sounds like you need to get in the time machine for something like this to exist and we do and it's back to 1991 when we had papers and constructions coming out like checking computation in poly logarithmic time this p has this like funny little line where it says in this setup a single reliable PC can monitor the operation of a her of supercomputers working with possibly extremely powerful but unreliable software and untested Hardware we do not trust the supercomputer but we can still uh Monitor and verify its output okay so back to our imagination scene here let's kind of like specify what this work could be what if the work being done was the evm the ethereum virtual machine right and it's doing work over incoming transactions and instead of supercomputer we have a really powerful blockchain Network called scroll right it's got a lot of resource requirements but that's okay because it will output a proof and that proof won't be verified by uh Raspberry Pi but instead by ethereum smart contracts right um that little bit of work on ethereum is able to verify all the work of a second ethereum doing more work than ethereum itself using zero knowledge cryptography and it can verify those proofs so that is the idea of scroll we are a ZK rollup and that thing onchain on ethereum is a ZK evm proof verifier right is sitting there constantly about every 20 minutes getting a new set of proofs uh o over the transactions that come in in order to secure uh scroll and to make scroll something that can be scaling ethereum um I won't get too deep into the transaction life cycle and everything else like that if you want to talk about it see it us at the booth but the idea here is that we can have a whole lot of blocks coming in every 3 seconds commit a chunk of that to ethereum and then later on kick off you know gpus producing proofs and then those can commit those to ethereum as well so ethereum's got all the incoming transactions that came into scroll it also has a proof that our state transition was done correctly so why build scroll for this hackathon well it's got great developer experience we are bu code equivalent with the evm which means that all your favorite tooling all your favorite tutorials open source contracts are good to go right you can copy have this phrase copy paste deploy that you might see around and that's the idea um you don't have to have any like hidden gotas as you're building with scroll it's got higher throughput it's got lower gas fees and your users are going to get quicker feedback because we've got 3 second block times relative to ethereum's 12C um and lastly I think U maybe this is a term that gets maligned a little bit but I think alignment here is pretty interesting like we are here not to just scale ethereum the technology but we take it seriously to also try to scale ethereum as an ecosystem ethereum is a culture um originally scroll you know its origin story was it was built as an open source project in collaboration with the ethereum foundation's privacy and scaling Explorations team and so um really building that out it is and I think core to our DNA um so done a lot of talking I think we'll have plenty of time to maybe ask questions about scroll but let's see what it looks like to deploy using scroll so let's go to uh open Zeppelin's erc20 contract and go ahead and just copy this you can Google search for something like this and if you're not familiar there's a tool called remix that the URL is probably too small to see but it says remix.to do soul and I will paste my erc2 my guess is when I go to compile this it's going to want a newer version I think it does so it wants me to try out uh 8.22 oops but now let's see if I can compile this there we go it's happy enough I've compiled my contract what does it look like to deploy it on scroll well as long as you have your metamask set up the scroll Network you can go to injected provider metamask it will recognize the correct Network in your current account and I can put my initial Constructor amount so let's just say that and I will deploy now we see we're creating the token it has to deploy put in a really high gas price but shrug give it a few seconds here and now we are deployed and we can see that down here I have a contract address and I can go to sepolia Dos scroll scan.com and check out the contract that we just deployed on scroll 24 seconds ago okay well a lot of you are not going to be using remix to deploy um so let's take a look at what this looks like using Foundry if you're interested I think the best way to kind of get started using Foundry hard hat other traditional Dev tools is to check out our docs at docs. scroll.
and we have um actually quick start links down there but down in the developer section we have a developer quick start and here it goes through how to acquire ether how to set up your network configurations for both main net and test net and then uh the configurations for setting up hard hat and Boundary um but I'm too lazy to look at the docs I like cheat sheets uh and so instead I'm going to go to something that we put together for eth India which is called eth india. scroll. systems there's also a QR code on the postcards that we have on our booth and it tells you all about some of the things going on there's a cheat sheet right here and it also has wonderful information about verifying contracts and settings for things like Forge things like Foundry uh and things like a hard hat rather so let's follow along with these a little bit I think I could go to um showing how to use this with Forge I could say Forge and knit and I'll say e India live demo and I will create a new Forge project here wonderful now I will CD into that and let's open up our code here close out the other one sorry okay this is very zoomed in but um when you init a new Forge project it actually comes with a soul file you can put whatever you need to in there but we'll just start with the default one but we want to go into this Foundry dotl file and modify our configuration just a little bit so that it knows about scroll and scroll sapoia and how to verify uh contracts using them so I'm going to copy paste these RPC endpoints in this ether scan configuration place it here in my found. Tomo file and save and so now I should be able to write Forge create we're going to deplo uh compile and deploy the counter contract for our RPC URL we just set one up for a label of scroll sapoia and that configuration file uh we want to verify this on scroll scan because that's part of getting your nice little Bounty uh and we'll also provide a private key I believe goes like this and I have set an environmental variable so you can't get my private key like that oh nice try let's try it again okay there we go now we've compiled and it's saying nothing is there so let me go ahead and do this huh live demo fun okay let me go ahead and just try one more for jit and try another one here saying um rough demo and then I can open up this again I want to take information in my Foundry dotl file to set my configurations and just try and run that same command as before Forge create counter the RPC URL and it helps if you have a space after scroll sapoia probably my issue so now we've actually compiled it and we can see that it interacted with ether scan and because it's actually already seen this contract because I've verified before before we even verified it it you know knew what this contract was um but you know we could go ahead and modify it if we needed to and um it wouldn't know what it was at that point so now we've modified that a little bit let's make sure we can actually verify on scroll Saia and it's doing its best now so let me grab this and we will open that up back in sepolia docrs scan.com and we can see that this contract has been verified and our modified code is viewable here and that's it so that is deploying on scroll should work seamlessly out of the box with all your favorite dev tooling any tutorials demos that you're used to so again we have a hacker telegram group I'd encourage you to scan that QR code ask for help here or in the Discord you can also get your sapoia test net eth or scrollo test eth uh by following the example of other people for how to grab it and again we have that cheat sheet and not only has information on deploying and verifying but also has information on every other kind of partner here at eth Global that is deployed on scroll sepolia so if you want to both Deploy on scroll and safe you can use those things together uh by grabbing the contracts addresses there that is eth india.
scroll. systems now for the prizes uh if you are engaging with this side of things uh we have two categories so one I just demoed how to deploy and verify a contract on scroll that would have put me in the $7,000 prize pool for doing that work if you are a newcomer to the space we welcome you gu something deployed build something this weekend um if you are building something maybe a little bit more complex Advanced uh you might want to apply for our best on scroll prize and we will have1 $1,000 winners for folks that complete this build something on scroll that we think is fun Innovative weird whatever uh we really like things that people are passionate about and and we'll have 10 of those winners for $1,000 so I think that's it for me but uh hopefully I left enough time for questions as well so cool see if I can mount like read read lips check one all right let's get some questions do we have a documentation for how to integrate safe with scrone I can't actually hear you I heard the word documentation oh safe yeah absolutely so let me pull up that cheat sheet again again this is eth india. scroll. systems it's actually SL Che sheet but there's a link at the top of that and you can see eth India partner Integrations we can go to safe and you'll see that we have a site that is like a front end for safe if you want to use that on scroll or scroll sapoia you can check out their docs um you can see kind of a demo using AA offit you have their factories their safe core protocol uh contract addresses and their transaction service API so I think that should be everything you need to get going there any other questions ready watch it come up it's always a good Workshop when Daniel help at the helm anyone else have questions why don't you come here so we can hear you better think there's no questions anyone raise your hand I can also come to you if you're shy and repeat the question any questions all right all right well let's rock and scroll thank you so much everyone come see us at our booth
Automatic transcript — names and jargon may be misspelled.