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

Loading player…

🛠️ Avail 101

ETHGlobalWed, Oct 9, 2024, 12:00 AM

Join QEDK for a workshop titled, "Avail 101.” This workshop is a concise starter to everything Avail. With a week of open learning, hacking, and workshops on all things Zero Knowledge technology, as well as $50,000+ USD in prizes, Circuit Breaker is a great way to connect with the community from around the world, and help shape the future of Ethereum! ----------------- Find more about Circuit Breaker: https://ethglobal.com/events/circuitbreaker Follow us: https://x.com/ETHGlobal?s=20 Check us out: https://ethglobal.com/ Email us at: hello@ethglobal.com

Transcript

[Music] hello everyone and welcome to the circuit breaker Avail Workshop Avail 101 joining us today is Q DK who will be taking us through the session and with that I'll pass it over to QED DK to get the session started everyone uh nice to be here nice to be CH folks I'm just I just ended up sharing my screen because it wasn't working uh but I think it's good enough so just two introduce myself everyone I'm TDK I'm a senior research and development engineer a um Hy just kind of give you VAR 101 into how to really start using a so this is kind of serve you well if for example if you have never tried using a DNA before so let's say that you're starting out buing rollups um or like any Innovative happen you might be using stacker and you might be making mic rollups or you might be fing cdk and you might be using a wh and maybe to make an L3 so for those sort of solutions um just a sort of a start over into how to use ail so the first thing that we sort of need to do on aail to sort of do anything is to create an application key and what you do is you kind of give an app key which is just in our Victory data um so you can put in something like this uh which is just like a random key and then a we generate an app ID for you and that basically serves as a name space to separate all the data that you submit to a way from all the other rups that are also submitting data so you can see the inquired call Dat you can see encoded call Hash you subm the transaction um keep in mind to set the app ID here is zero so basically app ID Z here serves uh is basically kind of signifying to a way that you know this is not a transaction is nam spaced so you know it doesn't belong to a particular updator um so we just sign and submit this and then we can see the transaction we're going to wait for that to get included so we can see it got included there um it's went successfully we can see our event here so we'll go to the enti probably mine and this you can see it's our just and then in this particular event I can see that an application key was created and it returns this particular app ID 27 R case and this is what you'll be using to submit your data blobs going forward right so then we can do another call to the data availability uh pallet but instead of calling create application key since you already have key basically where the a name space for blog we can just do a simple submit data so we can just do so we can submit a random blog and here it's a reminder that you should set an app ID here to be the app ID of name space that you control so for example if someone has resolved the app ID um 96 right then Tech you cannot post on that name space you can only post on the name spaces that you control so our app ID was 270 so I'm just going to put 270 so the TR goes through assign and submit there and wait for to get included we can see it was included you you go to the Explorer and there 135 Exchange in the same block so good luck I guess okay somehow we found ours so got lucky there and uh we can see that the data was submitted successfully and in the event we can see the hash of the data that we submitted and this kind of this event signifies that it was sumed successful so this would be sort of the uh being the non-programmatic way of submitting data to oil but like let's you're doing a rollup or you're doing in bulleting board news cases as with likes to call it then you know this might not be perfect for you um in which case you know we have examples in the form of um we have go examples for example so we can use something like data submit watch uh we have Main do go here and uh we basically need something called GSR PC it's basically a go um adapter for substrate RPC and since AA is based on substrate we have kind of written our own modification part GSR PC that allows you to use um our Fork of GSR PC in your go code so for example we have dsrpc here um and then we have changed it in the go mod to use it use our first instead and then you can kind of do all of the things that you just saw me doing programmatically so you for you saw for example you have to give it the constract go um we create a particular API from the conract we get the metadata and then we create an extrinsic called to submit data and then we submit it basically similarly to what you just saw with the only exception being creating the application key and but since that's like a onetime process you don't really need that to be grammatic and uh ID you should not be um creating application IDs uh more than you kind of need them so it basically means like if you have if you're running the same rollup then you should be reusing the application ID um so this is an example code that we have the yo is a project- and you can find all of this in the examples folder we also have a couple of other examples um I think the relevant ones will be data submit watch um and query proof data so this is the one that calls C AR missing to kind of get proofs of the data that you can then prove your on L1 ethereum L1 using data adest station and I guess there is Miss new blocks for example if she want to wordss a if you want keep track of events you keep track of bridg events uh so these are the go examples uh we also have some Doo examples um these are basically similar to node except they're just roted for Doo so like using JS environments like for example if you're building with stacker this would be a good fit for you um and again as I this virun does the same thing um as what I showed in the explor uh it's basically submitting of GL of data and lastly we have the validum these are more like a collection of scripts that particularly do something so like hypothetically valum that is based on like a TS inter which is unlikely uh then technically you could just reuse this um we basically have functions to get the data route to dispat data route into the noide bridge and also function to post the data and then similarly we have a couple of contracts here um this is again just to keep in mind this is an example contract so I'm not going to go ahead and recommend that you use this real valum but it's a good mental model for building a real valum for example um and that's pretty much it in what we have for examples um I'm going to let Andrew take it away so we can kind of show you a real architecture overview that we have recorded um regarding the availability okay everyone stand by hi everyone this will be a short walk through of our available ADM repositories so of course the first thing that won't at is the aail module itself just note that since the underlying polygon ckvm node is written in go of course our implementation or other implementation of that has to be in go as well so we have this particular file called a.co on the underlying there we use something called GSR PC which is basically go based client for working with substrate and then we have for that as well and so we have our own custom Fork of aail GSR PC that we use to do everything from sending data to quaring data uh to set dispatching data routes and so on and so forth so let's delve directly into the init function we basically have this file called aail config so if we go here on this config.py that conforms to this particular strop so you have Jon in your Jon you can write seed and then you can put the seed of the account that we should use to dispatch the extrange X from the API URL the B basically the RPC URL the app ID is the one that you'll be creating through create application key the destination domain will be 1,000 for ethereum the destination address will be the address of the D average RoR and then the timeout will be whatever the timeout you want it to be we just use it to have sort of a fixed timeline for finalization of your particular extrinsics okay so let's go back to aa. go in here what we basically do is we just store all the variables that we kind of need to perform repeated queries so for example we get the latest metadata we create the API we get the config um and so on and so forth and the reason we do that is so that with every other a call for example in post data we have a couple of other calls as well we don't really want to incor the cost of this again and again and then that's pretty much all that we do so we just set the variables or like you can think of them as almost Global variables here and so kind of what we really interested in is this post data function here right so what we do is we construct an extrinsic of The Da ballot called submit data and then we just send the DX data and that's pretty much it I'll show you as well where we kind of call this submit data in a bit but yeah basically what happens is we create this part extrinsic and we create the signature options we sign it with our key ring pair and that's pretty much it and then what we have is like this a loop that runs for that time out period that we specified earlier and so for example if it is the block we just submit that as part of the log it is finalized that's when it sort of break out and this is what kind of time out is keeping TR off we just s a log here then we hash it and this transaction hash will become important because we submitted to the zvm contract on the L1 layer whatever that is to sort of prove that the data that we are saying that re sequencing is actually being posted to a will so with here what we do is we try to find the extrinsic index so we can keep track of that or the proof as well we get the header in which we have the block number and uh this block number is what you use to kind of fetch the data rout from the contract later on and so we also have this function called disass Data route which is doing similar to how post data is sending data in the extrinsic with dispatch data route we can give it a header so you will see we we give it the header we cre the header here and we send it then header and then on the other hand on the L1 da Bridge order contract it is able to send that entire data route or so it'll basically map a block number to Vertical data route so again we make a new extrinsic we get the next nons we again craft the extra signature options and then finally we submit and wait similar to how we waited for the previous um extens and finally we have get data so this is required for our synchronizer for example like let's say you're running a new validum node right like and then you kind of want to sync your node that entire process is not that straightforward with the valadium because the data does not live on L1 so what we do is we have this kit data function here um and then based on the data that we already indexed from that particular L1 contract we will be calling as you can see we kind of get the block from a full node with the block hash and then we search for the particular extrinsic where our data is stored basically so what we'll then do is that the unsync validum node can then sync using the transaction data that posted to AV uh which then allows you to kind of build trustless sequencer sort of models so that would not be possible otherwise and then this is just a helper function that kind of gets the next nons from substrated it's pretty trivial what we are more interested in is basically the finalizer logic so in the sequencer module we have something called finalizer doco and this is where we have sort of re adjusted to use a so for example if I were to show you let's go to close but so we kind of get raw transactions when we encode it it's basically an rlp encoding of the transactions in a particular batch and a batch is basically a collection of transaction data across multiple blocks or anything to be honest so basically if the block is non empty what we do is we retry aail three times uh and then we attempt to post the data and then we kind of hash it we store everything related to that particular batch so so that we can submit it later and then we close the batch so similar to how you would have uh the normal function ongoing we just sort of intercept the Clos batch flow and we send over the data to aail and that is pretty much um what we do here and then of course we dispat the data rout as well so we can access the data uh later on or basically you can attest through the data on L1 so that is what what we have here maybe I can show you the sequence sender logic here the logic is sort of complicated but the thing that you need to understand is now in this sequence Ender what we do is we sort of combine multiple batches and then we start sending them as a batch as possible as the number we can send the maximum number we can send in a single transaction so let's say we have bad x y z and we include x and y and then the transaction is full what we do is we just send XY with the corresponding sequencing data um on L1 and that's basically what is happening here so as you can see we have also sent the Da Block number the da proof the da width and the da index while we submit uh a sequence and that is because of the data attestation function that we have on the L1 contract so basically what we call your rollup contracts on L1 which does a data addtion verification so basically if you have no L2 data we don't really care if you have any L2 data and then the data route has not been dispatched yet then me sort of just wait until the data rout get just ped because in the optimistic pattern it can take some time between 20 to 30 minutes to kind of do the entire flow and then if we observe the data rout is already available on L1 then we just append it to the sequence and then we send it and that's pretty much it on this side of things we can kind of open this see you can synchronize a bit as well so let's do get data here that's sort of what we are going to interested in let's say the Da Block number for this was zero so like this is relevant in the case like let's say you are roll up migrating to AUM then of course like your previous sequences will not have any Da Block number so technically what we do is we give it the Da Block number we give it the da index and we are able to get the raw transactions from a whale and we then reexecute the block as if we have the data already and that's sort of the trustless sequence or um model that I was talking about earlier which a function like this m was to the synchronizer model and then similar to here it's basically when we observe the event on L1 we immediately F dator from aail and then we ensure just for sanity you know that the data that we posted is actually correct so it's sort of like an extra layer of ensuring data availability so that's pretty much it on the Node front I'll do a short walk through to the cont charts so similar to how polygon have polyon ZM as well we have our version of the polygon zkm so to say we can see that we have inherited this D AO verification contract that that's sort of the extra library that we have added so for example if I had to show you let's go to the router verification right so we basically just have a router that we set and then this is just some simple Market rout verification and that's pretty much it yeah so going back to polygon zvm if you go to see Grands batches that's sort of the important function that we have where we going to submit the badge of L2 data and then you submit the da data and then with the da data we're able to check for data station so with the block number the proof the width the index and the batch hash that if a record will submit from the sequence sender we can indeed prove that some data that we're kind of claiming to submit here has been also posted to Avail and then basically the rest of the flows s of remains similar we have for example first batch datas as well we do some comparison checks here and the sort of this is what's important here this is what's the current related input hash where we kind of take the batch hash of what we have submitted and then based on whatever is previously stored in the contract we're going of create a new accumulated input hush and this is what the prover is actually proving it's proving the change from the previous accumulat input hash to the next input hush so since we Pro Data attestation at the time of sequencing we don't really need to post it again at the time of uh proving and this kind of helps you save on prover resources because then the prover doesn't waste its computational resources on basically unattested data or useless data in some form and that sort of kind of all the cruxs of the changes that you have made as you can see it's pretty straightforward to we also plan to kind of change this over to use our vectorx Bridge as well as also use the cdk release that will happen in the late February so this version might kind of change drastically but from an implementation standpoint it will kind of remain fairly similar because the code that we have today is fed from polyon KVM as will be cdk so the scope for changes will be quite low in that regard but still it will be like a decent level change so you should be technically aware we'll kind of publish the documentation for the new bridge in the coming days so you'll also have more clear ideas on what we doing and once we have that we'll also reimplement the validum with cdk so to say and that's the one that will be officially supported going forward but if you wanted to build a BLM today this is the solution that you have and feel free to use it yeah that's pretty much it thanks everyone awesome uh are there are there uh any questions for qk or Q qk anything else you want to maybe share um yeah I think um there are a couple of things like for example a good question would be like what can I really build with a win right I think that's what the last question that I see on my screen kind of is yeah uh um for example okay so just to kind of expand on what I just showed it's basically an example code for a Validia that is using aail as its data there so it's basically uh polygon Z KVM that has been Fork use a as the DN instead of ethereum in short that's kind of the code that we just walked you through uh what we are concerned about primarily in such Integrations is how do you integrate a wh in a secure and scalable M right that's sort of what we're looking for and for example if you wanted to build a block Explorer for a win I think that's a valid category but what really depends in such builds would then become like how exactly is what you're providing superior to the products that already have for example there is Subs scan um and there are a couple of others open source and I forgot the one that we're using right now but uh it's it's um if you if you're building something that that is technically Innovative then for sure I think it's something that qualifies uh and yes the technical lift um is not trivial but I think once you get past the initial hurdle of figuring out um what aail is and how do you post data to a I think the use cases become much more common so if I had to give you some very common use cases for example right um a good use case could be like you have orbit for example arbitrum orbit and then you make uh integration for a with arbitrum orbit so just stuff like that for example which utilizes a VE for example if you're building like a new drone up SDK like for example if there's a competitor uh uh for example like that stacker uh who are basically building like sdks for micro rollups um you could leverage that and then you could build a novel rollup a micro Ru of in fact um that is kind of solving for a particular use case um you could hypothetically like we Al Ser a track award for this and this can interest some of you is you can embed the a light client on like a mobile app uh that's something also uh we're kind of looking forward to so there are kind of multitudes of use cases um and of course it might be non-trivial but you know this is a long form haathon uh as as as well as they think so I think um it would be a good challenge to go through as well nice yeah and I just uh posted a link that was in the uh the Avail partner Discord channel uh that uh Robin who is uh uh I believe a devel from the Avail team uh shared as well so hopefully that people find that resourceful too uh are they any other questions we're kind of going over a little over but um and if there aren't any other questions then of course as I've mentioned before you know please connect your dashboard to the Discord Channel or to Discord excuse me and then you you will be able to access all the partner channels and like I mentioned uh uh Robin from the Avail team has already kind of send out a message you know to to reach out anytime um and I don't know if C IND if you're going to be monitoring the Discord Channel too but uh if you are then everybody else you you'll be able to see reconnect with him again yeah for sure um I'm already on the Discord um I might not be as active because I'm traveling but I'll try to check in once a day so I can kind of answer your queries I'm also available on Twitter where I'm more active um if that suits some people um any resources what data availability um you will find that our docs uh kind of explain the concept of Da and also our blog let me drop a link to our blog we actually recently posted about um kind of uh data availability one one so I think that will kind of help you understand what exactly we solving for n me Bas the link your yeah this is the link um and this should be a good explainer into what da is so I think that's pretty much it uh just a couple of things uh that is still looking to way that you looking at um so there is a win sub XT if you're using rust there is a wi GS RPC if you're using go um and if you're using JS or DS or something like any no R time then there is a GSS DK so those are the primary three selling s that you have for interations today and that should be good enough to sort of get you started awesome cheers well well thanks again for the great workshop and thank you all everybody else for attending uh just reminder hacking starts tomorrow uh in the during the opening ceremony when that begins so don't miss that and yeah hopefully every has a great rest of your day and we'll see you all tomorrow cheers bye [Music]

Automatic transcript — names and jargon may be misspelled.