Chee Chyuan: Starkpilled With Starknet | 4th Oct 2023 | Sunway University | ETHKL 2023
Ethereum Malaysia·Wed, Oct 9, 2024, 12:00 AM
The ETHKL 2023 conference is a two-day event that covers a wide range of topics, including Zero Knowledge Proofs, Layer 2, DeFi, Data infrastructure, security, and more. This gathering brings together industry experts and pioneers to explore the latest advancements in Ethereum. Attendees will have access to insightful discussions and presentations on various subjects related to Ethereum technology.
Transcript
okay our next talk is about stockpiled with stocket yeah our speaker is Chichen from the stocket foundation is's going to be uh as ambassador from the stocket foundation it's going to be explaining a bit more so for those of you interested in stocket this is the place to be all right let's give him a big work War Round of Applause as you welcome Chen to the stage uh to share a little bit more with us a little bit more about stocket all right uh you can take out the mic also if you want to walk around yeah just uh take out the mic as well like that uh yeah that's fine oh okay it works cool okay go ahead the stage is yours bro let let me give try uh okay cool yeah it works uh hi everyone uh thank you so much Ro for introduction uh my name is CH Tren Chron Chi orever Convent for you to mention I represent the S Foundation uh I'm an ambass at the St Foundation uh if you see me running around because that's because today I'm also an organizer for the event and I so happy for that I see all of you guys here listen listening attentively uh coming all the way from all parts around the world coming to Malaysia to give to enjoy IFK thank you so much for coming and I also work for nine as a developer so I got a couple of hats but today my my role is I'm an ambassador for stet foundation so my topic stock p with stocket so basically stock p means I'm trying to give you like the the tablet the pill the medicine to get you how can I stock stfy you like to make make you involved in in a world of stock in it so hopefully at the end always see up so uh first of all let me give you a motivation as to what my talk is about and why do we need stocket uh so what is the state of ethereum now so over here I um took a screenshot of uh the blocks uh that that has been produced on on mainnet uh this is an e scan expor website obviously if you want to check your blocks that's where you go and uh what I'm trying to say is that we notice that the block production is consistently at 12 seconds per block and uh we can we roughly see around like 140ish transactions in 12 seconds if you try to do some math it turns out to be around like 11 to 12 TPS uh and the gas price is around 70 go I've checked that and I just put it here uh to make it convenient so if we were to ask the question the question is how do we make blockchain in such a way that it scales how do we make blockchain in such a way that it reaches infinite amount of people with in line with the infinite Garden concept uh 12 12 TPS which is 12 transaction per second this doesn't make it this this doesn't make sense right we need to achieve like 1,000 TPS like even if everyone's using it in a con basis like 1 million TPS so and so forth so this is a problem that we facing today uh yes and one one thing I want to stress that if you were to perform like a simple swap on uni swap like if um you easily could spend like $25 is $23 if you want to pay your friends um uh repay return your friends the money that you he or she you spend on coffee which is like $3 but you're paying $7 $6 for a simple usdt transfer so your transfer is basically more expensive than two cups of a coffee so uh what what what does it mean it mean that uh it doesn't make sense for you to perform simple easy transactions on the meet anymore so what I'm trying to draw attention to is that uh ethereum nowadays it's it works it is doing what is supposed to do but it's not enough it's not enough to to reach reach what you want we want uh we want a million people to use we want a th a billion users to use we want a million transactions per second so and so forth so the state of right now tldr is not good enough and stocket aims to improve that and we'll see how it goes uh let me quickly explain like why why is this happening uh so in a in an typical layer one like in T for example uh what happens is that uh everyone uh creates a transaction sends it to a mempo and uh the block producer we then uh how say valid the block and what happens is that every single note in the space you then reexecute the block uh to validate uh to see if the outcome of the uh the transactions in the block are correct so that means everyone's doing the check so what it means is that even though like I produce the block like all of you are like participants in in the blockchain uh 1 2 3 4 5 like 2030 of you we need to reexecute the same thing over and over again uh we can think of this is like we repeating the work that your friend is doing and he's repeating the work of his friend is doing her friend is doing blah blah whatever so and so forth and um this is a problem that this is a problem this is something that has to be done to make sure that it's valid but it's also a problem because you're wasting a lot of resources and that limits how much DPS can go in the network right because not everyone can have a good enough machine to execute like billions and thousands of millions of transactions with a simple mac for example you can't do that because it's too too too expensive for uh exhaustive so to say um so there a couple of solutions let me introduce to you one of the solutions that people has used uh solution number one another faster L1 chain uh not go not going to name names here but we have seen a couple of uh so called faster L1 chains that appear like oh we we scale etherum we are faster we are cheaper uh this is the claim right so what they actually doing is that uh they they sacrifice on this thing this very important factor called decentralization which is what blockchain has preing about since day one they they uh they they how can I say they gatekeep not gatee keep they they price out uh users who are not aford not able to afford expensive machines uh because you and then and in exchange they the ones that running expens machines is get gets to run like the billion million transactions so let's say uh I have the funds to run like a one terab ram machine but probably he or she doesn't have it the resource then he or she cannot participate in network because you do you simply do not have the computation enough computation power uh to be be a part of the network and that is something that is a huge sacrifice so at end of day we can think of like we are pretty much going back to a centralized system there's no point of having blockchain if we were to do that right uh the web to World Works a bank transaction rarely fails so we if we were to do it to some point like why are we even talking about decentralization and why are we even talking about blockchain in the first place right so so uh the second approach that people has come up with which already been done it's what we call the optimistic approach uh so what happens is that uh one single party will run this very heavy execution but only one uh what the part what what this person do is that the person will send uh the data to layer one and optimistically that means you do not verify yet but you trust that the that execu is done correctly and what everyone can do in the or or in the system is that you can run this thing called fraud prover so you're going to always monitor the chain and uh you're always going to like uh do be like a fisherman trying to fish out like oh if any uh transactions that are made by this So-Cal sequencer it's malicious or not if it's so you're able to then you then engage called the fraud proof this challenge challenge you to challenge the sequencer in a back and forth man say Hey you have done something wrong if you are then you're slash and so and so forth so the good thing about this is that okay sure you only need one person to run this heavy extion and you only need one person to perform this So-Cal fisherman activity uh in a very uh correctly so you only trust one out of many people uh but at the end of day we're going to ask like okay if everyone is assuming that if only one person is running it like who's going to run it at the end right like if I'm not going to run it are you going to run it probably not like because running the fisherman thing could be could take a bit of resource that what is my motivation what is my incentive in running it so uh this works uh and it's mainly big by backed by this thing called Game Theory so it works it's working right now it's the good examples are optimism and arbitrum they are working very well this is another solution that uh people proposed uh the third solution is what we call the validity rollup approach uh where again similar to the optimistic approach over here uh one single party will do all the execution and the data that is being executed will then be published on theay one chain similar to how the first approach uh the second approach did was and in addition to publishing the data you also publish this thing called the the proof so you're proving that the data that the state changes are being done correctly so so thereby eliminating the need of a fisherman having to always monitor the activity of the chain so when the proof is generated and when the the proof is verified you are assured that uh there's no one uh that can there there was no cheating no no no malous AC no file play was involved in uh generating the uh data on the trans the state changes on L2 uh and this is uh based on mathematical proof uh and in stocket in example uh we uses uh stock proofs there are various coup of options and as a ZK track tomorrow for those are interested highly encourage to go and ask question over there there's panel as well but today we are going to talk about stocket and stock proofs um so as a result what happens right like this is already live it happen like couple of I don't know I thought when like last month or something like that we we have seen like a massive massive spike in TPS so that means we have achieved like2 Max TS already doesn't mean that this is our limit it only means that is the limit of the users us are not using enough like if there more users it could go even higher but this is the limit of user doesn't mean that St can only go to 126 126 TPS no it doesn't mean that way it means that we need more users on stet so so we can push the boundary you know probably 1,000 2,000 we'll see uh yes this is the result of um doing the second approach uh no third approach uh one thing I would like to talk about stocket which I feel that is uh very Innovative uh among the even the L2 space is we have this thing called a native account traction so uh we have heard of this thing called 437 uh instraction using out Mano has been going around people are talking about like gas extraction you don't have to pay native fee blah blah blah whatever that means that that means that if the validators are not doing that that means you will need to wait for another block to possibly get your transactions included uh what Native expression does is that uh without every single transaction it's an account by default and every single every single uh block will definitely read from this So-Cal Meo that accepts account instuction uh what happens a quick introduction is that what happens is that uh in the traditional world we are used to having a prior key being associate to a public key or or address uh in the account stru world you have one address you have every single account is a a contract and the your so-call public verifying key or public key is being stored on the contract uh in this and then uh what what the sequences will do the sequence going to run this entry point contract that will then call the verify plus execution transaction in one step so if your verification fail your execution fails by default so that means the ver veren stat is where you check uh the make sure that your uh signatures are being done correctly for the transaction so uh I mentioned verification as execution stage because they're very important uh in different in these two different stages you can play around you can Implement new cool stuff to it and over here I list out three very very cool use cases that have been implemented by a couple of people on the verification is where you're able to play around with your so-called private key you're able to change your private key but you are able to reuse the same account right so imagine like if I were to lose my private key uh in the interi world I would like I essentially lose all my funds that's associated private key in a ea wallet but when it comes to it uh account account contract account contract what you can do is that you if you have set up your uh smart contract to accept this called um account recovery mechanism you can probably change your password or even forget password it depends on how you want to implement it and you're able then retrieve or recover your uh your funds that is locked onto that uh account so these are one of things you can play around with the verification stage because that's stage where you check for the address and you can be a bit creative there you can even Implement like a m multi uh algorithm to check for multiple signatures make sure that you can then execute a transaction even multiple signatures so and so forth so it's up to imagination as to what you can do in this stage right uh and then you have this uh then after the stage you then call the the entry point contract we then all call to the execution stage and uh let me remind you of the current status quo as to how it looks like when you're trying to make a swap on unisoft V3 on mainnet so typically for a new token if you if you are trading between two new tokens what you're going to do is you're going to approve like multiple times like approve here approve here and then finally approve swap like so three steps if you have multic call probably it supports multic call maybe two steps One Step but but with a contraction execution stage it's support M multi call by default so everything is going just one step you can approve Swap and unapprove right everything in one step without having to like oh click oh wait to get mine oh then you click again like maybe you guys are used to it but that is not acceptable should we want to unbought like Millions users right like we are used to the this very quick grab thing swipe and you pay thing we want that to we we want to see that on on your blockchain space right so yes this is one thing that I really want to stress out U multi calls are something that is so so underrated so overlooked and I people this take for granted at least I did uh and this is how basically multic call looks like like you can see that uh this is a block Explorer on stocket it's Voyager a team I'm working for in Adine uh a bit of shoe there uh so in the same transaction you can see that there are multiple calls and these are happening on the same transaction so in Ean space you can only make one function call but because of multi call in on stocket you can make multiple function calls you can make two three calls five six seven calls as long as the guest to pay for it you're good to go and that's basically about about stocket like uh stocket has n account instuction has we we go through the motivation of why we need stet to scale blockchain and uh account instuction is cool and I would like to introduce to something that is very unique to starnet uh Cairo CYO is a smart language smart contract language on starnet uh first up a quick Meme here like you you'll be wondering for those like why do I need learn new language and for those who have seen stet you probably have seen it change over the over the months it's not a year over the months and alas over there like smiling over the months so yes uh yes why do you need to learn new language uh it's because uh Kyo is is Created from scratch right so that you're able to then uh create uh proof from the execution tra uh in a very efficient way so what I'm trying to say is that unlike the traditional solidity and uh the ziki event approach uh to make a proof generation very efficient uh the stock we team we wrote the entire uh wrote the entire language just so that the proof generation is very efficient so star CYO is built to generate proofs and you can then you can then go on to write Advanced machine leing models in a very intuitive way using Cairo and I mentioned Kakarot Z here because because they're great they are one of the great examples of of the US of Kyo they wrote the entire zkm stack using Cairo and the new Kyo syntax Russ like very expressive very explicit uh very readable as if you you like Russ you like CYO uh yes and I want to remind everyone that uh Cairo is a general programming language and on the subset of Cairo will be the St smart contract on star net so using the same concept the same language but but a different Library you can import different libraries for a smart contract you're then able to deploy your contract on stocket but not to mistaken you can also write General programming language as ZM such as an AI model using CYO as long as you want make to to make sure that your execution is provable uh Kyo is probably something for you uh so how how it works is that uh Cairo this step will uh will then do the execution and then generate the proof this is very hard step right and then you will send proof over uh to uh in a very small light computer and then you just have to verify the correctness of the execution so CYO over here is able to then transpile your code uh I mean compile your code down to proofs and then the proofs just verify the output in a very lightweight computer and there you go you don't have to reexecute it so this is simply uh basically the concept of me sending proof and you just verify it to ensure that the state change is correct so what are the alternatives to to to that to that to to that right one of that is one of the examples we have is circom we have writing ZK circuit circom is also trying to do the same thing you're trying to prove the execution is correct but circum is uh you have to kind of change your mental model in writing circum uh it's not like the language that we used to you have to represent all your logic in circuit uh you have to make sure that you constrain your circuits for Sounders if not uh there's a potential exploit on your circuit and it looks like this it looks very different from your typescript your JavaScript your whatever python that you that you uh that you used to and love uh it looks very different like basically if to learn a new new language entirely uh you have to change the way of think and it's I think it's very hard compared to learning CYO to be honest because car is like you don't have to change that much Le new syntax but so you have to kind of change the entire manal B so there you go uh other out is like Hello to uh h 2 it's basically do not have a DSL uh you still need to learn rust to use the library of h 2 uh it's another Beast sure it achieve great things you have recurse you have recursions but use it you need to like you need to learn how to write circuits as well and you even worse you need to like know what API of from library to call so what I'm trying to what I'm trying to say is that CYO is a very simple way to uh proof your Lang your your execution uh by writing the code that we are already used to so high level overview of what CYO to proof looks like first we have CYO and then we compil down this thing called CYO assembly and uh or we call Chasm casm and from Chasm we will uh compile down to add traces at traces basically describes the execution in numbers so we have this long Trace that are felt a few elements and that is basically describes the behavior of our uh of our program and from Air traces we will then convert to polinomial and from polinomial you then create a star proof out of the polinomial so basically this is like a very high level overview of how uh you you convert your code to proof and uh I would like to stress that for those who are afraid of touching stocket because your freid oh is very hard to use death tooling is not that great we have remix so remix is where I learned my City from uh back in the days uh when I want to deploy contract to ethereum uh chain ethereum blockchain uh we have also remix on stocket now uh developed by my team NE mind team uh it's very easy to use I encourage for you guys to try it on uh yourself uh there's a there's even a remote local version for deploy and interact with it so you don't even have to pay gas uh there's stet Foundry uh for those who likes The Foundry version for C and there's a equivalent version for stet as well so again uh the tooling that that you love and often use in the in writing smart contract onity it's already here on on stocket as well uh there's open zpp like how many of you use open zpp and say that my contract is safe I was I'm one so we both open Zeppelin on onstock now so there you go you can mix and match your library templates and then you can write safe secure contracts and there's Explorer this is one explorer that I'm working on prob I'm showing my my my own page uh we love ether scan anduse ether scan a lot uh we also use Voyager a lot in uh in stocket obviously there are others but I'm going to mention Bo for now uh so you may ask like what's coming up in on the star net world we have a vol Val is a way to select uh which data of Vil layer you want to use so if you feel that um pushing your data to layer one is a bit more expensive there's an option in the future to allow you push to a certain data available Community but this is something that's very very how can I say premature uh so we'll see it come but it's not going to be that soon but that's in somewhere in the road maps and that's going to fee Marketplace um and there going to be the concept of layer 3es that's why we have things like Madara open source project we want to encourage people to deploy stet or stet so you can then scale or you even customize your own layer three on stocket gas subtraction for account native contion is is on the road maps something I didn't mention it allows you to pay uh pay uh pay fees without having native tokens on your wallet so maybe you can have you can assign like a pay Master to pay for you so gas extraction u in in a roow maps and the most important thing people have asking uh sequences are centralized so uh talks and researcher talks and discussions and a bit of research uh I think some them done by my colleague here Ashraf uh decentralizing your sequences so that is uh under Works uh so get start with now uh so this is the QR code that I would like to uh share for those who are uh who want to write some uh contracts want to write want to write some Constructors want to write events uh how do you use it one of the syntax this is the pilet page that I would recommend you to go to because I use it sometimes I forgot how to declare events sometimes you know so this you just go there and you like click events so it's at st- by- example. voy online uh it couple of PUK taking taking follows nice put it for a couple seconds and the end yes there you go uh I also put out a QR code for for St on Twitter do give a follow uh I don't know if you have time for questions but yes otherwise I'm free available just ask me uh when you see me by me around the area thank very much chich and let's give him a round of applause I uh I love how self- entertained he is you know every slide he has designed he has work on the project he's like seeing his resume um can we open it up for questions as well does anybody have a question we got one over here I can we I will hand the mic over to you please introduce your name and your question as well about stocket hi uh this is wi how uh was just wondering what are the costs for Sharp uh the shed approver and also uh the cost of running approver for Stone open source recently that's a very good question the cost of running it's very expensive I don't exactly know how much because I don't run it I I I didn't Benchmark it uh it was recently open source so I haven't tried it so but but you have to understand like the cost of running Pro is probably going expensive but we have to understand as well that you only need one a couple of like people to run approval for liveness but you can you can never lie when you generate proof so lying cannot happen on the proving stage it's just censorship or maybe liveness so so yes it's definitely not cheap to run appr thank you for the question anybody else you want raise your hand and ask got one in front here got two sorry got two we'll pass a mic to each of you please introduce your name as well as your question uh hello I'm Jeffrey that was a good talk thanks uh you mentioned using Stark outside the context of smart contracts like in ml can you share some more examples of how what some activity or project in that space uh yes that's a that's a good question I think that's a that's a project I can't remember alexandraa his name of the I can't remember what's the open source project for ML again Giza yes Giza yes Giza it's a open source project on Cairo there doing a lot of ml stuff so do give him a check this type Giza Cairo or oron something yeah oron Giza Cairo there you go thank you thank you I forgot I forgot Yeah by ml you mean machine learning right yes smart MC hello J thank you very much for your time on the talk uh if I'm not mistaken you can Port evm contract to the aik environment correct so what is the Starck strategy to on board more projects and appeal more users for the future thank you for the question and this is a more of community question number one uh there was a a sunset project called WAP also by my team so what WAP does is that you have your solid solidity contract you can get transpile to a Cairo CYO zero contract but has been sunsetted a couple of reasons so the strategy right now is to give talks like this to give workshops like this uh try to encourage you try to let you know to try to Advocate you try to evangelize tet right explain to you the benefits so that you understand like why do you want to learn CYO uh it has to be the hard way you I I cannot like feed you with money and you just write contract doesn't work that way right you have to understand why you want Kyo and why you dipl st it and you love it and you deploy it so it's going to be the old school me advocating you exper the benefits of you doing it yeah unfortunately yeah thank you thank you for the question Cairo and stocket is not evm compatible right no stock is a chain Kyo is the language thank you any last questions before we close this session I think that's it thank you very much CH let's give him a big round of applause thank everyone lovely presentation
Automatic transcript — names and jargon may be misspelled.