StarkNet 🛠️ Basecamp Session 1: Fundamentals
ETHGlobal·Wed, Oct 9, 2024, 12:00 AM
Join David Barreto of StarkNet for a workshop titled "Basecamp Session 1:Fundamentals" in preparation for ETHGlobal Istanbul. From November 17-19 2023, ETHGlobal is welcoming builders from around the globe to help shape the future of Ethereum at ETHGlobal Istanbul. $500,000 USD in prizes are up for grabs at the prestige ICC Istanbul Congress Center... you're not going to want to miss this! ----------------- Follow us: https://x.com/ETHGlobal?s=20 Check us out: https://ethglobal.com/ Email us at: hello@ethglobal.com
Transcript
[Music] so welcome to uh Base Cam cohort 4 this is a session one one of seven uh okay my name is David beretto I'm one of the developers Advocates from starware focus on starnet of course uh you can see here my socials my Twitter my blog as well and I'm here with also man meet and Omar also developer Advocates from starware so in this cohort of basam cohort 4 we're going to have seven sessions in seven weeks um each session last for two hours what we expect roughly is that out of those two hours 90 minutes going to be the presentation or some live coding uh we have 20 minutes for for questions uh which you don't have to wait for the end or just whatever question you have use a Q&A and and manmit and Omar will uh do their best to try to answer them if if any of you don't know the answer you want to discuss it please Omar man me 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 basam C 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 or not just take bcam as a way to learn everything about stet and Cairo it's up to you how much you want to get out of that um so we don't have any formal grav 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 share the link oh that's a good point yeah okay let me file share publish is that a Q&A yeah can type an answer the chat that so it stays there in the chat as well okay yes please right that should be working is it working for you Omar M can you open it or anyone in the chat can can let me know if you can open the slides okay cool people are able to look in slides so as I mentioned we're GNA 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 dep environment setup in our machines and to deploy an example of smart contract to St so you get to interact with the network as well session two next week is going to be a deep dive so basically it's like a part two of this same talk today session three is a is actually about KIRO one going through the syntax and if any of you have been on at stock there for a while you will know that kro Z is a very different language from car one so we want to take some time to go through all the details about syntax session four is about testing and how to you test car1 smart contract then session five is about the stet architecture we will see some architecture today at a at a foundational level but then session five we're going to go deeper into it session uh six we're going to look at kyo's architecture because CYO 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 proofed that underpins um Stark net okay so some things that that you should know uh is that after each session you will receive an email that's going to have a link to the recording it's going to 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 question use the Q&A because that way we can share with you after so you have it as a reference we also going to send a feedback for because we want to hear from you guys how do we improve Base Cam session not only Bas cam as general how do we improve from next session for next week so please give us your feedback uh we're going to tell you what's going to be the homework in the email and also a form so you can submit uh your homework in this case any GitHub repo or your stagnate address where you actually deploy it use a Q&A system to ask question instead of the chat and use Discord to get help from peers so if you provide your Discord username when you registered to bcam you should already been added to a private channel on Discord in the stet on the yeah the stet channel the startet city 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 starware 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 can not bypass so I'm sorry that's one of you um if that's your case please use this session to ask all the question that you have so for today's agenda we are going to cover why Cairo uh why stagnate so CYO the programming language stagnate this the layer two with with Kyo is is used we got also see uh a basic view of the stagnate architecture with we're going to do also basic view of car one we going to discuss some of the tooling that you have available as a developer we're going to have a little break and then um we're going to do some live session setting up uh a basic Dev environment from scratch so I'll be using in this case a VM with duu so you can see the whole process from start to finish and we also have that documented I'll share the links to where that is been documented any interesting questions Omar man me to discuss now live you can vote on your favorite question the Q&A as well so that giv us more visibility right we we lost some ad [Laughter] me uh so this is some question here which disco server channels is dedicated to the bootstrap the boot cam thank you uh it's called boot cam uh sorry Base Cam C 4 um yeah that's inside of the stet Discord server all right uh let's get started so why why Kyo 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 as one like a robot to to a planet let's say Mars so of course you have to do a bunch of calculations inbe the most important one is when 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 computing power so probably you will go to your engineer and say hey could you write driving in the algorithm and some very high performance language like rust for example so we can get those result we can just know those two variables the best launch window and the best trajectory so sure enough they create the algorithm uh but it's very complex and 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 super computer because you know you're are in a small country you don't have access to aot of resources but there's a rival country that has Miss 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 Rival country they execute it 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 do you know that that is the right answer that is actually the result of executing your programing exactly the way you write it I didn't know that the super computer didn't malfunction 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 competition is performed could be a disaster for your 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 with any traditional language you cannot have that certain thing not even Ross not c not any language but with Cairo you actually can because car is a has a provable language that when you executed the the rep scenario this this time you write the algorithm in Cairo instead of rust you provide that code to the supercomputer of the r country but now then because it's is been used with Cairo not only they give you the result back 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 get let you know in in known certain terms or in 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 modified 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 this case a laptop is able to keep a supercomputer honest and that is a superpower that only languages specialized like CYO specialized for validity proofs uh can provide okay just a sec trying to make the Q&A visible for me as well David just one question here we have uh channel for in Discord for these cohorts uh we do we do someone actually provided Bas cohort for how's the name ex thank you much shipping I saw that you 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 stet and then we will uh review the list again and add the new people that enter the server later David if it takes just a 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 know oh I why you can just open the window yeah it's opening yeah we yes no problem no problem go ahead David and yeah perfect perfect okay so we have a lot of questions here but we're try to answer them and let you know what can we answer live 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 inter with the audience uh let me see some of the questions at least the one have been voted that have not been answered already uh sir I skip the intro so what do I have to do to graduate can attend all the sessions 100% do the work we don't have a formal grad graduation this time we're going to give you homework it's up to you if you want to do it or not um just takes Base Cam as a way to learn as much as you want from Cyro and stet uh this is because we don't have capacity to access hundred of people submitting homeworks every week a reliable way and we realiz that the the goal here is just for you guys to to learn more anything yeah we can do cool stuff and and I don't know you will see that it has it goes to to something it will it will be worth it box says we really need have to focus on Kyro one no reason to do Kyo zero anymore more yes in this Base Cam we're not going to do any car zero it's just all about car one this time just be mindful car one is super new was just released to main very recently so going to be a little bit rough around the edges uh but it will improve over time how can we sure that the proof is not tampered so the probability of you being able to create a cryptographic proof that's going to fly verifier is one 1 over 1 billion * 1 billion * 1 billion * 1 million so it's very 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 Stark the math behind uh this uh validity proofs please turn on caption it will be super helpful you know what I try last time I don't know where it is can you Omar you're the host can you take a look to see if there's a way to enable captions I know the last time or some previous time we were able to I just don't remember where sure I look for these I don't promise anything what are you all right let me continue uh Omar I me if you see any interesting question please interrupt me and we can have a discussion sure okay we are we going to I don't know go ahead go ahead okay so to summarize why why CYO so first of all it allows you to create what's called a provable program progr 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 in that word is the key to why we use validity proof for scaling etherum we're going to going to look more into that in the next 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 CYO so why do we need stet so let's think about the issue of scaling on layer one so just a second it disable Discord because I hear so many notifications that are distracting me okay uh so in layer one in case of ethereum we have what's called a Blog producer which is going to give you okay it's going to tell the network hey here's the 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 going to take the word uh for it and say oh yeah sure it's 42 they will actually execute independently the same blog in Fair ify that they all get to the same result independently so that's the that's part of the consensus that the actual result they all to 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 re-executing the same transaction over and over in the case of a starnet we execute only once but then we verify everywhere so when you on a stet 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 reexecute 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 reexecute 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 visually here why a layer tool like a stet is so much much more performant because now you don't require every single note of the network on layer one to reexecute 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 end steps right the execution done by the sequencer on starnet 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 going in the diagonal is actually uh the amount of steps of certain computation and you can see the red line is the amount of steps of the verification of the associated cryptographic roof so the bigger the gap between these two curves the more you achieve in Saving computing power from the whole netor or to achieve the same result of creating new States so you can think of validity proofs uh at this analogy validity proof is to computation what zip is to a file size it's all about compression just in the case proof is a compression of computation while C is a compression of file size um let's see any interesting questions any question here Omar mmid yes if I is asking what is super at honest superc computer honest super computer uh you don't need the super computer to be honest uh as long as they use the CYO VM uh and you have access we're going to have to see you you need to have access to the underlying Ciro program so we all have an agreement which program is being executed but as long as a super computer use Kym 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're trying to cheat do you when you say oh sorry when you say cheating and being honest what do you mean like what is what is cheating in in this context chy will be trying to create a validity proof that 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 they should have done okay and in you've been trying to fool the verifier that you have on your side so it's the it's the it's the combination of both that give the security of a system okay thank you SEC stage uh please people in the chat please use the Q&A don't use the chat for questions so we can keep track all right yes we're focusing on the on the on the Q&A and also David here's a question how can as Leo join the Discord I guess they simply go into the Discord of of stet join and what yeah if you can if you can share the if you can share the invite link to the Discord server um put the be helpful oh also let me invite you to the telegram I will send you a link in the chat so you can join the telegram of English speakers H it's for only for Builders so if you want to go there and we can yes 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 the zero knowledge proofs 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 input so you can think about about that is like doing the right thing even when no one is looking that's a one way to think about computational integrity so we use validity proofs and CK proofs not for privacy which is a common misconception about stet we use it for scal in ethereum as I showed you before the comparison of the layer one and the layer two validators uh so Star right now is not about privacy it might be in the future but right now it's not that's why we think the ZK rollup is a misnomer because it can imply some privacy we prefer the term validity rup or stet and to be fair pretty much any other C rollup out there uses validity rollups none of them to my knowledge actually are focus on privacy after I think Aztec shut down their own Layer Two and very importantly the type of ZK proof that starnet uses is Starks we don't use snarks probably have heard both being s proofs uh but we use Starks and there's a important reason why we chose to go with Starks and snarks that I want to review here so if you compare these two typee of ZK proofs uh the verification time for for a stark proof is poly logarithmic right if you recall the the chart that I showed you in the case of a snark is actually constants so it doesn't matter how complex the underlying competition is the amount of work to verify the competition is always the same now the proof size that we sent to layer one for verification in the case of Stark it's pretty big is about 400 kilobytes in the case of Stark is pretty small it's only close to 300 bytes so it begs the question if it's not are so much better star why did we actually chose a stark and not snark for stet there are very two important reasons for that first of all when you use a snars you have to go through the trusted setup the the The Trusted ceremony where you have to fit the system with a with a secret and you have to make sure that the secret is properly disposed because if that secret is being leaked the whole system is compromised uh in the case of Stark we don't need a trust setup it works even without that so it's it's one less trust assumption for the security the system also very important the Starks are quantum secure which snarks are not so whenever quantum computers come on line with sufficient power they will actually break a stark 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 at least we'll be thinking David good question here so there are some people that join the Discord of starnet what they have not been added yet to the channel so what what will we how can we proceed in that case if you if you join 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 would you register uh and we will try again to add you to the server some people might try to join the starware 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 maybe they can send their Discord ER name in the chat right and we can yeah Omar if you can take that note of that it will be super helpful perfect okay so you maybe maybe start Q&A and and people add their Discord username so we have one place to track all the people were added to the channel oh I think it's okay in the chat we can download it and then can okay so so please add to your to to the chat your T your your Discord name in case you haven't been added to the Discord Channel and we will let thank you okay let me see more questions I wonder is this a way to hide the one that's been answer okay B answer is there a possibility to keep the algorithm private so the super computer cannot steal algorithm and they use it later and not now no because as I mentioned the starnet is not about privacy it's about scaling and so you have to share the AL so basically when you use a starnet you have to publish your smart contract so it becomes visible to anyone to use it if you answer it David please please C go answer like so we know you already answered and okay there's some questions from Fox from X top so man you know that there are okay what do you think about the SNS using a thrusted without thrusted setup they are using some kind of brfs what do you think about them that I'm not sure I haven't dig so deeper into the to know what's the implication but I know that for ethereum there's a push right now for kcg commitments I think that's that's part of the the the secret right we're all collectively creating a secret to fit into the system to provide security to to the to the stocks uh so that's why it can be done but then you have to make sure that you do the kg commitment ceremony correctly can I second uh so real quick so when you have a circuit and the verifier has to read it so basically you have two parties Prov and verifier all of the trusted set of y y y 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 as been saying go through some sort of a compression process from circuit to compressed information and then that compressed information is what the verifier reads this compression requires in the case of snars which is the first protocol we 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 ver the prover can basically cheat and create false proofs 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 STS require no um no Randomness to generate they 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 and fundamentally Superior Tech stack I guess there a very interesting question from zering iser that says aside from blockchain where can Cyro be used let me try to I see some very good answers already from from your peer 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 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 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 car you can technically request your client to every every so often create a a validity proof out of the execution of your client and send that Val validity proof to a server which runs the verifier just to check that you are not cheating you actually joing the client 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 uh and there are 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 uh resource intensive process so there's a lot of research that needs to be done uh to get to that point but it's an interesting thought as well how to use Cyro in a different setting that is not stagnant they also we also doing something with Bitcoin right oh that's great yeah can you explain you elaborate any of you I can I have not very aware of what is happening but I know that there is something being built I will send you the report to the chats something is being built I don't know exactly what what it is in order to scale bitco should start and here been very successful withing the B community so you know that's something that's something we can say about it and also maybe there's a question about the pro will be open source let me first ask answer the question about the Bitcoin uh actually that's something that the the bitco community is very well aware of I think the ethereum community 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 a cryptographic proof or validity proof is generated out of a regular Bitcoin client and then when you want to sync a new Bitcoin C 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 that other server actually perform for you and then you can sync to the latest UT exuse download the database and verify the cryptographic proof associated with the execution to get to the current utxo so now you can zc a Bitcoin client in a matter of probably minutes instead of days I forgot the name of the project was it zero Clement here has here think Clement KET here added the the link to r with the chat thank you much Clement you can go and see it to be honest there's a lot of very cool stuff that is being buil right now at the at the edge of the technology so and it the star Comm is amazing to to the honest is amazing they are beinging some really cool stuff and yeah it's really and D do you want to to to do the 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 want to decentralize also the sequencers before we can tackle the the the PR but it is the goal to decentralize the whole stack just not yet we're not at that level yet so right now the sequencer and the pr are actually centralized which is the same any other every other CK R up right now that is centralized there's all than actually open source yeah go ahead okay there's also a question from Paul asking can you explain why start is when to secure and not start so real quick the the part of the cryptography that is being vulnerable right now to Quantum attacks are those using elliptic cor the cryptography such as stars and ethereum and Bitcoin and so on and the stars are not relying on this kind of Primitives not they're not using litic cors they're using H functions as symmetric key encryptions so it is beli that this particular primitive will be Quantum resistance so that that's the reason the el cor cryor 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 elliptic curves using quantum computers that the algorithm exists it's just waiting for a quantum computer to be sufficiently powerful to run it and they will come they will when we have that so a lot of devopment has been done the quantum Compu inide so yes and one of the goal they have is actually trying to break use this this to break thetical compy is actually a medic for how good the these computers are so it will come a day and what when that day comes the first thing they will do is break this liography yeah all right thank you for the question um me Omar feel free to keep answering them on the Q&A I just GNA keep moving forward because of time constraints all right so you probably have heard like and stagnate we use the KOB VM we don't we don't use the evm so so why is that so on one side you have ZK EVMS right which some famous One are like the polygon hermis uh scroll CK sync they try to be as compatible as possible to The Ether virtual machine while the stet is actually using its own virtual machine called the cobm so these two approaches is trying they're trying to optimize for very different things so seeking edms trying to optimize for having Max compatibility with current smart contracts deployed on ler one but they sacrifice 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 km or or a star we decided to create our own virtual machine so we can create a or model a computer that is exactly or fine tune for validity proofs so we thinking about how do we strike the most performance of the network long term ad me do you have any more comments you're more an expert of this area than I am probably uh I I I would leave it at that today uh and not de but we can but yeah the Bain differences of course you can compile your code directly into ebm by code on zkm with us you have to go through uh Sierra and thebe I I'll let you speak more about we 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 Kyo actually looks like well how the the Kyo VM actually looks like um just a quick comparison if you have read vitalic article about the CK ebm classification he classifies CK evm in four categories type one to four so type one is basically uh no changes to the E theum ver machine full compatibility but the performance will be very very slow to create the cryptographic proof out of those execution so pretty much no one is attempting this right now uh type two is that you use most of the evbm but you change at least the data structure for storage you achieve High compatibility at least you're going to have some smart contracts that you will need to be modified but the performance still varies slow then you have type three where you have compatibility but you have to modify something like storage hashes pre-compiled 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 a layer two with this characteristics the performance still going to be low at least uh in theory technically and we have projects doing that like scroll polygon Hermits seeing even karot which is a layer three on top of star are actually tended to be type three CK EVMS but then you have the type four where they Implement a completely different virtual machine they're they're not compatible uh with the spark contract Deploy on ethereum using solidity but the upsite is that it's very fast to create the validity proofs so you have two main projects competing in the space obviously stet is one of them and you can consider to be a CK Eva because you can use starnet with a compiler called warp to compile solid smart contract into KIRO VM and the other one is polygon mining so we are really focused on performance and long-term view of a scaling ethereum okay to summarize maybe yeah maybe quoting here elen s he said like we really believe in star war that the future of scal will be built using Kyo Kyo orm because D say the only focus of car the only focus of is to scale that is not the goal of the evm right the evm goals is to maximize centralization which is great and it's very relevant well in K we're already given as a we're already thinking as a given the part of the security and the calization that the the gives so now we're focusing only on scaling and that's why we really believe that car is the way to to to to SK F the problem here is of course image from from David's show there's already inum building to link to link of boundary we have Prof and so on and and those we don't have in in KY or St we need to build a new tool link however the tool link is being built by the day so we have Proto star which is kind of similar to Foundry we have a actually Dr full no sorry which we have several apis and SDK that we can use to interact with the start and Kyo so toink is getting much much better so we are able to write K and scale both the part the social parts and the scalability as lower fees and faster faster transactions cool thank you Omar all right to summarize why is tet first of all it guarantees computational Integrity without re-execution uh proof verification is cheap than the underlying computation so remember the poly logarithmic relationship with the underlying computation we 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 at least not yet and we use CK proofs we use Starks CK proofs and not snarks because Starks are quantum secure that's really the main reason we thinking long term and this is why we have the tradeoff cool let's talk about at a high level the architecture of the stet so in in my previous example the story about the you know the the head of his space exploration the the person actually got convinced that the result is 42 whatever that is right because he was able to verify indep pendal the the cryptographic proof in his laptop but then how do you how is other people going to trust that that is actually the result right because so far only this guy was able to verify the vality 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 chiropr publicly accessible for anyone she should be able to independently verify the proof basically run her own layer to node so she needs a starnet so starnet is a layer two right so that's why I present here ethereum at the bottom as layer one so on a startet when you send a transaction uh you send the transaction to What's called the sequencer right and the sequencer is is like the block producer of starnet and it uses that's where the CYO VM lives and also where the starnet OS leaves and the sequen is 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 been able to use this user account it's going to 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 this case the interesting thing here is that out of the execution of all the transactions in a Blog the sequencer sends uh what's called it execution Trace to the prover that we call it sharp in the case of a St sharp is because shared Pro it's used by stet used by Stark X as well so with this execution trace the pro is able to compute the the validity proof to attest to the Integrity of the computation done by the sequencer and this validity proof is eventually sent to layer one as Cod data to a verifier 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 validity proof and it's actually going to perform the verification on layer one this case is the 10 thousands of ethereum computers are going to perform this competition independently and if the verification 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 layer one a SC data to a different smart contact that we call a stagnate core and we use that as our data availability layer right we want to publish this data on layer one so now we can have full nodes or stagnate full noes who gets uh what is the state of the of the the latest blog or the state of the network it gets that from the sequencer correctly because as as of now these are two centralized entities but the fact that we send this state diff to layer one 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 to current state by reading or indexing data from the stagnate core smart contract so you can recreate the data from layer one independently if you if there's a situation that that the sequencer stop responding to uh later to full nodes so at a very high level this is how stet works so I I went through some of the uh modules so as I mentioned the sequen validates executes and bundle transactions into blocks the approver creates star proofs for a stet and a star X that's what it's called sharp or share prover the verifier is a layer one smart contract verifies the St proof send from sharp St core is another layer one smart contract that just stores a stor is is a big word because actually we only send it as C data it's not get store at the contract level storage or cost reasons uh and we use that as a the data availability layer finally the full node provides data to layer to TS David second yeah questions perfect so regarding the start of your presentation there was a question from alel sorry for coming there are a lot of questions answering each of them so I ask H do we send the algorithm or the data to rival country when you were talking about this parts we send it Oh you mean the the example at the very beginning yes at the very beginning so what are we sending the algorithm or the data 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 bu code of the program right the the lowlevel chiro assembly program to the to the super computer okay yeah yes thank you very much need lot of questions M go ahead go ahead more oh our our is asking can you use different data avilability layer like celesa for example yes we're working on on the valid use which is going to be Innovations where we will be able to do the the the data availability part using different different kind of services for example Celestia p a USB if you want so it's going to be very interesting you will be able to write chiro codes where you can declare varibles that are going to be store in the onchain and some variables that will be not store onchain it will store I know of chain or maybe sesa or somebody else so like that would be very very cool with B yeah yeah just comment it's called volition because validum is what uses so we have three different data availability modes right now only two really rollup is the one used by starnet will be polished to L one validium which is used by Stark X that we are not covering here with another technology developed by starware and then we have volition that we want to we want to implement on the starnet I don't know this year at some point which is going to allow you to choose where to store your data so you have different cost for your transaction you're going to store it on layer one or having Maxim maximum security or do you want to store it in a some other place it could be Celestia or a consortion of of people storing data that's going to make B cheaper so we don't have a lot of details about that but we know that is a path forward for a stag to enable volution David do you have CU ISS for the link to the repo of the verifier smart contract ler one do we have no yeah yeah uh go to L think it's the carine repo oh wait it is it is you to the Caroline repo uh useful info important addresses the verifier address yeah here so you can is there is there a question here I don't know where the question is I put it on the chat but over can you please put it on the on the Q&A so yes yes the question is can we get the link to the verif contact so I I will all right so this is the link to the to the deploy smart contract to see the actual school you have to go to the kyol Lan on GitHub and and in here uh I think it's here [Music] darkware oh man I I know I saw it sowh here but I don't remember yeah I I can search for it it is yeah it is open I've seen it is there somewhere I need find it perfect cool uh section four so let's talk about car one like we just recently uh we recently released this new version of the language which is very different from Kyo zero but it's much better than Kyo zero so Kyo one is a high level language right which makes it easier to learn compared to Kyo Z which was more of a low level language the syntax of Kyo 1 is heavily inspired by rust which also makes it like a strongly typed language so if you know Ross you will feel comfortable with Kyo one uh when you compile a Kyo smart contract uh it doesn't directly compile to the CYO VM bu code which we call it the Kyo assembly it compiles an intermediate language called Sierra Sierra stands for safe intermediate representation because this is what allows to create validity proofs even when a transaction fails which was not possible before and now because of Sierra basically seeners are always compensated for their work even if a transaction fails and in the near future would allow for transactions to be red much in the way that happens on layer one so you can see on the right side you start with a car one smart contract 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 kasm and from the car assembly the execution of this car assembly by code by the signature that's where we uh derite the validity proof on the pro and we sent later one so take a look this is how it looks like an example smart contract on car one you can see at a 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 stru storage has to be the name and then you define all the properties of all the storage VAR variables um felt is still the data Neta type but then we have more data types that we can use that before in car was not possible one very commonly uses U 256 which is commonly use in solidity uh this is how you write to storage this is a syntax this is how you read from storage for now just take a look today is not the the day to focus on car one a lot just for you to have a taste of how it looks like and and now you this is how you define variables with the keyword let which if you use C zero you know that before it was four different ways to Define a variable now we have only one so it's a much nicer language to play with uh so there's a thing called Regenesis that is all about closing the Gap so as I mentioned briefly that in chyro zero transactions fail transactions cannot be proven and because they cannot be proven that opens the door for what's called a d 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 a validity proofs cannot be created out of a failed transaction in Kyo zero kyos K one actually fixes this problem but it means that eventually car zero smart contracts 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 starget 0.11 to minut it because before 0.11 minut it only supported Carol 0.10 smart contract right uh after the deployment the S 0.11 now both languages are supported car 0.
1 and Caro one at some point in time we're going to go through Regenesis mightbe four or six months where we actually going to disable all the Kyo zero smart contract and only Carol 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 deployed smart contract from Kyo Z to Kyo 1 while preserving your same uh storage layout the same storage u 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 got to disable all the car zero smart contract and that from that point forward it's only going to be car one that point on and this is where we are right now just at the very beginning of the migration window so let me to go to the summary and I sto for some questions because probably there's some so kind one car one is a high level language inspired by rust Sierra allows for rebooted transactions before we're not possible we we don't have re transaction just yet we need a little bit more um work on on this target to allow that that but it's now technically feasible to do it uh a smart contct can be upgraded from car Z to car one while preserving the state and their current address where this been they been deployed Kyo one starget supports Kyo one in the tested and on Main it as well and Regenesis will disable Kyo zero code and that's going to happen before six months in the future so let me stop here for four questions I by better s i there's a question from Anonymous attending it is possible is it possible to build circuits like Sil or Noir with K one I don't think so because this is a high level language but I not that 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 using like a like a layer three we can be able to to to use Noir and then that compile it so you can get KY so it would be interesting and actually Fran mentioned something before of you will you can be able to prove snacks into starets is something been work in Gaga I think yeah you can you can you can create your own verifier with Cairo right it's a smart contract it actually it exists there the stacks verifier there are different stack verifiers as well so really the you can Implement your own ler three right now and and not wait for a starware or starnet to evolve to the point that we make all these things that the official verifier available on layer to perfect also seph is asking can we expand more on Sierra Sierra will be we'll be looking that session six right DAV more about C uh probably I haven't we haven't discuss exactly what's going to be coming in that chapter but probably yes for now I just keep in mind that it's it's going to be an intermediate language when you compile uh in your computer before you deploy you no longer comp compile directly to car assembly you compile to Sierra and that's what you deploy to stet and then on a stet the signature compiles your Sierra by code to KY assembly code yeah this is a great invention and from for those of you who want to for example do audits security audits you can learning SRA will be key for you to it's it's very important it's like learning jeel for for layer one I see question yeah more question go I can see you can you can you order by most of because I see some question being un answer with four votes three vots yeah we're working on that we have so there's a question by GLE he's asking GLE by the way he's French Liv in Mexico heing so if the caliz start the sequen will be a full not and there will also be a full not that are not a sequenc right which means only sequences would participate to consensus and all other full notes are only Rel relaying data to depth or other notes is that correct uh a bank consensus so the how this place is Target going to look like is is a moving Target I don't have a clear answer of course the first uh 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 nodes I mean Sigma will they need to store uh the the current state of the network right as well as a full node but a full node can exist in inp penalty from a sequencer right you they don't have to be the same thing they can be independ and 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 glocky fire 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 also we have like clients right like beers being built also by the community we also have beus which is inspired by I forgot the name of the other the it's not Horus it's a ah forgot that there's a there's a light Cline developed by A6 Z or ethereum that we're using to build Horus on top of that which I forgot the name yeah which also what mentioning that Fran thank you very much he has been answering a lot of questions so thank you very much Fran ER what else can we do start with corion to reduce the proof size like the mea BR go with snaps is that okay can we do question we do we do do that yeah the sharp man 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 proof object per computation but then uh basically whilst we're still in the offchain environment we batch those proofs 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 proof down to ethereum layer one so in that way we actually getting hundreds of thousands of transactions through one proof object yeah on session four when we go deeper into standard architecture we're going to look at the how the pro achieves recursion all right let me move on the time is f take care if we have time at the end we will go back to Cs on this question but please try to access some of them uh directly on the Q&A um so some of the tools that you should have if you want to get into stet first of all it's a it's a a wallet and there are two main ones you have Argent X and you have braavos Argent X they have uh a browser extension uh as you can see for Google Chrome for brave for for Firefox Bravos the same also a browser extension but Bros also has a mobile wallet which is very interesting how they Implement that and how they use account abstraction so pick the one you like the most and make sure that you have installed your browser so you can follow along some of the exercises we have two different block explorers wcom 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 tool for developers one of them is protostar which right now I mean I actually was thinking about removing protostar for now because it's it's definitely a full rewrite of how protostar works car 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 used to program the smart contract in this case Kyo and also we have uh collaboration with open seing that they actually develop U smart contracts or Cairo all the best practices for you know es20 721 and and so forth other tools that we have available we have a plugin for harut if you want to test using JavaScript we have a defet similar to ganache as well if you want to run it locally we have a library for react for your decentralized app uh we have different sdks for different languages for typescript or JavaScript for python for Java cin 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 boort Kyo 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 time we have let's let's have sorry five minutes because we have we're going to jump into the live coding session so just have like a you know washroom breaks and get some coffee and we'll get back in five minutes sorry I'm just going to mute myself and turn off the camera and I'll be back back in a moment all right so let's go and set up u a Dev environment for Kyo one um so first of all just a warning we are going to be doing using a lot of tools are very new so we're going to be leing on the edge which means that some of these toolings are still uh Rough Around the Edges uh so we have two main repositories that we're going to use one's called Kyro Lang which is written in Python is where the we have the starnet CLI and where we have the CYO zero to to CYO assembly compiler right is like the old compiler uh but it still has the S CLI and then we have the CYO repo without line which that's where we have the Kyo one compiler the compiler to Sierra and then also we have a compiler from Sierra to kasm and I'm going to go into detail why we have two different compilers I'm going to 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 we going have to build it from source so you can uh have some you know syntax completion and validation as well so we're going to need uh three main languages for setting up this Dev environment as I mentioned this going to simplify stand goes by but for now we three we're going to need Ros to compile the carolan 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 going to need python especially particularly 3.9 to create uh an stet account so we can deploy and declare all the things and invoke to use this startet CLI because the chyo line where CLI lives is written in Python and we also need to sorry to declare to deploy and to invoke transactions on a stet finally we need nodejs uh for packaging the vs code extension before we can actually install it on our IDE so this is the plan for the like coding part hopefully you can follow along but we have the instructions shared for you here at at the bottom so first we're going to compile car one from Source then we're going to test that the compiler is actually working by compil a simple smart contract KY 1 smart contract then we're going to install the vs code extension for Kyo one then we're going to install this taret CLI we going to create a user account locally in your computer so then you can declare an example of smart contract you can deploy it to stet testnet and then interact with it uh using a Blog Explorer and a regular wallet so you have two links here at the bottom uh I I'm using the guide today but in the star book we also have steps for performing this as well uh so I'm goingon to this ends okay so let me I'm going to start a virtual machine so we can follow the steps from the beginning basically so let me see give me a sec to start this one two do this stall and start just well the VM starts and I log in share the screen in the moment okay I mean and I'm going to follow my own guidelines here sorry guys I just trying to set up my computer here with all the things that I need or can start doing live coding perfect great in the meantime cool I'll be ready so as I mention I have a clean installation of an Ubuntu machine the instruction for micos are very similar in the guide I put whenever there's a small difference I put there um comment like an 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 not why I came like that we need to use Curl to get it I mean see I can increase the font size of this I just going to with installation how is the phone size um not that good if you can zoom in okay [Music] yeah the size columns rows custo FS here I already change it ah custom fonts uh can increase it to hitting better now yes looking better what do what do you think guys uh they say it's okay perfect thank you very much make a little smaller yeah no small okay all right cool so I have Ross 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 I'm going to 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 R up version and yes so we have version 1.2.2 so Ros inst install as I mentioned we need rust to compile the caran compiler from Source um so the next step is to actually download or clone the the repo where the compiler for car one lips so I have this command here what all right so this is the repo where the KIRO one compiler lives and I'm going to clone it to a specific folder on my on my home directory just called do CYO I just want to have a particular location that I can always go back to because we're going to do some going to have to do some mapping of the binaries that's why I put it here so after CL it we should have it in the CYO uh folder so if I come here right so we have we in the in the ri story for car one so we need to activate a very particular tag the latest tag available in the repo because that's the the compiler that was used or supported right now by stet 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 repel story tag version one Alpha 6 right so we are in detach mode in this particular commit of the caran Ripple so now we can actually build uh all the binaries using cargo and using this command I'm sorry going a little too fast just because guide yeah sorry sorry so R and also is are asking if we can share the commands 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 if you can share again the link to the slides that will be cor oh okay right link to the slides publish the web these are the links where do I put it 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 SL before let's let's start the setup you see a link to the guide and I share this link to you this is the the steps that I'm following basically that you don't see on the screen just using a secondary screen but you also have this tarnet book as a guide it's just this is second going I'm following in this um session you should don't see it cool thank you really all right so going back here just a sec I'm setting up again my environment I'm Shing to the chat the link to the starnet book where you can also see the commands please bear in mind that the St grook is very very we're working on that but that part is is finished could you sh the link Omar I just no I I will share the link right now there okay to the start the book yes all right so 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 going to take a while so it's a perfect time to answer some questions uh perfect so let's see do we have when will the main support one my M it's live it is supported already you can deploy yes right there there's that problem that keep playing with okay it's a problem I would okay so we already share the M thank you much Crypt nerd and right if H in terms of conception from Ry from C Ry we're looking at that particular question we don't know right but man already asked internally to see if we can get an answer as soon as possible ramc thank you much for that what are the benefits of the car Machi versus Z gvms they have to be strong for DSL to win with solidity and thank you much Paul Henry he answer that the Kum is very specifically used by starnet yes exactly and the benefits are is that again that ter is focusing only only only on scalability and this is something that the ter machine is not focusing on they focus on other on other stuff like the centralization which is very relevant but the K has the only goal of scaling e so that allows to do certain kind of stuffs that make us scale without having to follow all the rules of the evm which that that are done for different purposes so the Caro machine should be able to allow for a for for more scal of that will be the main benefit h I you see any other question you want to answer right now David which one uh T is asking and I am Sor sorry for answering this a little bit late we have a lot of questions so T is asking most PR would probably be attracted to zero change because they are already bunch of Sol deps how easy will it be to transpile Sol to car in the future is it better for PRS to transpile or to create native on stet and if you love me David with there's let me quote here again El Sasson founder of the Starks inventor of the Stars founder of a star wark he said that indeed we have actually a seral gbn Theo is leading that development it is called out which FR already sh thank you very much Fran but any said our Focus here is to scale cod using KY so the real scale is going to be com from KY not from transp ERS like the one we have warp will be transing solid code into Kyro however building native kirro codes will be the real power of a stone so indeed there's a lot of of developers already for solidity but we think that developers can easily adapt so most of you I think you know at least two different languages I don't know maybe Python and and JavaScript or something like that and so I would only believe that that developers will have no problem learning care roles a Ione Sol also keep in mind that startet gives you way more resources for executing transaction that you that's possible on on the limitation of gas F 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 contract as is you're going to be missing a lot of interesting features for example I can 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 on startet everything is a smart contract everything is using uh a kind abstraction 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 contct exactly the same way as in ler one and it's wor mentioning that any Z knowledge project following the viral machine like the CK evm will have the same constra as the evm that me construction for okay H do you guys know any open source project that have myed F to Kyo so that I can to their codes you can I let me show you the link to the stet K 101 which you can already do I is is it's called as my way to K once I guess also and to testing I don't know if we we have a pro do testing so there lot of might work to one but they're doing it's maybe not open source or experimenting behind the the scene also AR I think will have soon their code K one so that will be very good but in the meantime I will share to you start K 101 tutorials that those are very very very good for you to understand how to structure your your code if if you want to learn start Cod Kyro code you can learn with it but it is also very useful to learn H the syntax and the way structure or project 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 has limited resources but we're getting close perfect perfect okay so DV is asking why not both the centralization and scalability start disoriented more to the second one but I don't see the trade off to Le in the B the first one yes sure well correct if I'm wrong here man me and D but started is having bation from te and the scal that is provided plus we will have the centralization in the in the there's there's no Layer Two that is the centralist right now actually we're working on that we're working on deciding how we have calization so we can decentralize the use of sequencers and so on but I don't know may if you want to to add something to this bar no the the goal is to decentralize everything right it's just it's a hard problem to solve it took e a long time to do it right will take us a while also to to do it do it right so we need to approach it first let's let's see that the technology works that we can scale and then we can decentralize we can we have to tackle some big challenges once at a time to do it right but that's the goal to have it completely decentralized but then okay any other questions wow we have a lot of question today that is great thank you very much for coming we're very happy to have you here I think those are all the questions that we can answer VI we did it oh there's a question from Leo saret what are the most interesting use cases you seeing of on chain apps that will benefit from being able to access more computer and but me this answering right now do you want to answer lifean Meats I me yeah just like the answer 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 toward ZKA aai um 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 is actually quite 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 sorry going back to the previous question about digitalization you can go to the St Forum that I put it on the chat link where we actually post our thoughts and ideas of how do we want to decentralize starets you can follow the discussion there in the proposal and you can comment petet okay anything you want to add the regarding star KY Brown and again no no again if you want to share your Discord in the in the chat so we can add you to the to the group we have a Discord in case you haven't been added yet please put your Discord there also join the T Community where it's h is also ful for in order to plan me tops you want to do some in your cities or you want to talk with us you have any questions please let us know there all right good news it finished compiling so we can move up the next step just clear the the terminal here so now that we have the Kiran compiler compiled we want to add these binaries to our path right so we can execute this V from any any place in in our 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 may be using 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 compiled version of the caran 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 able to find the binary so if this work goes well we should be able to call the stet compiler just to see the version and what is opening stand oh stand compile of 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 kir one smart contracts to see here so let's let's test that the compiler actually works so I'm going to create a a folder just like a sample project we're just going to put a very simple smart contract and try to compile that so just going to call this folder stet stet when I get into it and here 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 SM contract is and where the compiler folder so just going to call the compil folder Sierra so this is how my sample project looks like and I'm going to create um a file for my sample smart contract inside of source call it sample. Kyo okay so I put the tree again I should see the file so let me open this with vs code D quick question is there some kind of prer or ES link for K fer or ES link the closest will be this extension that we can install but it's not exactly as peder because p is a formatter so I will say not yet uh something that is link the the extension will will work similarly but not like preder that actually formats when you save or something like that you executed uh how do increase the phone size thank you this okay here you go yes so I'm just going to put a very simple smart contract right and just GNA basically we use this macro contract and then we create a module it's called Simple storage right for now today is not the goal to learn K one just to make sure the tooling is working as you can see we don't have any syntax highlighting or tooling or anything because we haven't done yet the work of install the extension but we have the smart contract so let's try to to compile it so here I can just do stet compile and I provide the file example CYO and then the output and it's going to be a Json file 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 it's working now the compon for car1 Next Step will be to actually install install the vs code extension and the source code for that extension actually it's inside of the Kyo 1 repo 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 going to get into it right all right we're in the right folder so first of all we're going to need to have a nodejs installed uh so in the case of auntu 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 on node version 19 let me just expand this more uh it's going to work let's see so in theory now I can do pseudo up AP update or I trying to install it so now I can actually try to install noes let's say okay so if it works well I should be able to do node 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 it JavaScript you don't really compile let's say you package it somehow so first of all we need to have install a global package uh called vs code V so this is what you do for compil extensions so install it globally it's under this name es this is provided by vs code so remember all everything is been recorded and will be all in YouTube so you will be able to we'll send you an email with the link so you can review everything that we're doing right now yeah and the guy that I'm following also we have shared with you the link so you're exactly what I'm doing is just documenting in a in a nice document there you can follow along okay so now uh let's install dependencies for JavaScript with mpm stall remember inside of the vs code CYO with extension leads okay that's let me just update my mpm just in case that this is suggesting me to do oops copy paste uh oh I need to do sudo this is optional all right so now I can actually package extension previous to be able to be install using this command package right that we install this binary globally from mpm now we can use it here this is just a temporary measure eventually the the the extension is going to be published to the marketplace and you will get it directly from vs C without having to do that but remember we leave it on the edge so this is how it needs to be done right now so now we have the package we can actually install it with install it to vs code with this Command right Sol 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 can see that is it is now installed car one it's called extension but we need to rec configured because it's asking for where's the path for this particular binary the chyo 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 that's going to be the target release let me just go back here go to Target this is where all binaries are placed this is my absolute uh let's say path to it just going to copy this going to put it here and slash with the name of the binary and I think I need to probably close this and turn it on again so it takes see let me close a vs code and oops I need to go back to my workf or maybe just open here and it's not taking okay now it's working now I get syntax highlighting and it's going to complain you do some things wrong like in this case right so it's a nice helper when you write caran code so cool so we have the vs code extension working yes om so is word measuring that as liit said I want to repeat that that we are not learning Kyo right now but we will do and we will have the chapter of the book ready for in a couple of days so you can start learning Kyo by yourself and then we can come here and already with more knowledge of Ky and we also teach you some KY and also we have some tutorials like starlings we will share in a minute so you can start also learning KY yeah today just about the the dev environment not really about Cairo but let me put a little more complex chyro code here because we actually want to deploy it today uh oh my God fixed yeah all right again I'm not going to really explain how this works we're going to talk more about Cairo in future sessions I just want to make sure that we can compile this and we can deploy it to St it so let me just recompile this we did before you ever go back to oh my God okay just going to copy this all right uh copy can I paste it here no anyway St net compile okay so we compil in the new version of the smart contract so this be more more complex now as we can see here right way more complex so this is the code that we actually deployed to starnet 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 the starget we used to use the stet CLI the stet CLI is written in Python so we need to have python 3.
9 in particular to be installed in our system so to install a very particular version of python at least in on one two you will need a particular uh PPA and this one here every timey this okay so I add this repository to my AP this because we need CYO sorry python 3.9 we install python 3.10 in might not work now I do update and 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 it all went well we should have now python 3.9 install version yeah there it is you do have it so now let's actually install the Cyro CLI um so to use the Cyro CLI to install it we need to have one Global dependency called GMP so you can use that this command to install it this is required for the Kyro Sor for the stagnant CLI not the chyro Stag CLI you need this Global dependency now uh let's go back to our project we were working on uh call it stet test we're back to our project and I'm going to create a virtual machine here for sorry a virtual environment for so when I install packages I don't want to install it globally just want to install it per project so to do that you do this command you define that you want a virtual environment and then you give it a name and just going to called CYO uh right then you activate the virtual environment so you can start installing it's called CYO CYO pin activate so as you can see now we're inside of the Python virtual environment so we can stall the Caroline package just before I do that I just going to upgrade pip to the latest version just to be safe and now I can actually install chyro line install line which is going to give you the St T see and it's install for this particular project not installed globally if you on a Mac this might fail I put some instructions on the guide was the alternative command that you can run on a Mac because happened to me that it failed so I found a 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 starnet which is the one used by the CLI and there we have it we have 0.
11.0 point2 perfect so um so what use is the startet CLI in every command you will have to Define to 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 start every wallet is a smart contract and you have to Define to the CLI how this smart contract looks like and how this smart contract is able to verify signatures so to be able a little bit easier for now and not going too much into detail until we get to those sections I'm going to uh Define two environmental variables on my on my shell that the St CLI is going to use and going to make us our comments look a little bit simpler so let me open uh the a profile configuration make HRC uh what open right now go to the bottom and I'm going to add two environmental variables uh one is to tell every time I run the stet command that always targets the test net Alpha girly instead of main it right I don't want to spend money right now and also to tell them because it's a kind abstraction which type of wallet I want to use to sign transactions so I'm using this one here okay so this should be export as well it's not export export I see it's using an a verion of the open sing wallet okay this looks good so I should be able now if I I close my terminal and open it again should be able to access these environmental variables we do Echo uh star net Network there you go so it's install 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 uh startet test let me activate again the virtual environment for python iro P oops activate Okay so take because the stand 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 the stet new account and we give it a name oops right here right so using this the CLI to create a new account in my computer and I'm going to give it a name just go the 0.11.0 point2 right so I can have different wallets uh once the the network keeps upgrading so by doing that is not going to create the user account yet it's just going to give me the the address because the address is always it can be known uh before you deploy it because it's just an algorithm that will be always the same so this is will be the address of my user account while I deploy it so just going to 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 a count counterfactual deployment I think it's called This is a common feature when you have a kind of struction so I'm going to send a small amount of e to this address so let me open I think you should have I should have a wallet here in this VM that I could use oh have oh no maybe I don't have 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 without sharing my key or anything just a second all right okay so as you can see I have Bravos here another account which already has some test e on girly so I'm just going to send some test e there so I need just to copy the the address and from here just going to send some amounts it's send 0.05 sayest if so I'm using Bravos it says that it doesn't exist on chain which is fine uh this is the counterfactual deployment we're going to talk more about that when we talk about account straction in future sessions we not just follow along all right so I've sent a transaction to stet testet using my wallet I can follow a lot of transaction here on a block Explorer so we need to wait until the transaction get at least to the pending State before we can continue so I think right now on test NS blocks are produced every 3 minutes if I'm not mistaken that's why you see the counter so let's wait a little bit let me increase the font size so 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 onchain deployment of my user account okay this is a feature of account obstruction hopefully we can make it easier for you in the future with tools like SC that we haven't told about it yet questions in the meantime Omar or people just post questions yeah we don't have a lot of questions we have a question from Michael sorry Michael for rep he's having some trouble combining I there are a couple questions for you there Mich are you are you using a Lo local Michael and the second question is are you using what version of the compiler can you check start it SL compile SL SL version please or if you're using scarp let us know scarp is using the the newest compiler version because I think there's a problem with that part ER okay D is asking it will be nice opportunity to show G faets 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 faucet there you go I'm going to put it in the chat the link to the faucet where you just put your address and it will give you some amount 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 I don't have time to wait 10 minutes that's why I went the other way but if you have more patient you can use it this way you will get some test e on your address okay so now that we have yeah Omar go ahead so sorry David here G okay okay go ahead go ahead Li mention is something very important in the chat but we can go ahead and mention it later okay so now that I have uh test if associated with this address I'm actually going to de my user account which is a smart contract to this address so let me get back to my notes put in my secondary screen okay okay okay so to deploy my user account just clear the screen here I use this command so again uses the started CLI now us 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 testet and you can see so it sends the deploy account contract transaction so we can follow along the transaction using this hash on Stark scan star scan are you that's that but 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 KIRO one smart contracts that we were I show you before that we have a BS code okay so it's on the pending state so now we technically have now uh user account that we can use to deploy and to invoke transactions cool let me just clear here and let's go back now so before we can deploy a smart contract on EST you have to first declare it the reasons we going explain it in the next session but for now we're going to execute this command 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 Target you can deploy multiples instances of the same declared code we're going to talk more about that when you go to abstraction for now I just follow along so when we try to execute this send this transaction to testnet it's going to fail because this is smart contract was deployed was declared before actually by me so it should tell me there's an error yes and the error is that says the class has 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 you don't know it's better to just try to declare and see if it fails you can move to the deployment so oh wait did I copy what was the address then I used the address of my account just a sec try to find out to which address I send the the account Lo number trans center address sorry just a moment all right yeah I forgot to take note of what was the address of our user account but now I have it because we need to send the deploy transaction uh let me try get the declare because I need to take take note of the of the class hash which I didn't do before so some people are having trouble using the using the foret so it's very understandable we are sending yous or David do we have a method to send it needs without using the foret right now no right now uh there something find now how to how to do better because we know the faucet has the limitation yes we have a lot of people right now asking for yeah no 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 thing that we need to improve for next time we do Base Cam 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 a 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 for deployant or smart contract we can follow along here I need to remember to not delete anything from the terminal because I need those addresses uh paste and I okay so this is transaction to deploy the smart contract that we wrote in Ciro 1 so we need to wait until it gets to the pending State uh before we can actually start interacting with it so let's wait a couple of seconds there any question in the meantime Omar no no Michael is asking will there be a roast based CLI and the answer is yes there will be it will be strong but don't but don't worry the p on what is going to be working B so problem and it's going to be the same ER also a lot of people are asking for eat maybe my me if you have some eat and you can help me send to Thomas please Le that would be great in the meantime that you know that all the transactions that I made I send you the trans the the and you should be able to find it in your now you can deploy your wallet because the transactions were successful so you can deploy your your yeah so our smart contract has been deployed so we can actually now interact with it because we know the address this one and if we can see you can see first of all there is a KIRO one smart contract and we can go to the read write section and if we compare to our code you can see that our smart contract had two functions one to increase balance and one to get balance one to this is read only this is for modifi the state and if you see in this Explorer you see the get balance right now it's going to be zero because it has no value but we can actually use the right to increase it and just going to collect all 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 H why let me explain this ER Rafael is asking can we Bridge girly itat to start it yes we can you can ask you can get some eats for example you seen a faet I remember the name paradig has a faucet that can give you girly eats to one so you can send it to your metamask account for example and then from there you can Bridge it using the bridge with I will send you the link in the chat and you can Bridge it to the H actually Clement already shared the bridge thank you very much Clement star.
net doio it is on the chat so you can use that to brid connect your metamask account to your marles or ar account and then you can bri that it to your account so it is relatively simple yes and sorry just gonna we can go back to questions after perfect David just so I think some people might be leaving right now because of the time so is there any question what is the sorry what is the the homework is there any homework for next we'll send it in the in the email we'll send an email with the instructions okay we'll send you an email thank you guys all right so I'm just going to uh send the value 10 to the increased balance used in my wallet when side this transaction and then we wait a little bit until it gets to pendent state so we should be able to do the the rate 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 main support car one okay we answer that one it's already all are we are we sure Omar that is deployed to K one sorry K one to to minut it because Michael is saying no no no it seems like it's a little bit more complex like the like a contract has to be tested for a while and then can be uploaded to the main so we cannot do it right now go I didn't know that okay transaction is about to get to the pending state which little bit it means the blog well we wait for that an an anonymous attende is asking is having an error while deploying the account it is called started ER code on initialized contract it is likely because you haven't ER sent it to your accounts and then deploy the account so you have to first as they show you you first have to send to the address of your account the and then you can deploy it so there you have it now sorry I have thought you finish I query the balance again now I get the value 10 so to confirm that actually our transaction went through and modify the state with smart contract so now we can read the new value so that concludes the the tutorial to set up the arment it's a long one it's a complex one again car one is fairly new um so hopefully just to do a brief summary we had to install rust Python and node.js we compile the caran binaries using rust then we configure those banies to be available anywhere uh adding to the to the path then we install also kyol L and we sto python to be able to execute Caroline and we install 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 this was supposed to finish a while ago but it took longer hopefully it was useful you have the guides there and you have more questions please use Discord and hopefully you will be able to use the faucet eventually and get some test e yes also if some some of you are not able to to get some it let us know pleas in in the telegram so I sent it to as much people as possible but I I run right so so I will need to recharge but let us know in telegram please I won't be able to to store all your addresses right now but send it to the telegram or brids and thank you very much to to Clement who help us a lot in this also Glen thank you very much and Glen mention also something very important that you have to change your contract hash okay no worries we'll see it the next the next time and we'll add to the book so thank you very much folks thank you take care see you next week bye-bye
Automatic transcript — names and jargon may be misspelled.