StarkNet 🛠️ Basecamp Session 1:Fundamentals - David Barreto
ETHGlobal·Mon, Oct 9, 2023, 12:00 AM
Join David Barreto of StarkNet for a workshop titled "Basecamp Session 1:Fundamentals". Paris is the city of light and birthplace of many revolutions. Therefore we are thrilled to be back in one of the most buzzing and free-spirited cities in Europe for ETHGlobal Paris 2023. A lot has changed in the European ecosystem since the last time we hosted a hackathon in 2019 and we are excited to meet all the new talent this July that we have acquired since! ----------------- Follow us: https://twitter.com/ETHGlobal​ Check us out: https://ethglobal.co​m Email us at: hello@ethglobal.com
Transcript
foreign [Applause] [Music] this is a session one one of seven uh okay my name is David Barretto I'm one of the developers Advocates from stockware focus on this target of course uh you can see here my socials my Twitter my blog as well and I'm here with also manmid and Omar we're also developer Advocates from stockware so in this cohort of Base count code four we're gonna have seven sessions in seven weeks each session lasts for two hours what we expect and roughly is that out of those two hours 90 minutes will be the presentation of some light coding uh we have 20 minutes for questions uh which you don't have to wait for the end or just whatever question you have use a q a and then meet and Omar will do their best to try to answer them if if any of you don't know the answer you want to discuss it please um interrupt me we have a discussion live as well uh we will share in the Q a for you guys after the session in an email so you have that as a reference uh we will have 10 minutes break as well and just so you know the last session of Basecamp Code 4 is going to happen May 24th so it's going to be kind of like two months in the future uh we have some homework but it's optional if you want to do it or not just take base count as a way to learn everything about strong nib and Cairo is up to you how much you want to get out of that um so we don't have any formal aggravation we're going to be reviewing the code uh we're just here to support you that's why the Discord is important if you get stuck with homework go to Discord try to get support from your peers we will also get to hang out there uh to help you guys as well uh David there's a question regarding the slides can we show the link oh yeah that's a good point yeah okay let me uh file share publish is that a q a yeah so it stays there in the chat as well okay yes please I that should be working is it working for you Omar I'll make can you open it or anyone in the chat can I mean let me know if you can open the slides okay cool people are able to look at the slides so as I mentioned we're gonna have seven sessions for a base cam so today is about fundamentals just the getting started about you know everything about starnet Cairo hopefully to have a basic develop environment instead of indoor machines and to deploy an example a smart contract to stunner so you get to interact with a network as well session two next week is going to be a deep dive so basically it's like a part two of this saying talk today session three is actually about Carol one going through the syntax and if any of you have been on at stuck there for a while you will know that camera zero is a very different language from carow one so we want to take some time to go through all the details about the syntax session 4 is about testing and how to test cairo1 and smart contract then Session 5 is about this targets architecture we will see some architecture today at a foundational level but then session five we're going to go deeper into it session six we're gonna look at Kairos architecture because Cairo has a very specific CPU architecture that we're going to discuss there and the final session is going to be about Starks the ZK proves that underpins stagnet okay so some things that that you should know uh is that after each session you will receive an email that's gonna have a link to the recording it's gonna be a link to a YouTube video a video that's going to be unlisted so you will need the link to to see it we're going to also share uh the Q a from the session that's why uh we're trying to push people to have any questions use the Q a because that way we can share with you after so you have this reference we're also going to send a feedback for me because we want to hear from you guys how do we improve Basecamp sessions only basically how do we improve from next session for next week so please give us your feedback uh we're gonna tell you what's gonna be the homework in the email and also a form so you can submit your homework in this case any GitHub repo or your stagnant address where you actually deploy it use the Q a system to ask questions inside the chat and use Discord to get help from peers so if you provide your Discord username when you register to Basecamp you should already been added to a private channel on Discord in the stagnet on the yeah the starting channel the star will see the Discord server uh if you didn't it's because there are some issues either you were not part of the Discord server so try to first of all get into the Discord uh for stockware and then we will add you some people we were unable to actually add you because there's some rules about security about the Bots that we cannot bypass so I'm sorry that's one of you and if that's your case please use this session to ask all the questions that you have so for today's agenda we are going to cover why Cairo uh why stagnet so Cairo the programming language starting this layer 2 with with Kairos is used we can also see a basic view of the stagnant architecture we're gonna do some also basic view of carawan I'm going to discuss some of the tooling that you have available as a developer we're gonna have a little break and then um we're gonna do some live sessions setting up a basic data environment from scratch so I'll be using this case a VM with the Bluetooth so you can see the whole process from start to finish and we also have that documented I'll show you the links to where that is being documented any interesting questions Omar man me to discuss now life you can vote on your favorite question that q a as well so that gives us more visibility right we lost some admit [Laughter] uh so this is some basically which disco server channels is dedicated to the bootstrap The Bootcamp thank you it's called bootcamp sorry Basecamp code four um yeah that's inside of the stagnet Discord server all right uh let's get started so why my Cairo so I like to start this with actually a story so imagine you are the head of a space Exploration Agency in a small country and your task is to send as a spacecraft a small one like a robot to to our planet let's say Mars so of course you have to do a bunch of calculations in maybe the most important one is one is the right launch window and the in the best trajectory so you use the least amount of fuel so you know the rocket is the smallest as possible and it takes the least amount of time so those competitions are very complex to perform requires a lot of computer power so probably you will go to your engineer and say hey could you arriving in the algorithm and some very high performance language like Ross for example so we can get those results we can just know those two variables the best launch window and the best trajectory so sure enough they create the algorithm but it's very complex because so complex actually requires a super computer to be executed in any reasonable amount of time but you have the issue that you don't have a supercomputer because you know you're in a small country you don't have access to other resources but there is a rival country that has been willing to help you out they actually has they have one and they have offered to execute your code and give you the answer but then you have the issue that sure you can provide the code to them to the rebel country they executed in their super computer and they will give you back the answer right so they give you those two variables the launch window and the trajectory but then you have a problem like how did you know that that is the right answer that is actually the result of executing your programming exactly the way you write it I didn't know that the super computer didn't malfunctioned like one bit flop doing the calculation or maybe there was some kind of sabotage maybe it's even a small change in how the computations perform could be a disaster for you like space exploration so you don't have a way to meaningfully to be convinced that result is actually the what the the algorithm that you wrote or your team wrote actually was supposed to find so not even when any situational language you cannot have that certain thing not even Bros not c not any language but with Cairo you actually can because car racer has approval language that when you execute it they say that that's repeated scenario this this time you write the algorithm in Cairo instead of rust you provide that code to the supercomputer of the Arabic country but now then because it's it's been used uh with Cairo not only they will give you the result back and they also will give you a cryptographic proof that verifies or will let you verify the validity of the computation or the Integrity of the computation so now you can take that proof and you can use any regular computer and just verify the proof and the verification will let you know in in non-certain terms or in a mathematical certainty way that the result that you're getting is actually what was supposed to came out of the execution of your program this is called computational integrity so now if the execution is intentionally or unintentionally modify the proof will be invalid and you will know it right away right so there's no chance someone's going to sabotage your your program or that there was some malfunction and you didn't know you will know right away so with this with Cairo and the fact that you get cryptographic proofs out of execution a regular computer in this case a laptop is able to keep a super computer honest and that is a superpower that only languages specialize like Cairo especially for validity proofs I can provide okay uh just a sec trying to make the Q a visible for me as well David just one question here the rehab uh channel for in Discord for discords uh we do we do someone actually provided based on Google that's the name excellent ah thank you very much shipping I saw that dude okay yeah uh if if you provided your Discord username when you register you should be you should be in the channel already unless you were not part of the Discord server so if you're if you are not try to join the Discord server for stagnet and then we will review the list again and add the new people dot enter the server later David if you take this could you could you please add me so I can also take a look at the questions and and be able to answer them on Zoom to add you to Discord uh just a q a I have to Discord I don't know oh I know way you can just open the window yeah it's opening yeah yeah no problem David and yeah perfect perfect okay so we have enough questions field board we're going to answer them and let you know what can we answer like let me just try to answer a couple of them maybe you can type the answer as well so they have it as a reference but let me just see interview the audience uh let me see all the questions at least the one have been voted that have not been answered already uh so let's keep the intro so what do I have to do to graduate can attend all the session 100 do the work we don't have a form of graduation this time we're gonna give you homework it's up to you if you want to do it or not and just take space cameras away to learn as much as you want from Cairo and stagnet uh this is because we don't have capacity to assess hundreds of people submitting onwards every week a reliable way and we realized that the goal here is just for you guys to to learn more or anything yeah and we can do cool stuff and and at all you will see that it has it it goes to any to something it will it will be worth it box says we really need help to focus on Chiro One no reason to do Cairo zero anymore yes in this space cam We're not gonna do any Carol zero it's just all about Cairo One this time just be mindful car one is super new was just released to Mainland very recently so it's gonna be a little bit rough around the edges uh but it will improve over time how can we share that the proof is not tampered so the probability of you being able to create a cryptographic proof that's going to fully verify is one over one billion times 1 billion times one billion times one million so it's very very small that you can actually do that to understand exactly the reason why you have to wait until session seven when we discuss actually stuck the math behind this uh validity proofs please turn on caption it will be super helpful you know what I try less time I don't know where it is can you almost can you take a look to see there's a way to enable captions I know the last time or some previous style we were able to I just don't remember where sure I'm looking for these I don't promise anything all right let me continue uh Omar I mean if you see any interesting question please interrupt me and we can have a discussion sure well okay now we are we gonna I don't know it okay so to summarize why why Cairo so first of all it allows you to create what's called a provable program for when you can create a cryptographic proof that verify that attest to the Integrity of the computation uh so as I mentioned the cryptographic proof is generated alongside the result proof verification can detect cheating or malfunctioning without re-execution that last word is the key to why we use related product for scaling ethereum we're gonna we're gonna look more into that in the net section so you can summarize this by saying that a regular computer is able to keep a super computer honest when you use a language like Cairo okay so we talked about Cairo so why do we need stagnet so the thing about the issue of scaling on layer one sorry just a second it disabled disco because he has so many notifications that are distracting me okay uh so in layer one in case of ethereum we have what's called a block producer which is going to give you okay it's going to tell the network hey here's a new state of network let's say the state is 42. but of course all the other validators in the network they just don't want to take the word uh for it and say oh yeah sure it's 42. they will actually execute independently the same blog and verify that they all get to the same result independently so that's the so that's part of the consensus that the actual result they all they get to a consensus is actually 42. so as you can see even a small or a simple computation takes tens of thousands of computer to actually execute right because they all need to execute that independently and get to a consensus so you can see that is fairly inefficient in that regard so this is how ethereum achieves computational integrity but by re-executing the same transaction over and over in the case of stagnet we execute only once but then we verify everywhere so when you understand that you will do something similar you you know process transactions and then you propose a new state let's say the new state is 42 but not only you provide the new state you also provide the cryptographic proof and now the validators were just ethereum nodes ethereum validators they don't have to re-execute the same blog to see if it's 42 they only have to verify the cryptographic proof that was provided and that will give you give them mathematical certainty that the actual answer of the new state is 42 without having to re-execute all the transactions in the block and as you can see the verification takes only a fraction of the actual underlying computation so you can see it visually here why a layer 2 like a stagnet is so much more performant because now you don't require every single node of the network on layer 1 to re-execute all the transactions they only need to verify the cryptographic proof and that takes much less effort how was the connection how less of an effort well if the execution takes n steps right the execution done by the sequencer on a stagnet then the validation of the cryptographic proof associated with it actually takes log square of n so this poly logarithmic relationship and it's easier to see in this graph so this blue line going vertical oh sorry by going in the diagonal it's actually the amount of steps of certain computation and you can see the red line is the amount of steps or the verification of the associated cryptographic group so the bigger the gap between these two curves the more you achieve in saving computing power from the whole network to achieve the same result of creating new States so you can think of validity proofs additional validity proof is to computation what zip is to a file size it's all about compression just in the case of validity proof it's a compression of computation while sleep is a compression of file size um let's see if any interesting questions any question here on Omar and made yes to be honest as long as they use the Cairo VM uh and you have access we're gonna have to see you you need to have access to the underlying Cairo program so we all have an agreement which program is being executed but as long as the super computer use Cairo VM uh it will able to generate this cryptographic proof that the computer will not be able to Tamper or or if they do you with a verifier independently you will be able to spot when they are trying to cheat yeah Oh So when you say cheating and being honest what do you mean like what is we what is cheating in this context City will be trying to create a validity proof they try to attest to a computation that didn't happen or to attest that some computation that apparently happened uh provide a completely different result that it should have done and and you've been trying to fully verifier that you have on your site so is it is a combination of both I give the security of a system uh please people in the chat please use the Q a don't use the chat for questions so we can keep track uh yes we're focusing on the on the on the Q a and also here's a question on how can as Leo join the Discord I guess they're simply going to the Discord of Stark Nets join and whatever you can you can share the if you can share the invite link to the Discord server uh put it there and it will be helpful well also let me invite you to the telegram I will send you a link in the chat so you can join the telegram here of English speakers uh it's for only for Builders so if you want to go there and we can just talk a little bit more and and contribute you can ask questions and so on so I will I will send you the link also for the Discord cool thank you Omar all right let's talk a little bit more about validity proofs so validity proofs are an implementation what's called a zero knowledge groups or ck proofs and it uses CK proof to guarantee computational integrity that's basically to guarantee that certain output is a result of a computation with an input so you can think about about that is like doing the right thing even when no one is looking that's one way to think about computational integrity so we use validity proofs in seeking proofs not for privacy which is a common misconception about standard we use it for a scaling ethereum as I showed you before the comparison of the layer 1 and layer 2 validators uh so started right now is not about privacy it might be in the future but right now it's not that's why we think that ZK Roll Up is a misnomer because it can imply some privacy we prefer the term validity roll up or standard and to be fair pretty much any other seek develop out there uses validity Roll-Ups none of them to my knowledge actually are focused on privacy after I think Aztecs shut down their own layer too and very importantly the type of CK proof that stagnant uses is the stocks we don't use snacks probably have heard both being secret proofs but we use Starks and there's an important reason why we chose to go with stocks and snacks that I want to review here so if you compare these two type of ZK proofs and the verification time for uh for a start proof is poly logarithmic maybe you recall the chart that I showed you in the case of a snug is actually constant so it doesn't matter how complex the underlying computation is the amount of work to verify the computation is always the same now the proof size that we send to layer 1 for verification in the case of Stark is pretty big it's about 400 kilohertz in the case of the stock it's pretty small it's only close to 300 bytes so he begs the question if it's not XR so much better than the stock why did we actually chose a stock engine snug or a stagnet there are very two important reasons for that first of all when you use a snacks you have to go through the trusted setup the The Trusted ceremony where you have to fit the system with uh with a secret and you have to make sure that the secret is properly disposed because if that secret has been leaked the whole system is compromised in the case of stock we don't need a trust setup it works even without them so it's it's one less trust assumption for the security of the system it's also very important the stacks are quantum secure which snacks are nuts so whenever quantum computers come in line with sufficient power they will actually break a start but they will not break a stark so we are making a bet on the future to you know the maximum level of security that we can think of of course that has a price in the proof size but it's better to be safe than sorry in the future that's all this will be thinking David we just came here so there are some people that go in the Discord of a star net what they have not been an idea to the channel so what what will be how can we proceed in that case if you if you joined just recently uh allow me some time to get in touch with them the the Discord mod who is in charge of the channel so they can add you uh just make sure that you actually provided that your Discord username when you register and we will try again to add you to the server some people might try to join the stockware server and might not be able to and that's because some security Bots that's something that we cannot do anything about that but if you actually were able to join we will add you to the Discord server just maybe tomorrow morning maybe they can send their Discord name in the chat right and we can if you can take the note of that it will be super helpful okay maybe start a q a and and people added Discord username so we have one place to track all the people who are the added to the channel oh I think it's okay in the chat we're gonna download it and then more and so please add to your totally chat your your Discord name in case you haven't been added to the Discord Channel and we will thank you okay let me see more questions I wonder is this a way to hide they wanted me to answer okay is there a possibility to keep the algorithm private so the supercomputer cannot tell algorithm and they use it later and not now no because as I mentioned the stagnet it's not about privacy it's about scaling and so you have to share the algorithm so basically when you use a stagnet you have to publish your smart contract so it becomes visible to anyone to use it if you want to read David please pull please click on Cell like so we know you already asked yeah okay there's two questions from Fox from hcp so man you know that there are okay what do you think about the snacks using a trusted without trusted setup they are using some kind of BRS what do you think about it well I'm not sure I haven't takes so deeper into the text and always implications but I know that for ethereum there's a push right now for kcg commitments I think that's that's part of the set the the secret right we're all collectively creating a secret to fit into the system to provide security to to the stocks uh so that's why it can be done but then you have to make sure that you do the kcg community ceremony correctly uh so real quick so when you have a circuit and the verifier has to read it's basically you have two parties grouper and verifier all of this trusted Etc is basically done so the verifier can read something shorter than the actual circuit and verify that the circuit is correct so we have to as David has been saying go through some sort of a compression process from circuit to compressed information and then that compressed information is not the verifier reads this compression requires in the case of snarps which is the first product already have been introduced in the space it requires some Randomness now whether you use verifiable Randomness or I guess unverifiable Randomness that doesn't change uh the security vulnerability that we are talking about is that even if you do have verifiable Randomness and someone is able to get access to that or leak that information after the trusted setup then the plural can basically cheat and create false rules and the verifier will not be able to like figure out what's going on so so that's kind of like what we're doing here stocks required no um no Randomness to generate there they only use a collision resistant hash function which is also why they're Quantum secure so so that's kind of like just a a fundamentally Superior Tech stack I guess that's a very interesting question from zeberine is Larry that says aside from blockchain where can Cairo be used let me try to I see some very good answers already from from your peers so let me just provide my own answer as well um one example that I like to think about is in the future you should be able to generate proofs directly on your computer right and then submit the proofs to some server and the server is the one who runs the verifier and I like to think gaming is a good example of this when it's a common issue in gaming that people actually modify their client to cheat right and and that's an issue when you have a multiplayer game with language like Cairo you can technically request your client to every every soft and create a validity proof out of the execution of your client and send that variability proof to a server which runs the verifier just to check that you are not in a new object you can decline the way that it was supposed to to be right so if you try to cheat if you try to modify your client the server will know because the validity proof that you send regularly will fail so that's one use case and then people actually doing research in the topic to actually run even on a smartphone the main issue right now is that creating proof is a very resource intensive process so there's a lot of research that needs to be done to get to that point but it's an interesting thought as well how to use Cairo in a different setting that is not stagnant we're also doing something with Bitcoin rights oh that's great yeah can you explain can you elaborate any of you what is happening well I know that there is something being built I will send you the report to the chats Steven is being built I don't know exactly what what it is in order to scale Bitcoin which is Target and it had been very successful while wearing the bigger community so you hope that's something that's something we can say about it and also uh David there's a question about the program will be open so let me first answer the question about the Bitcoin uh actually that's something that the big Community is very well aware of I think the ethereum committee is not as much but on the ethereum community they're actually using our technology to create a very light Bitcoin client they basically uh I think the basic idea is that cryptographic proof or validity proof is generated out of a regular Bitcoin client and then when you want to sing a new Beacon client yourself you don't have to download the whole blockchain to calculate the utxo yourself you can just verify the cryptographic proof of all the calculation and other server actually perform for you and then you can sing to the latest utxo just download the database and verify the cryptographic proof associated with the execution to get to the current utxo so now you can zinc a Bitcoin client in a matter of probably minutes instead of days I forgot the name of the project was it good Clement Heroes has searching implements profits here added the link to the repo the chat thank you very much Clement you can go and see the to be honest there's a lot of very cool stuff that is being built right now at the at the age of the technology so and if the star Community is amazing to to be honest it's amazing they are building some really cool stuff and yeah um do you want to to do the program Open Source person the proper open source yes so right now it's not open source but we made a commitment to actually we will make it open source we're just trying to tackle other areas of the blockchain first especially the sequencer is our first Target it's just already we're doing a full rewrite in Rust Open Source One to decentralize also the sequencers before we can tackle the this is the approver but it is the goal to decentralize the whole stack it's just not yet we're not at that level yet so right now the sequencer and the prover are actually centralized which is the same for any author every other CK problem right now very centralized that's all they're not actually open source yeah go ahead there's also a question from Paul asking can you explain why it's Stark is for the secure and not Stark so real quick the the part of the cryptography that has been vulnerable right now to Quantum attacks are those using elliptical the cryptography such as snarks and ethereum and Bitcoin and so on and it starts are not relying on this kind of Primitives not they're not using elliptic cores they are using excessive functions as symmetric key encryption so it is believed that this particular Primitives will be Quantum resistant so that that's the main reason the elite the corporatory yeah at least right now we don't know we don't know any algorithm able to break uh hash function using quantum computers but we do know an algorithm to break elliptic curves and and other cryptography Primitives using electric curves using quantum computers that the algorithm exists it's just waiting for a Content computer to be sufficiently powerful to run it and then they will call they will when we have that a lot of the movement has been done with quantum computer inside so yes and one of the goals they have is actually trying to use this this algorithm to break the elliptical trophy is actually a metric for how good these computers are so it will come a day and when that becomes the first thing they will do is break this lib corporate all right thank you for the question um meet Omar feel free to keep answering them on the Q a I'm just going to keep moving forward because of time constraints all right so you probably have heard like in a stagnet we use the Cairo VM whether you we don't use the evm so so why is that so on one side you have ZK ebns right which some famous One are like the polygon Hermes uh scroll CK sync they try to be as compatible as possible to the Ethereal virtual machine while standing is actually using its own virtual machine called the Caribbean so these two approaches is trying they're trying to optimize for very different things so CK EDM is trying to optimize for having Max compatibility with current smart contracts deployed on layer one but they sacrify performance because the evm was created for a particular CPU architecture or a traditional CPU architecture that is not really um friendly to CK circuits that's why Cairo VM or Stockbridge we decided to create our own virtual machine so we can create a our model a computer that is exactly or fine-tuned or validity proofs so we're thinking about how do we strike the most performance of the network monitor I mean do you have any more comments you are more an expert at this area than I am probably oh I I would leave it at that today uh and or not but we can but yeah the main differences of course you can compile your code directly into ebm byte code on zkebms with us you have to go through uh Sierra and maybe yeah I'll let you speak more about we have a session six it's gonna be about the Cairo architecture so probably a lot of the a lot of these uh questions are going to get answered how the architecture of Chira actually looks like what other the Caribbean actually looks like um just a quick comparison if you have read vitalik's article about the CK ebm classification declassifies CK EDM in four categories type one to four so type 1 is basically no changes to the ethereum virtual machine you know full compatibility but the performance will leave very very slow to create a cryptographic proof out of those execution so pretty much no one is attending this right now uh type 2 is that you use most of the ebm but you change at least the data structure for storage you achieve High compatibility at least you're gonna have some smart contacts or you will need to be modified but the performance still very slow then you have type 3 where you have compatibility but you have to modify something like a storage hashes pre-compiles to make it a little more friendly to the new architecture so you have partial compatibility it's not like you can deploy every single smart contract as is to a layer 2 with its characteristics the performance is going to be slow at least in theory technically and we have projects doing that like scroll and polygon hair remains as you can see even kite carrots which is a layer 3 on top of staring it are actually tended to be type 3 CK edms but then you have the Type 4 where they Implement a completely different virtual machine there are either not compatible uh with the smart contracts Deploy on ethereum using solidity but the upside is that it's very fast to create the validity proofs so you have two main projects Computing the space obviously this target is one of them and you're going to consider to be a CK EDM because you can just stagnate with a compiler called warp to compile solidified contact into Cairo VM and the other one is polygon smiling so we are really focused on performance and long-term view of a scaling ethereum yeah many coding here eleven session he said like we really believe in Star Wars that the future of skeleton will be built using Cairo since Cairo because then it says they only focus of caro the only focus of its role is to scale ethereum that is not the goal of the evm right the evm goals is to match centralization which is great and it's very relevant well in Kyle we're already giving us a we're already thinking as a given the bottle the security and the centralization that the theme gives so now we're focusing only on scaling and that's why we really believe that Cairo is the way to to to to skill the problem here is of course image from from David's show there's already an ethereum building two links two links or boundary we have profitable ad and so on and and those we don't have in in Cairo or stunning we need to build new tooling however the toolingx is being built by the day so we have total star which is kind of similar to Foundry we have a actual truffle no sorry which we have several apis and it's the case that we can use to drag with the storage and cable so the link is getting much much better so we are able to write koi and scalable the social parts and This calamity has lower fees and faster versus transactions cool thank you Omar all right so Samurai why Stang it first of all it guarantees computational Integrity without re-execution uh proof verification is cheaper than the underlying computation so remember the political relationship with the underlying computation we can think about that as computation compression so we use CK proof for scaling not for privacy that's very important to keep in mind Alice not yet and we use ZK proofs we use Starks CK proofs and not snacks because Starks are quantum secure that's really the main reason we think in long term and this is why we have the trade cool let's talk about a high level the architecture of the standard so in my previous example the story about it you know the head of this space exploration the the person actually got convinced that the result is 42 whatever that is right because he was able to verify in the penalty the cryptographic proof in his laptop but then how do you how is other people gonna trust that that is actually the result right because so far only this guy was able to verify the little proof but not Alice so that's why for for Alice to trust a couple of things are needed first you need to make the Cairo pronoun publicly accessible for anyone she should be able to in the penalty verify the proof basically run her own layer 2 node so she needs a stagnet so standard is a layer two right so that's why a person here ethereum at the bottom has layer one so on a start net when you send a transaction uh you send the transaction to What's called the sequencer right and the secrecy is is like the blog producer of the stagnet and it uses that's where the Cairo VM lives and also with the stagnet OS leaves and the sequences are just going to take all the transactions it's going to validate them just to make sure that the signature is correct that the person is able to do these things or they've been able to use this user account it's gonna bundle them into blocks and it's going to calculate what's the new state of the network based on the execution of this block right similar to a block producer on layer one in this case the interesting thing here is that out of the execution of all the transactions in a blog and the sequencer sends uh what's called an execution Trace should approver that we call it sharp in the case of a stagnant sharp is because shared prover is used by stagnet is used by Stack X as well so with this execution trace the prover is able to compute the the validity proof to attest to the Integrity of the computation done by the sequencer and this validity profits eventually sent to layer 1 as call data to a verifier a smart contract um that is written in solidity right this is open source anyone can see it so the verifier is going to take the ability proof and it's actually going to perform the verification on layer one this case is the Ten thousands of ethereum computers are going to perform this computation independently any diversification is actually successful then the sequencer is going to change the state difference but changing the state before and after the block was executed again to the leader one as call data to a different smart contact that we call a stagnet core and we use that as our data availability in the year now we want to polish this data on layer one so now we can have full nodes or stagnate full nodes who gets uh what is the state of the latest block or the state of the network it gets that from the sequencer currently because as of now these are two centralized entities but the fact that we send this state div to layer 1 it means that if for some reason the sequencer or the connection between the full node and sequencer fails you are able to recreate the layer 2 current state by reading or indexing data from the standard core smart content so you can recreate the data from layer one independently if you if there is a situation that the sickness has stopped responding to uh lead to full nodes so at a very high level this is how standard works so I I went through some of the modules so as I mentioned the sequencer validates executes and bundle transactions into blocks the proverb creates stack proofs for a stunted and a stock X that's what's called sharp or shareproofer the verifier is a layer 1 smart contract verifies the stack proof send from Sharp is another layer one smart contact that just stores is a big word because actually we only send it as call data it's not get stored at the contact level storage or cost reasons and we use that as a data availability layer probably the full node provides data to layer 2 taps David in seconds perfect so we're getting the start through presentation there wasn't using familiar sorry little for coming there are a lot of questions that were answering each of them so a little ask when you were talking about these parts we send it Oh you mean an example at the very beginning yes at the very beginning so what are we saying the algorithm or that the algorithm like the program you can you can send yeah the program it's just in reality you don't send the program as is you send the buy code of the program right the the low level Cairo assembly program to the so to the super computer okay yes thank you very much go ahead do a robot oh no RR is asking can you use different parability layer like Listia for example they have the SDS we are working on on the valid use which is going to be and we're already Innovations where we wouldn't be able to do the the the datability parts using different different kind of services for example Celestia file core a USB if you want these were to inverters so you will be able to write Cairo code where you can declare Bibles that are going to be stored in the in on chain and some variables that will be not store on chat it will be stored I know uh of Cheney or when it's an STL or somebody else so like that would be very very cool we believe yeah it's your second it's called volition because validium is what sarakis so we have three different data availability modes right now only two really Roll Up is the one used by stagnet will be polish to layer one validium which is used by Stark X that we are not covering here but it's another technology developed by stockware and then we have volition that we want to we want to implement on a stagnet I don't know this year at some point which will allow you to choose where to store your data so you have different costs for your transaction that you're going to store it on layer one or have a maximum security or do you want to store it in a similar place it could be Celestia or a Consortium people storing data that's going to be cheaper so we don't have a lot of details about that but we know that is a path forward for selling it to enable evolution do you have activities it says scheme for the link to the report of the verifier smart contract layer one do we have no yeah yeah uh repo oh it is Facebook you go to the Caroline repo uh useful info important addresses they verify our others here so you can is there is there a question here I don't know what the question is I put it on the chat but all right can you please put it on the Q a so all right so this is the link to the hair to the deploy smart contract so see the actual source code you have to go to the Caroline on GitHub and and in here uh I think it's here's the stock where oh man I know I saw it but I don't remember yeah I can search for it or yes it is yeah it is I've seen it it's there somewhere actually it's fine remember cool uh section four so let's talk about Caroline like we just recently uh uh which recently released this new version of the language which is very different from Cairo zero but it's much better than Cairo zero so Cairo One is a high level language right which makes it easier to learn compared to carols here which was more of a low level language the syntax of Chiro One is heavily inspired by rust which also makes it like a strongly typed language so if you know Ross you will feel comfortable with Cairo One uh when you compile a Cairo smart contract it doesn't directly compile to the Cairo VM by code which we call it the power assembly it compiles certain Intermediate Language called Sierra Sierra stands for safe intermediate representation because this is what allows us to create validity proofs even when a transaction fails which was not possible before and now because of Sierra basically sequencers are always compensated for their work even if a transaction fails and in the near future will allow for transactions to be rebooted watching the way that happens on layer one so you can see on the right side you start with the current one smart contact you compile it to Sierra and then you send this to the sequencer the sequencer that compiles to car assembly that we also call it Chasm and from the Cara assembly the execution of this car assembly by code but the signature that's where we uh derive the validity proof on the program and we send layer one so take a look this is how it looks like an example a smart contract from car one you can see at a glimpse it looks a lot like rust where you can do some meta programming with macros uh this is how you bring functions into scope this is how you define storage variables you have to name a stroke storage has to be the name and then you define the properties of all the storage variables felt is still they didn't need a type but then we have more data types that we can use that before in Carousel was not possible one very commonly used is u256 which is commonly used in solidity uh this is how you write to storage this is the syntax this is how you read from storage for now just take a look today is not the day to focus on Cairo One a lot just for you to have a taste of how it looks like and and now this is how you define variables with the keyword let which if you use color zero and you know that before it was like four different ways to Define a variable now we have only one so the much nicer language to play with uh so there's something called Regenesis that is all about closing the gap so as I mentioned briefly that in Cairo zero transactions field transactions cannot be proven and because they cannot be proven that opens the door for what's called a denial of service attack on the sequencer because the sequencer gets to execute a transaction to the point where it fails and then it cannot add it to the blog because availability proofs cannot be created out of a failed transaction in KERO zero actually fixes this problem but it means that it eventually carries Zero's my contacts needs to be disabled from the network for security reasons so we have two important events that happen over time the one that happened recently is the deployment of starting 0.11 to mean it because before 0.
11 main it only supported cairo's 0.10 smart contract right after the deploy the the song is 0.11 now both languages are supported Cairo zero containing cairo1 at some point in time we're gonna go through Regenesis maybe it's four or six months where we actually gonna disable all the cairo's hero smart contract and only Cairo one is going to be supported from that point forward but in the meantime we have a migration window where we provide mechanism for you to be able to upgrade your already deploy smart contract from Cairo 0 to cairo1 while preserving just saying uh storage layout system storage values the same address so in a way that is completely transparent to your end users using your smart contracts but you will have this migration window to go through it because after Regenesis we gotta disable all the characters my contract in that from that point forward is only going to be Cairo One from that point on and this is where we are right now just at the very beginning of the migration window so let me go to this summary and I stopped for some questions because probably there's some so kind of one car one is a high level language inspired by the rust Sierra allows for reverted transactions before we're not possible we will have revisions actually just yet we need a little bit more work on on the target to allow that but it's now technically feasible to do it uh a smart contest can be upgraded from KERO zero to Caro one while preserving the state and their current address for this pain they're being deployed Cairo One started already support car one in the tested and on mainnet as well and Regenesis will disable Cairo zero code and it's going to happen before six months in the pitch so let me stop here for for questions I buy better song I there's a question from Anonymous attendee it is possible is it possible to build circuits like Silicon or Noir with Cairo One I don't think so because this is a high level language but I've not done much of an expert to get deeper into the reason why but intuitively I don't think so yeah but from what I've seen you've seen like uh like a layer three we can be able to you to to use Noir and then that compilates so you can get so moving towards in and actually transformation something before of you will be you can be able to prove its nuts into starnets is something that's been working I think yeah you can you can you can create your own verifier with Cairo right this is my contract it actually it exists they're the stocks verifier they're different stock verifiers as well so really the you can Implement your only three right now in another way for a start where I was stagnant to evolve to the point that we make all these things like the official very far available on Layer Two sorry but also severeign uh probably I haven't we haven't discussed exactly what's going to be coming in the chapter but probably yes for now just keep in mind that it's going to be an Intermediate Language so when you compile uh in your computer before you deploy you no longer compile directly to car assembly you compile to Sierra and that's what you deploy to stagnet and then on a stagnet the signature compiles your Sierra by code to Cara assembly code yeah this is a great invention from for those of you who want to for example do audits security audits you can learn in Sierra will be easy for you to uh it's very important it's like learning Jewel or layer one question yeah more questions can you can you order by the most because I see some questions being on answer with four votes three votes we're working on that we have a so that's a question by gleam he's a skin by the way he's French living in Mexico so in the centralized started the sequencer will be a full note and there will also be a full on the Arnold sequencer lines which means only sequences would participate to consensus and all other full nodes are all their life relaying data to depth or other notes is that correct so how this implies Estonia is a moving Target I don't have a clear answer of course the first sequencer will be the first one to be decentralized and it means that they need to reach consensus right as any decentralized system uh do they need to be full notes I mean signature will they need to store uh the current state of the network right as well as a full node but a full node can exist in independently from a sequencer right you they don't have to be the same thing they can be in the Middle Lane I think that's the future but they will probably share some modules like right now for example if you use Papyrus as a full node it uses a module called blockifier that we are going to introduce also into the new sequencer that has been Rewritten in Rust so they're going to share some of the same Primitives for storing the state but there are two different systems in the network I also wake up like clients right like viewers being built also by the community we also have beerus which is inspired by I forgot the name of the other that horse is ah forgot that there's a there's a light client developed by a16z or ethereum that we're using to build Horrors on top of that which I forgot the name he would also made word mentioning that Francois thank you very much she has been answering a lot of questions so thank you very much Francois what else can we do start with caution to reduce the proof size like the Mina broco whip snaps we do we do do that yeah the sharp let me go ahead please you can answer that oh yeah so I was just going to say we do not so so initially we generate One Roof object per computation but then uh basically whilst we're still in the off chain environment we batch those moves together and keep on generating smaller proofs for a certain period of time and only at the end of that period of time do we send the one really sort of like root roof down to ethereum layer one so in that way we're actually getting hundreds of thousands of transactions through one proof object yeah on session four when we go deeper into the standard architecture we're going to look at the had approver and achieves recursion all right sorry let me move one the time is all right if we have time at the end we will go back to see us on this question but please try to answer some of them and directly on the Q a um so some of the tools that you should have if you want to get into stagnet first of all is a wallet and there are two main ones you have Argent X and you have Bravos Argent X they have a browser extension uh you can see for Google Chrome for brave for for Firefox Bravos the same also a browser extension but Bravos also has a mobile wallet which is very interesting how they Implement that and how to use account abstraction so pick the one you like the most and make sure that you have installed on your browser so you can follow along some of the exercises we have two different block explorers welcome Voyager and the other one called Stark scan both are great options so pick the one you like the most uh and we have some tools for developers one of them is protostar which right now I mean I actually was thinking about removing protostar for now because it's definitely a full rewrite of output Star Wars character one using a thing called scarp so maybe put that on Ice in the meantime but uh just know that there's a tool similar to Foundry on ethereum so you can test your smart contract using the same language you use to program the smart content in this case Cairo and also we have uh collaboration with open sampling that they actually develop uh slide contracts for Cairo probably some of the best practices for you know yes 20 years 7 21 and and so forth other tools that we have available we have a plugin for our hat if you want to test using JavaScript we have a devnet similar to ganache as well if you want to run it locally we have a library for react for your decentralized app we have different sdks for different languages for typescript or JavaScript for python for Java calling Scala and for iOS so whatever you're building we have an SDK for that many of them right now are going through the process of upgrading to support Cairo One uh so just just be mindful of that all right so let's take a break uh 10 minutes we have 10 minutes how much do we have let's let's have sorry five minutes because we have we better jump into the live coding session so just have a you know washroom breaks get some coffee and we'll get back in five minutes sorry I'm just gonna mute myself and turn on the camera around and I'll be back in a moment just answering questions from the Q a it would be great to have a chat depicting Trend using information from all these questions and the documentation so so we can answer these questions uh faster because there's a lot of voices here and I apologize to everybody that has been waiting for their answer we're working on that we already answered 50 questions so bear with us we're working on that but yes if somebody wants to work on a champion I was actually looking at something like that maybe you seemed at badcam oil which was released by by Stanford that would be amazing to kind of so also uh feel free to join the telegram Channel let me I will send the link again so you can get in there there you can ask questions if you want to or to organize a meeting whatever let us know we can help and yes let's make a nice communication and thank you very much William for your questions thank you very much everybody's Norm and there's fresh soil along the wall yes a little way French people are always exploring these like very new technologies French I don't know if they like this kind of I was working in AI before going into Star Wars and always the the French are always in this experimental Technologies it's very interesting also in AI you can see them in blockchain but also not not every word blocks you can see them a lot in this like state of the art uh a sale of the yard blockchains like Starman even though okay thank you very much greetings and thank you for for your help on the other question one more did you share the uh how the Graham uh telegrams with people I'm not sure I can hear anything install Ed you know what I cannot enable the my video yes you will share your screen and you will show your screen on your sorry it was it wasn't mute yeah no no my camera we get let me see wait wait just unable to start video you can start your video because the host has stopped it again just a second let me see our try it try again please now really worth I think in the security section I don't have a good decision yeah try to live in Dragon well in the meantime we're working on the on the start and the Cairo group calls the community and I will give you a small primer here for all the view that of dude in there will be before in spirits so the difference is that it's going to be completely the simple life so if somebody of you wants to support us in building the the walk dot standard.io if there is no because it is very very new so we're still working on that the green started part is already up to date but we will have more and more and more content here for example we'll have content on the stats so that was a question on how starts actually work and you can see them here in several chapters talking about that but overlapping a lot of information so there's some persons already contributing to it but if you want to contribute to for example talking about wallets Bridge block explorers the startup devnet everything that that David has already talked about let us know let us know we'll we'll be happy to help you collaborate with us on this so we will be showing this in the telegram and also in the Discord in the next days for it to contribute if you want and this where this is a community a fallen I'm very happy to having him on previous well thank you Omar uh all right I'm gonna start sharing the screen again to continue well someone missing chat okay cool all right so let's go and set up uh other Dev environment for carowind um so first of all just a warning we are going to be doing using a lot of tools we're very new so we're going to be living on the edge which means that some of these two links are still rough around the edges so we have two main repositories I'm gonna use one's called Cairo Lang which is written in Python is where the we have the starnet CLI and we have the Cairo zero to Cairo assembly compiler right so like the all compiler uh but it still has the strongest CLI and then we have the Cairo repo without blank which that's where we have the Chiron one compiler a compiler Sierra and then also we have a compiler from Sierra to Chasm and I'm going to go into detail why we have two different compilers I'm gonna explain that in section four I think uh but this one is written in Rust not in Python and it also has a vs code extension that we can use but we're gonna have to build it from source and you can uh have some you know syntax completion and validation as well so we're gonna need three main languages for setting up this Dev environment as I mentioned it's going to simplify as time goes by but for now give it three we're gonna need Ross to compile the carow one compilers and I know it's a mouthful but that's what we need to do and also to compile the vs code extension right because right now it's not yet published to the to a Marketplace we're gonna need python especially particularly 3.9 to create uh an external account so we can deploy and declare those things and invoke to use this target CLI because the Cairo land whereas CLI leaves is written in Python and we also need to sorry to declare to deploy and to invoke transactions on a standard finally we need node.
js for packaging the vs code extension before we can actually install it on our IDE so this is a plan for like going Parts but you can follow along but we had instructions shared for you here at the bottom so first we're going to compile cairo1 from source that the compiler is actually working by complete a simple smart contract car one smart contract then we're going to install the VA school extension for Chiron when I create a user account locally in your computer so then you can declare an example of smart contract you can deploy it to stagnet testnet and then interact with it uh using blog Explorer and a regular wallet so you have two links here at the bottom uh abusing the guide today but in the standard book we also have steps for performing this as well uh so I'm gonna this ends okay so let me I'm gonna start a virtual machine so we can follow the steps from in the beginning basically so let me see in a sec to start this Ubuntu so this will install and start I just don't know what the VM starts and I log in share the screen in a moment okay I mean and I'm going to follow my in guidelines in here so guys I just tried to set up my computer here with all the things that I need or you can start the Litecoin sure in the meantime oh okay I'm ready so Association I have a clean installation of Ubuntu machine the instruction for Mac OS are very similar in the guide I put whenever there's a small difference I put their comment again if else kind of blog so the first step is to install rust so to install rust you basically you follow the official instructions of how to install it we want the release version of rust so oops now I can't like that we need to use scroll to get it I mean let's see if I can increase the font size of this I'm just gonna proceed with the installation how is the phone size [Music] um not that good if you can zoom in okay yeah join me the middle size column suppose custom fonts here already changed it I have custom fonts and can increase it to hitting better now yes looking better what the what do you think guys they see it's okay perfect thank you very much make a little smaller yeah now well okay all right cool so I have rust installed it asks you to activate some things on your shell so you can just run this source or you can just close the terminal which you're gonna do and open a new one so the configuration takes place and just to verify that rust is installed at least rust up we do this up version and yes so we have version 1.25.2 okay so Ross installed as I mentioned when it rust to compile the car one compiler from source um so the next step is to actually download or clone the the repo or the compiler for car one leads so I have this commanding here all right so this is the repo where the Cairo One compiler lives and I'm going to clone it to a specific folder on my on my home directory just called dot Cairo I just want to have a particular location that I can always go back to because we're gonna do some we're gonna have to do some mapping of the binaries that's why I put it here so after call it we should have it in the dot Cairo uh folder so if I come here right so we have we're in the in the replay store for car one so we need to activate a very particular tag the latest stack available in the repo because that's the the compiler that was used or supported right now by Stack it so we need to make sure that we use the same so this is why we enable or activate this particular tag which is the latest tag on this Rebel story tagging person 1.00 Alpha 6. right so we are in detached node in this particular commit of the carbon Ripple so now we can actually build uh all the binaries using cargo and using this command I'm sorry to go a little too fast just because we have the guide yeah um in the slides which I share with you at the bottom of the last slide where I have the live coding plan you have you see the reference uh let me just put it here and also you can share again the link to the slides of groups oh okay right link to the slides publish the web it's a links where do I put in the chat yes please in the chats okay so I put in the chat the link to the slides and if you go to this last slide before let's let's start the setup you see a link to the guy and I share this link to you this is this the steps that I'm following basically that you don't see on the screen I'm just using a secondary screen but you also have this target book as a guide it's just this is a good one I'm following in this uh session you should don't see it cool thank you all right so going back here I just sag in cinema game right a new garment I shouldn't do the chat the link to the starnet book where you can also see the commands please bear in mind that the starting book is very good against we're working on that but that part is finished could you start that link Omar I just no I I will share the link right now there okay and call the start of the book yes all right so the next step is to actually build the binaries right using cargo build and we use the release version of rust we don't want to use the the latest or the edge it's gonna take a while so it's a perfect time to answer some questions uh perfect so let's see when will the minute support cattle one my it's life it is you can deploy yes right there's there's no problem okay it's a particular problem okay so we're really sure that must take you much crypto nerds Android is and internationally consumption from Russia from cover novel uh runs you were looking at that particular question with a no right Bots already asking they don't need to see if we can get an answer as soon as possible Ramsey thank you very much for that what are the benefits of the Caribou to my Shield versus serial TVs they have to be strong for DSL to win with solidity King I thank you very much Paul Henry is the answer that the carrier is very specifically used by starnet yes exactly and the benefits are is that again that Taro is focusing only only onion scalability and this is something that the therapitra machine is not focusing on they focus on our on our stuff like the centralization which is very relevant but the camera has the only goal of skinning a team so that allows to do certain kind of stops that make us scale while having to follow all the rules of the evm which that are done for different purposes so the gargoyle machine should be able to allow for a foreign [Music] there will be the main benefit s you want to answer right now David which one um sorry sorry for us in this a little bit late we have a lot of questions so Talisa skin most projects will probably be attracted to seriously and change because they are already bunch of solidity tips how easy would it be into transport solutility to Cairo in the future is it better for bricks to transplant or to create native when it started and if you allow me David hey let us let me call here again founder of the Starks inventor of the stocks founder of Star Wars he said that indeed we will have actually a Serial GBA that needle is leading that development it is called back out which as far as already sure thank you very much Francois but any sense our Focus here is to scale gold using Code so the real skill is going to be coming from Cairo not from transpilers like the one we have warp will be transporting solitly into Cairo however building native error codes will be the real power of a stone so indeed there's a lot of developers already for solidity but we think that developers can easily adapt for most of you I think you know at least two different languages I don't know maybe Python and JavaScript or something like that and so and we would only believe that that developers will have no problem learning girl also as iPhones also keep in mind that the standard gives you way more resources for executing transactions that you are that's possible on on the limitation of a gas space on layer one so that allows you to create more interesting applications you can actually create things that are not possible at all to create on layer one so do you actually want to just transpile your contact as is you're going to be missing a lot of interesting features for example a kind of abstraction that doesn't that exist technically on L1 now but it's a little confusing because there's three different ways to have an account on layer one on Layer Two and started everything is a smart contract everything is using a kind of fraction or smart wallets so really the idea is that when you have a different environment with different constraints or less constraints you probably don't want to just rewrite the smart content exactly the same way it's only one and it's worth mentioning that any serial knowledge project following the entire virtual machine like the ckvms will have the same constraints of the idea that means a construction for example okay do you guys know any open source project that had my Reddit fluid Cairo so that I can refer to the codes you can let me show you the link to the standard title 101 which you can already do my way to go once I guess also in this thing um I don't know if we have a project already doing and and testing so there are a lot of products my way to carry one but they are doing it's maybe not open source or experimenting behind the scene also origin I think will have shown their code girl one so that will be very good but in the meantime I will share to you start getting 101 tutorials that those are very very very good for you to understand how to structure your your code if you want to learn standard Cairo code you can learn with it but it is also going to useful to learn uh the syntax and the way the structure report so I will show it to you in the chats compilation is taking a while it's pretty intensive and also it's a virtual machine it's not my host machine so it has limited resources but we're getting close perfect okay so DV it says kingway not both the centralization and scalability star disoriented more to the second one but I don't see the trade-off to live in the battle the first one yes sure well uh correctly if I'm wrong here man meet and they bought a started is having bought this decision from steel and the scalavi that is providing those who will have the centralization in the in the there's there's no layer 2 that is the central list right now actually we're working on that we're working on deciding each other we have symbolization so we can decentralize the use of sequencers and so on but I don't know if you want to to add something to these buttons well the goal is to decentralize everything right it's just it's a hard problem to solve she took ethereum a long time to the right will take us a while also to to do it right so we need to approach it first let's let's see that the technology works and we can scale and then we can decentralize we can you have to tackle some big challenges once at a time to do it right but that's the goal to have it completely decentralized with Ben okay any other questions today that is great thank you very much for coming we're very happy to help you here I think those are all the questions that we can answer Vibes we did it oh there's a question from Leo sister what are the most interesting use cases you are seeing of on-chain apps that will benefit from being able to access more compute and by me this answering right now do you want to answer live Man meets Maybe yeah I just like the answer I dropped in the chat one of the most exciting things that I've been seeing out here in San Francisco is uh the new push towards zkai because Ai and machine learning models are inherently very computationally intensive so being able to prove inferences so people don't have to run them all over again it's actually quite a powerful thing um so so yeah that's that's one thing off the top of my head other than the obvious scalability also if you have to follow along for going back to the previous question about digitalization you can go to the standard Forum that I put it on the chat blink where we actually post our thoughts and ideas of how we want to decentralize starnets you can follow the discussion there and the proposal and you can comment or bits it's okay anything you want to add they meet regarding started Cairo ground again no no again if you want to share your Discord in the in the chat so we cannot you do that to the group we have a Discord in case you haven't been added yet please put your Discord there also join the terrorland community where it's uh oh it is also useful for in order to plant meetups you want to do some in your series or you want to talk with us you have any questions please let us know there all right good news uh it finished compelling and so we can move with the next step let's clear the terminal here so now that we have the carowind compiler compiled we want to add these binaries to our path right so we can execute this 100 from any any place in in a file system so an easy way to do it is just by adding to our configuration file for our shell in this case I'm using CSH with my values in bash so just modify this depending of your terminal if you're using bash will be bash RC just basically adding the path where we compile where the compile version of the current compiler lives to our path so once with that uh I'm going to just close terminal and open again so the changes takes place and we're able to find the binary so if this goes well we should be able to call this stagnet compiler just to see the version and it's opening it's kind of called oh started compile.
compiler and there you go so we have the binary ready the binary is added to our path so we can use it to compile or chiral one smart contacts to Sierra so let's let's test that the compiler actually works so I'm going to create a folder just like a sample project we're just going to put a very simple smart contract and try to compile that so I'm just going to call this folder stagnet when I get into it and in here you're just going to create just like a test folder right and I'm going to create two folders just for usually I like to have one for where my source smart contracts is and where the compiler folder so I'm just going to call the comparable the Sierra so this is how my sample project looks like and I'm gonna create a file for my sample smart contract inside of source it's called example.cairo okay so I put the tree again I should see the file so let me open this with vs code a quick question is there some kind of pre-dinner or ES lens for taiwo prettier or eslint the closest will be this extension that we can install but it's not exactly a speeder because pretty is a formatter so I will say not yet something that he has linked the the extension will will work similarly but not like prettier than actually four months when you save or something like that when you execute it uh I really creative phone this side thank you okay here you go just so I'm just gonna put a very simple smart contract right and just gonna basically use this macro contract and then we create a module it's called a simple storage for now today is not a goal to learn cairo1 just to make sure the tooling is working and you can see we don't have anything that's highlighting or tooling or ending because we haven't done yet the work of each other extension but we have the smart contract so let's try to to compile it so here I can just don't starting it compile and I provide the and then the output in it's going to be a Json file the so it worked right our compiler is working this is how the Sierra looks like with this very simple smart contract good so we have confirmation that the compiler is working now a company for carow one Next Step will be to actually install install the vs code extension and this source code for that extension actually it's inside of the cairo1 Ripple so let's go back to that repo that we store in Cairo and we have here a folder called vs code Cairo that we're gonna get into it right all right we have the right folder so first of all we're gonna need to have a node.js installed uh so in the case of Ubuntu a simple way to install it will be with this command there are multiple ways to install this I'm just going to use this to get the latest and node version 19 let me just expand this more uh it's gonna work let's say so in theory now I can do pseudo apt update where I try to install it so now I can actually try to install node.js see okay so if it works well I should be able to denote and version and yes we have node version 19 the latest one installed on the computer so we're good to actually now uh compile the extension or just well when you use a JavaScript you don't really compile let's say you package it somehow so first of all we need to have installed a global package uh called vs code vs ese so this is what you do for component extensions so install it globally it's under this name ESC this is provided by vs code so remembered for everything is being recorded and it will be open YouTube so you will be able to will send you an email with the link so you can review everything right now yeah and the guy that I'm following also we have shared with you the link so your exactly what I'm doing is just documenting in a nice document there okay so now uh let's install dependencies or JavaScript with npm install remember instead of the vs code Cairo with the extension leads okay that's let me just update my npm just in case that this is suggesting me to do oops copy paste oh I need to do sudo this is optional all right so now I can actually package extension previous to be able to install using this command package either we install this binary globally on npm now we can use it here this is just a temporary measure eventually the the The Exchange is going to be published to the marketplace and you will get it directly from vs code without having to do that but remember we leave it at the edge so this is how it needs to be done right now so now we have the package that we can actually install it with I mean Solid 2 vs code with this command right so extension this is the file that we just created now we go ahead and in theory should be installed so let's try uh right so if I open the extension here okay I can see that is it is now installed carow1 it's called extension but we need to be configured because it's asking for where's the pass for this particular binary the chiral language server this is one of the binaries that we compiled from using rust from source so we need to provide this path and to provide that path let's go back to [Music] that's going to be the target release let me just go back here let's go to Target this is where all the binaries are placed this is my absolute let's say enough to it I'm just going to copy this I'm gonna put it here and slash with the name of the binary and I think it to probably close this and turn it on again so it takes see let me close the vs code and oops I need to go back to my workflow or maybe just open here and it's not taking okay now let's work I'll get syntax highlighting and it's gonna complain you'll do some things wrong like in this case right so it's a nice helper when you write carowind code so cool so we have the vs code extension word yes oh my hey sorry it's word measuring deaths as David said I want to repeat that that we're not letting learning Cairo right now but we will do and we'll have the chapter of the book ready for in a couple of days so you can start learning Cairo by yourself and then we can go here and Away with more knowledge of cow and we also teach you some Kyle and also we have some tutorials like starving so we will share in a minute so you can start also learning yeah today is just about the the dev environment no reasonable Cairo but let me put a little more complex Cairo code here because we actually want to deploy it today oh my God fixed yeah all right okay now I'm not gonna really explaining how this works we're gonna talk more about Cairo in future sessions I just want to make sure that we can compile this and you can deploy it to standard so let me just recompile this as we did before you ever go back to oh my God okay it's gonna copy this could be can I paste it here no anyway compile okay so we compiling the new version of the smart contract so this will be more more complex now as we can see here right way more complex so this is the code that we actually deployed to standard that we give to the sequencer the Sierra smart contracts okay so let's keep moving on the next step now because to interact with this target we used to use the starting tli the standard tli is written in Python so we need to have python 3.9 in particular to be sold in our system so to install a very particular version of python at least in on Ubuntu you will need a particular uh PPA and this one here every time you find this okay so I add this repository to my apt it's because we need Cairo sorry pattern 3.
9 we installed python 3.10 it might not work now I do update references and I'm ready to install python 3.9 using these two packages especially for development because we also need to have virtual environments thanks a little bit okay if it all went well we should have now python 3.9 installed version yeah there it is you do have it so now let's actually install the Cairo CLI um so to use the carousel light installing we need to have one Global dependency called GMP so you can use that this command to install it this is required for the chiro sort of for the stagnant CLI on the calculator CLI you need this Global dependency now let's go back to our project we're working on and call it stagnet test and we're back to our project and I'm going to create a virtual machine here for sort of virtual environment for python so when I install packages I don't want installed globally just want to solve the pair project so to do that you do this command to Define that you want a virtual environment the Earth and then you give it a name I'm just gonna call it Cairo uh all right and then you activate that virtual environment so you can start installing Cairo Cairo pin activates so as you can see now we're inside of the Python virtual environment so we can install the Caroline package just before I do that I'm just going to upgrade pip to the latest version just to be saved and now I can actually install Caroline pip install neurolang which is going to give you the standard tli let's see and it's installed for this particular project it's not installed globally if you own a Mac this might fail I put some instructions on the guide what's the alternative command that you can run on a Mac it just happened to me that it failed so I found the solution it's a more complex command but it works all right so if this is working so we should be able to execute the binary called stagnet which is the one used by the CLI and there we have it we have 0.11.
0.2 perfect so um so we'll use this target CLI in every command you will have to Define so which network you want to deploy or interact you use that with flags and also you need to Define which type of wallet remember that on installment every wallet is a smart contract and you have to Define to the CLI how this flight contract looks like and how this Market is able to verify signatures until we get to those sections I'm going to Define two environmental variables on my on my shell that the standard tli is going to use and gonna make us our comments to look a little bit simpler so let me open uh the my profile configuration in case each RC uh what open right number to the bottom I'm going to add two environmental variables uh one is to tell every time that I run a standard command that always targets the test net Alpha curly instead of mainit right I don't want to spend money right now and also to telling because it's a kind of abstraction which type of wallet I want to use to sign transactions so I'm using this one here okay so this would be export as well it's not expert export wallet okay this looks good so I should be able now if I I close my terminal and I open it again should be able to access these environmental variables we do Echo struck net Network there you go so it's installed it's available on our shell so now next step before we can deploy anything we need to create a user account in our computer because we need to pay for declarations and deployments so let's go back to our project for now and start net test let me activate again the virtual environment or python Cairo pin oops activate okay so take because like the standard CLI is only available in this python virtual environment so create a new account at least to get the address of our user account we use this command it's starting it in your account and we give it a name oops right here right so using this the Sony CLI to create a new account in my computer and I'm going to give it a name the 0.11.0.2 right so I can add different wallets uh once they the network keeps upgrading so by doing that it's not gonna create the user account yet it's just gonna give me the the address because the address is always it can be known before you deploy because it's just an algorithm they'll be always the same so this will be the address of my user account while I deploy it so I'm just gonna copy this one here and the next step is just I need to send test if to this account I need to fund my wallet even before the wallet exists on chain this is called the account counter factual deployment I think it's called the second feature when you have a kind of structure so I'm going to send a small amount of if to this address so let me open I think you should have should have a wallet here in this VM that I could use oh you have oh no maybe I don't yeah I have to send it from my so let me just bring this up and give me a sec to unlock my wallet not if without sharing my key or anything just a second hi okay so as you can see I have bravosphere another account which already has some test it on girly so I'm just gonna send some test if there so I need just to copy the the address and from here just gonna send some amounts hit sends 0.
05 test if I'm using Bravos it says that it doesn't exist on chain which is fine uh this is the counter factual deployment we're going to talk more about that when we talk about a construction in future sessions we're not just follow along all right so I've sent a transaction to starting a test net using my wallet I can follow a lot of transaction here on a Blog Explorer so we need to wait until the transaction gets at least to the pending State before we can continue so I think right now on test Nets blocks are produced every three minutes if I'm not mistaken that's where you see the counter so let's wait a little bit I mean because the font size you can see better so once we get to the pending state it means that I can actually I have the funds available on that particular wallet and I can continue with actually the on-chain deployment of my user account okay this is a feature of a kind of structure hopefully we can make it easier for you in the future with tools like scarp that we haven't talked about it yet questions in the meantime Omar or people just post questions with a lot of questions we have a question from Michaels from Michael for the late reply he's having something there are a couple questions for you there are my argentin as you just seeing a local and the second question is are you seeing what version of the compiler can you check starnet slash compile version please or if you're using scarf let us know scarb is using the the newest compiler version because I think there's a plan with that part it will be nice opportunity to showcase faucets oh it's a good point yes you in this case I'm sending ether from another account that I have but you can actually use a faucet uh where is it tools well said there you go I'm gonna put it in the chat link to the faucet where you just put your address and it will give you some amount of it the faucet has the limitation that it has a limit of how much test if it can give you every 10 minutes so if I try to use it now I say oh you have to wait 10 minutes and I don't have time to wait 10 minutes that's why I went the other way but if you are more patient you can use it this way you will get some test kit on your address okay so now that we have yeah oh my God hey hey foreign okay so now that I have uh test if associated with this address I'm actually gonna deploy my user account which is a smart contract through this address so let me get back to my notes put in my secondary screen okay okay so to deploy my user account just clear the screen here I use this command so against each of the standard CLI now you see the deploy account command uh always using this particular account that I created before the one that we know the address so if I do that it's going to actually deploy my user account to test net and you can see it's so it sends the deploy account contract transaction so we can follow along the transaction using this hash on stock scan dark scan you that's that put here the transaction hash because we need to wait until it gets to at least the pending State that's when we know it's ready to be to be used because what we really want to do is to deploy the the cairo1 smart contracts that we were I showed you before that we have in BS code okay so it's not the pending state so now we technically have now uh a user account that we can use to deploy and to involve transactions cool let me just clear here and let's go back now so before we can deploy a smart contract understanding you have to first declare it the reasons will explain it in the next session but for now we're gonna execute this command I'm just going to try to explain what it what it does so basically it's going to upload our Sierra the Sierra code of a smart contract using this account to pay for fees for gas fees and declaring is the previous step before you can deploy because on a study you can deploy multiple instances of same declared code without talking more about that when you go to account strategy for now I just follow along so when we try to execute this send this transaction to test net it's gonna fail because this smart contract was deployed was declared before actually by me so you should tell me there's an error yes the error is that says the class hash the blah blah blah is already declared right and that's what I was expecting that's fine it means that I can just go directly to the deploy I don't have to declare but because sometimes you don't know it's better to just try to declare and see if it fails and you can move to the deployment so oh wait did I copy what was the address that I used the address of my account just a sec I had to find out which addresses send a account number to Student Center address sorry just a moment right yeah I forgot to take note of what was the address of our user account and now I have it because we need to send the deploy transaction uh let me try again to declare because I need to take note of the of the class hash which I didn't do before so so that will are having trouble using the you see the full set so it's learned understandable we are sending you you or David do we have a method to send it needs without using the faucet right now not right now uh there's something we thought I know how to how to do better because we know that faucet has a limitation yeah so it should help a lot of people right now asking for it yeah I know it's something that we that's why we yeah we kind of knew but it's hard to get around hopefully that's one of the things that we need to improve for next time we do Basecamp for sure so to deploy the smart contract we need to provide the class hash that is provided here in the previous account I'm just going to remove this because this is that previous thing that I did comment and the class hash is here and with this we should be able to deploy our smart contract okay so the transaction was sent or deploying or smart contract we can follow along here I need to remember to not delete anything from the terminology because I need those addresses and paste okay so this is transactions to deploy the smart contract that we wrote in Cairo One so we need to wait until it gets to the pending State before we can actually start interacting with it so let's wait a couple of seconds is there any question in the meantime Omar no no uh will there be a gross based CLI and the answer is yes that would be it will be strong but don't but don't worry depend on what is going to be working and it's going to be the same uh also a lot of people are asking for it maybe it might meet if you have some heat and you can help me send to Thomas please that would be great in the meantime that you know that all the transitions that I made I send you the address the the date and you should be able to find it in your now you can deploy your wallet because the transactions were successful so you can they blow your games yeah so our smart contract has been deployed so we can actually now interact with it because you know the address this one and as we can see you can see first of all there is a carowind smart contract and we can go to the read write section and if we compare it to our code you can see that our smart contract had two functions one to increase balance and one to get balance one two this is read only this is for modify the state and if you see in this storage you see they get balanced right now it's going to be zero because it has no value but we can actually use the right to increase it I'm just going to collect oh the connect the wallet wait a second that's one thing that I didn't prepare for to install a wallet here so let me just do it on my Mac copy it while let me just clean this is Bridge girly it to start yes we can you can ask you can get some eats for example you see enough faucet and remember the name Paradigm has a faucet that can give you girly hits to layer one so you can send it to your metamask account for example and then from there you can reach it using the bridge but I will send you the name in the chat and you can reach it to the uh actually Clement already share the bridge thank you very much equipment Stargate dot starnet.io it is on the chat so you can use that to reach to connect your metamask account to your Parables or rdn account and then you can bridge that it to your account so it is relatively simple yes yeah sorry just gonna sometimes like okay we can go back to questions after so I think some people might be leaving right now most of the time so is there any question what is it sorry what is the the homework is there any homework or sell it in the in the email I'll send an email with the instructions okay listen gentlemen thank you guys all right so I'm just gonna uh send the value plan to increase balance used in my wallet status transaction and then we wait a little bit until it gets to pendant state so we should be able to do the the read operation and see the value of 10 coming back so it's way a little bit let me see what questions we have when will the minute support everyone okay we answered that one somebody oh are we are we sure Omar that is deployed to Cairo One sorry two minutes because Michael is saying oh no no it seems like uh it's a little bit more complex like and the the like a contract has to be interested for a while and then it can be uploaded to the minutes so we cannot do it right now gotcha they know that foreign state which is a little bit it means vlog while we wait for that and only and Anonymous attendee is having an error while you blowing the account it is called it started error called uninitialized contract it is likely because you can send it to your accounts you first have to send to the address of your account date and then you can deploy it is sorry I thought you were finished I could read the balance again now I get the value 10 so to confirm that actually our transaction went through and modify the state of smart contract so now we can read the new value so that concludes the tutorial to settle the environment it's a long one it's a complex one again Chiron is fairly new uh so hopefully just to do a brief summary we had to install rust Python and node.js we compile the car one binaries using rust then we configure those banners to be available anywhere uh add into the to the path then we install also Cairo Lang and we sold python to be able to execute Caroline and we installed the vs code extension as well so you get this nice syntax highlighting and some easy errors to spot there when you write uh thank you very much for staying so long it was supposed to finish a while ago but it took longer hopefully it was useful you have the guides there and if you have more questions please use Discord and hopefully you will be able to use the faucet eventually and get some tests if yes also if some some of you are not able to to get some it let us know please in the telegram so I sent it to as much people as possible I I run right so so I will need to recharge but let us know if tender up Blitz I won't be able to to store all your addresses right now but send it to the telegraph or break sheets and thank you very much to do Clement who help us loading this also blind thank you very much and Glenn mentioned also something very important that you have to change your contract cash okay no words we'll see the next the next time I'm related to the book so thank you very much folks thank you take care see you next week bye we'll send you an email wait for it thank you
Automatic transcript — names and jargon may be misspelled.