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

Loading player…

StarkWare 🛠️ Deploying on Madara

ETHGlobalWed, Oct 9, 2024, 12:00 AM

Join Lana Ivina of StarkWare for a workshop titled, "Deploying on Madara," which will cover running a Madara node, deploying a contract and interacting with it. This workshop is part of StarkHack 2024, a virtual, async hackathon with over $125,000 in prizes, taking place June 13 - 26, 2024. ----------------- Follow us: https://twitter.com/ETHGlobal​ Check us out: https://ethglobal.co​m Email us at: hello@ethglobal.com

Transcript

[Music] hey everyone and welcome to the star hack Workshop titled deploying on Madara joining us today is Lana who will be taking us through the session and with that I'll pass it over to Lana to get the workshop started over to you Lana um hello everyone welcome to the stock hack hackathon and to the session so today's session will be about Madara Madara is my personally favorite project coming uh from the exploration team at Stockwell so it it is uh the exploration team uh this is our repository um our organization so on GitHub keep starnet strange and/ Madara will take you to the Madara repository so it's a project that started out as an experiment essentially and has proven itself to be extremely useful extremely powerful and um I I I I it'll basically become uh the foundation for launching easily app chains because it abstracts away so much on the one hand from the developer but at the same time gives a lot of power to configure various parameters that app chain developers may need and in general blockchain developers so let's Dive Right In so what was the motivation for creating Madara so if you if we look at the current transaction flow on Stark net yeah so this is pre- decentralization yeah this is when starkware was targeting mainly implementing the whole cryptography Stark protocol making sure all the prover and the verifier and the scaling itself works correctly and relatively efficiently um so transaction through the public API enters the me pool gets validated and executed by the sequencer gets sent to the approver the proof is generated passed on to L1 to the verifier and if everything is good um then uh the state update happens on L1 and the transaction is forever in L1 so the sequencer here does its job in the sense that it collects the transactions packages them into a block and suggests the block to the um to the state update um to to to A1 right as a as a stark net block but what happens is because right now it's just centralized server it is obviously not censorship resistant there are risks of outages and it's definitely needs to be decentralized and it's not a problem of uh starkware only but any L2 out there yeah so this was the motivation and um well the approach to it is obviously to make it decentralized we want it to be a network of notes that has P2P that has a consensus so what can we do um the solution was um to merge together the power of Stark net so the whole um approvable framework so Starks and the CYO VM together with substrate framework so for those of you who are not familiar with substrate it is a framework created by uh poka dot so it's now actually called poka do SDK and substrate just became uh in under the umbrella term of the pka do SDK um so substrate is a very very interesting um framework because it essentially is completely orthogonal to the typical monolithic chains that we were used to when we were start working with ethereum right so with ethereum there's all the same nodes all the same EVS and what does that what does that mean for a developer right for a developer it means that you only decide on on the application logic right so when you write a solidity smart contract you don't have any way to interact with the consensus layer with the execution layer so you're limited to this sandbox of you know what happens inside the evm and the philosophy of substrate is very very interesting in that regard because it allows you to configure whatever you want um because the way that polka do itself works that there is a relay chain in the middle and um the different chains can uh connect to it and have shared security but we're not going to get into that much but anyway the chains the power chains that exist there can configure their block time block size uh can swap out consensus mechanism can of course configure runtime logic and um in that sense it's a very powerful um framework so um what what we did in Madara is we got the CYO VM as a dependency into the substrate node and basically oh wait let me just check other questions happening oh okay not yet um so uh the Kym became a dependency and the Stark net block is essentially packaged inside the substrate block and because um so right now we have a Madara test net running so anyone can try to break it bombard it with a lot of transactions and try to execute I don't know complicated deploy complicated chiro contracts and just try to break it in any possible way um but essentially so what Madara comprises today is that it exposes a public starnet compatible API so everything they can do on starnet which is declare a contract deploy a contract execute a transaction you can do all the same thing with the Madara test net or uh the Madara node uh template um for those of you who are not familiar with um starnet in general we don't um uh save the bite code of the same contract many many times in starnet so when you declare a contract once like let's say an earc 20 like an open zeppel an earc 20 um the class hash of it doesn't change so we declare that once and then we deploy an instance of it every time when we want to deploy a new erc20 so we don't store that bite code many many times across the blockchain which is good so you can VI Madara is a sequencer because uh once it goes into production and it works as as a sequencer and it doesn't expose any particular business logic in any way and it just works as as a network where anyone can join in and participate as a as a node in the network to get fees for packaging the blocks and essentially being a blockchain for sequencing um it it'll act as a sequencer but we can also view it as an app chain FR framework because because for for example it can it is already on the path to be used by two major projects on starnet namely pragma Oracle and the Kakarot evm so it's the evm written in Cairo so for example for um Kakarot it has to be compatible with metamask so that means you can configure phography there for pragma because it's an oracle it needs a completely different consensus it has to be much faster and the block times has to be fast so um this the these configurations allow people to you know be very flexible with the type of app chain logic that they want to to develop so let's take a look at um at the terminal so um I'm in the Madara repo after you build the node you can see it all in the repository how to build and run everything but um what you see is that it it start starts locally running on Port 9944 and you can see that it starts to finalize and run the blocks what you can also do um I'm not going to show it right now but you can also compile the PO JS uh front end so that you can um see the block numbers just click into the blocks see the transactions and especially if you're going to deploy something and invoke the contract so another repository that I will share is going to be um the Madar well actually it's it's linked in the Madar repository so Madara get started um it allows you to um use the scripts that have been pre-created for you so here we can um uh declare deploy and invoke um Cairo 1 contracts so you need to put the Sierra and Chasm files that you can generate with scarb you need to put them in the contract folder and then you can just simply run the JavaScript JavaScript scripts so so declaring just happens you know you need to import an account so in this case this is a predeployment pre-funded account and then you can just use the declare function and pass it this year in the chasm and this way you can declare so I think it's already declared in Madara from the start so let's um let's try and run it so [Music] declare yeah it's already declared but if we go and say hey can you please deploy this for me and we pass the argument um yeah so what we get is a transaction hash and the contract address and I I think we're not going to see the result here but if anything errors you can see it in the logs but it is much better viewed with the um front end compiled and and opened so of course you can um deploy any kinds of contracts and you can also um invoke the contract by using so you would need the contract address that you get from here you would paste it into your script and then you can get balances and invoke any kind of transactions that you um that you need um so yeah so this is the uh the declare um snippet and if we look at the deploy yeah so you need to par the arguments that you passed to it and then uh yeah what's convenient is also that you can compute the class hash directly from the Sierra file and um yeah you just pass the Constructor arguments and get the results of the deployment with the transaction hash and the contract class so it is um actually quite quite easy when when you're using the the script and there's also a faucet so if you need to um transfer funds to yourself for uh for interacting so if if you're using an Argent wallet for example you can um pass yourself uh some funds from the pre-funded account and just interact with the Madara instance um and yeah all the tools are are compatible with um with Madara at this point so brav Argent uh so for example once you have deployed everything CU you can also deploy some contracts through Argent I believe but I'm not sure about passing Constructor arguments there but um they're compatible to interact with contracts so you can you can basically choose and also Foundry starets all the public tooling that works with public St darket is available for usage with um with Madara so this is what I wanted to mention um so running Madara and um yeah so here you have all the um installation uh guides and the links to the uh poka do J's front end and yes if you also want to be uh if you want to run a multi-node local test net and um uh Docker and all the other various um ways to install and let me just check if you have the link here to the Madara get started um the script probably not I will um okay I I will share this I'll share these links in the maybe in the YouTube description so that uh people can can grab these all of the repositories and the presentation um cool well actually this was a little bit shorter than than I expected so I I'm going to look at the questions that we have oh um not able to see the output of Theus scpt ah yes yes I can post the links here sure so umara these are for the scripts and can I share this excal draw oh yeah I can share yeah link and this is to the excal draw um Madara is just a decentralized sequencer for the main knet but not the pr I'm not sure that I understand this question because the sequencer has to be integrated with the prover in order to be able to post transactions to one to verify them right so um The Proving part isn't um part of Madara um but Madara has to uh post transactions to the approver in in for in order for them to progress uh further on to L1 so this picture looks exactly the same except one note here we have of multiple Madara can be used for app chains yes it can be used for app chains um so essentially then it won't play a role of a sequencer because it won't accept all transactions across you know like all the stark net users um they will essentially um um yeah they it'll essentially incorporate the logic that the developers want to um expose right so like I said in the examples with like krot evm or with pragma Oracle they can be um they can cater just to a certain subsection of transactions so they are a sequencer in that sense but they're not the like a global SE sequencer that collects all kinds of transactions Madara behaves as ground layer for all Layer Two to make them centralized um well the thing is is that you could use Madara to settle on other um on other chains if you wanted to integrate them with other provs so the way it is written because of the way the Stark that block is and the way the data is and the way that it's going to be integrated with the um our our provs at the moment so it it's able to post to L1 but you can definitely um rework it in a way so that it can also um like work for other l2s but other l2s will have different verifiers because they have different ZK techniques and different um different verifiers can Madara be used for L1 L2 messaging with Anvil um I'm not sure that I can answer this question but like there is L1 L2 messaging but regarding um you can ask in the Madara group oh let me share the telegram group here I think this is also important so we have a Madara telegram group where you can ask for issues um get assigned to them work on things ask questions and um so on and so forth so t t me um t. [Music] me.net um okay I'm not sure if it's a separate Network or is the same network as starnet it's not a separate Network because it it's a it's a part of the network right so it's um um it's it's it's this bit over here right so the the the sequencer um so it's a a network that prepares the blocks in a decentralized manner so you cannot say that it is Stark net because it's not because um it's it's it's it's missing the proving part yeah um and it like it doesn't replace Stark net like we also have the public Stark net but it plays the role of a of a sequencer like you can have multiple sequencers mult multiple nodes in the ecosystem and uh they will be like a part of the ecosystem oh I don't know am explaining this well um I I guess in in your question it yeah it it is the same network as as as starnet because it's um going through the same flow through the same approver through the same verifier going to the same uh State upd incentive for sequencers on Stark net yes so we we we are working with the Madara um uh incentivization mechanisms so you will be able ble to set your um key in in the sequencer and you will be you will get fees um the exact fee mechanisms as in how much and so on um I I can't really answer that question but the idea is that um if if you're running a node if you're helping to decentralize the sequencer then yeah definitely you're going to be rewarded and but yeah this is this is kind of a separate discussion and feel free to jump into our telegram chat and ask questions about it and um more people will join in on the on the conversation um any other any other questions also just to add to Lana feel free to unmute yourself if you if you have any questions uh or you can also drop your questions on the chat box and Lana can pick it up for you ah I thought Madara was an L3 Network launching solution oh okay yeah I should definitely mention l3s thank you for bringing that up okay okay so the thing is is that when you are deploying um a verifier so right now our um uh verifier here is on L1 so it's written in solid um but the thing is is that you can also settle on Madara um if you have so we already have the verifier called Integrity written in CYO written by Herodotus um and when you deploy that CYO verifier in um yeah this is a definitely more detailed um picture um yeah feel free to refer to the doc definitely be more detailed than my presentation um so when you deploy the L2 verifier on Madara that that allows to actually run an L3 somewhere so it can be just the one node network but as long as it runs as long as it creates a proof and it is verified on Madara in that sense it becomes the provider for l3s right so there are some gaming solutions that are looking to um settle on Madara so to like work as an L3 um so we are working towards that because that might include some work on reworking the approver for that like that works between L3 and L2 rather than L2 and L1 um but other than that um it's definitely there might be like um someone who will build uh this is actually a great um project if you want to test out this flow during the hackathon and deploy the Integrity smart contract on Madara and try and run an L3 I think it's a great hackathon project for Madara So yeah thank you for bringing that up um does that make sense like how how it can serve l3s in that regard I should probably [Music] um using developers try bombarding test net developers developers oh okay perfect yeah and probably let me just share the Integrity um Integrity repository here for those who are interested in l3s because this is this this will unlock um one of the components that will unlock l3s so yeah car verifier yeah you can you can just take a look at the code at the repository and see if you can deployed I haven't I haven't deployed it yet myself so this is a good this would be a great um exercise any other any other questions Co if there are no other question questions maybe we can wait for one last minute to see if there are any questions coming in for you or else we can wrap up seems like an early morning for a lot of people out there right are a lot a lot of participants in the in the US seems like it oh okay yeah because I'm in Berlin so it's it's 4:30 here p.m H oh we have Zack from Singapore joining the session nice okay cool Alana anything uh last notes you want to cover or you're done uh or probably we can just end the session here um I've used the Integrity it's very good but the stone Prock is not very good yeah the Stover is definitely not good if you heard about stew I'm going to also write it in the in the chat box here so s two as in stwo as in prer number two um Stone number two um so it it is definitely being worked with productization in mind because we had really a problem because it it was created with just internal usage in mind originally and then when um external projects like Giza for example provable AI started using it for uh projects that we started creating and even inside the exploration team we were like oh my God stone is like a little bit hard to to work with so we're working like the future version of the prover with the circle Starks with the funky math will be um will be definitely like worked with Pro product side in in in mind but yeah this is definitely I agree with this 100% um yeah so I I I hope that like the the people who will be listening to this not live but like later so that they can ask questions that they have like a place to to to um address US yeah um so anyone who has any questions after the workshop they can reach out on Discord on the yeah okay cool all righty so thanks thank you Lana for joining us today and for the great presentation uh big thanks to everyone for joining the workshop from different parts of the world feel free to connect with Lana in the partner Discord channel uh if you have any questions and they shall get back to you um cheers everyone and have a great weekend Ahad byebye byebye [Music]

Automatic transcript — names and jargon may be misspelled.