Beerus: a Starknet light client
ETHCC 6 · July 2023 · 18:31
Paul-Henry Kajfasz introduces Beerus, a light client being developed for Starknet. The speaker explains the project's purpose and the role envisaged for a Starknet light client.
Speakers
Topics
From ETHCC 6, hosted by Ethereum France.
Transcript
[Music] foreign [Music] it's a pleasure for me to be here okay we're ready so today I'm going to present to you beerus which is the startnet light client written in Rust so I'm going to present myself my name is I'm French I'm from Paris I'm a stock net core developer I'm also the beerus team leader I'm and I'm a ethereum protocol Fellowship uh fellow um so firstly to understand why beavers we firstly need to understand also what
is start net so start net is a layer 2 scaling solution for ethereum where we leverage zero knowledge proofs and uh proprietary language that we call Cairo which is a provable programming language so the the goal for stocknet is basically to scale ethereum through reducing gas cost and increasing transaction throughput on the network so what is not like lion and what is it so cool so it's very important firstly to understand so what is a node like how what is actually a blockchain a blockchain is basically a distributed database it's a database where a lot of
people support it by running a type of software on their computer this type of software is called a client so you download it and you run it and this software enables you to interconnect all these computers around the world uh a new support this database that we basically call the blockchain and there's different types of clients that you can download on your computer you have full nodes archive nodes and light nodes this is an example for ethereum and these are the most used for now so if you look at full nodes or archive nodes you need a lot of computation so you need like four core CPU one terabyte to three terabyte SSD 16 gigabytes of RAM it's very very computationally
intensive and it costs a lot of money of money to maintain so it's about let's say 1K to be able to run that so it also prevents the scaling of the ethereum blockchain but it also prevents decentralization so that's a massive problem for the network and so people wait way way way smarter than myself like vitalik between or just in Drake or team vehicle or other people even have thought about how can we continue scaling uh the ethereum network uh and so basically one thing that has come out is a light node a light node is basically an idea of how can we enable mass adoption of the blockchain networks
by enabling everybody to run a node uh and that only requires an internet connection and a very very small amount of storage and so why do we need like clients uh one of the massive things that we don't really realize is that on the blockchain one of the massive philosophies of the blockchain is the trustless ecosystem if you read the Bitcoin white paper or any of the white papers of the of the big blockchain like ethereum or anything you will see that the word trustless is at the core of the blockchain because it's basically what enables us to interact with each other without
having to trust each other and that basically makes a sane ecosystem but right now we're breaking the philosophy of the blockchain with a lot of interactions that we have with it for example when you take metamask or uniswap or any type of D apps or your wallet Etc basically when you want to make a transaction you're swapping some money or you're interacting with a d-app or anything you're basically the metamask is basically sending a request to an untrusted RPC someone that's running a note somewhere potentially even themselves that are running thousands of nodes in their like data centers and you're connecting to them but how can you actually know that
they're not lying to you when you're connecting to these nodes how do you know that they're sending you the right data that they are making you sign the right transactions Etc so we're trusting these providers just because we don't have right now the right infrastructure and this is where the light nodes come in and uh there's something that I really really like that one of the best Engineers that I know that is a very very cool guy from Star queer says he says the most important is not to build uh only technology but to build philosophy and to build technology on top of this philosophy and so that's really really important to me and I
think to many people in the blockchain ecosystem because what we're building is not only technology but it's Philosophy for the future of humanity so there's been a lot of people thinking about that about what we call stateless ethereum so there's a lot of research on that how can we make territorium blockchain stateless a way lighter and enable anybody to interact with the blockchain in a trustless manner so there's a lot of research like vertical tries and other things that would enable that in the near future and for example the portrait Network on ethereum hideous or get which are already running like clients on ethereum so what is beerus
beerus is open source fast secure reliable trustless lightweight and portable starknet Lifeline yeah it's a lot of words but it's a very cool project so we're fully open source um I'm very very proud to have this enormous Community now we have more than 200 people on the telegram uh only Builders very very smart guys and girls it's a real pleasure to have them with us we have more than 40 50 contributors on the repo uh just people working really really hard to make it happen every day and we're just fully open source so if someone's here wants to contribute uh we're really open to that and it's always a pleasure for myself to
onboard you and take you through like good first issues and stuff like that it's fast secure and reliable we're fully written in Rust which I think is is a really really good language it's very fun there's a steep learning curve but don't worry you'll make it on the other side uh it's blazingly fast like my friend the primigen would say uh and it's very very secure it's lightweight and portable basically using rust were web assembly and no standard Library compatible which means that you can basically run beerus the like client and interact with the blockchain on anywhere so you could run it like on your phone on your wallet on your browser on your car on your smart
toaster if you want I don't really care to be honest you can run it anywhere and that's the real power of the light client because you now have the opportunity it opens enormous doors like internet of things and all of that there's enormous opportunities that are brought by like clients now where before you could potentially use metamask on your phone yeah you can but who are you actually trusting to sign your transactions and to uh to send you back data and you're actually trusting a centralized node provider um and so inferior Alchemy uh all these things they they make no sense in terms of philosophy for the blockchain right now
so our infrastructure is pretty simple beerus Gore is basically a rapper for uh the Helios client and a start net full note and I'm going to explain a little bit deeper why this is like that and then the IP the API for the user to be able to interact with it is basically a Json RPC and wasm Js connector so I want to explain a little bit about what is the magic like what is actually beers doing under the hood uh to explain to you I'm firstly going to explain what is the architecture of the start and blockchain so you have ethereum L1 that's running uh as ethereum the layer one solution that we all know and love
and then we build star net on top and basically what people do they make a lot of transactions under the network all these transactions go to the mempool from there the the sequencer receives these transactions he validates all these transactions it creates blocks and then when the block is is created he basically sends this block to the proverb the prover issues a proof of that block and then the prover sends that proof to the ethereum L1 contract of sartner if this contract says yes okay everything is good the proof is valid then what happens is basically the sequencer is going to send what we call the state diff uh to the start net contract on layer one the state diff is
basically okay this is the state of start net at time a this um this is the state different so it's like how can we go from State a to State B so we use what we call a state transition function which is basically there's block n there's block n plus one how do you go from block n to block n Plus One is using the state diff and the state transition function is basically you're applying this data to the previous block to make it this new block um and so basically now you understand that it means that the whole data of darknet is basically on ethereum so the whole state of the stock and blockchain
is contained on ethereum so you can recompute the whole start at blockchain for material and this is what we do basically it means that we can make sure that a layer 2 uh start net full node is actually saying the truth by checking if the data has actually been posted and validated on ethereum layer one so that's exactly what we show here uh so we recall we request a block by hash for example from a stock net full node where it Returns the the block we request a storage proof for example using Herodotus or any other search proof Provider from layer one it Returns the proof and then we just compare the
data and just make sure that it's valid and if it's valid we just say yeah great it's very cool and if it's not valid then we throw an error or we enable any app to manage these things uh and so we can make sure that we're actually returning valid data to the user which means that you can have a trustless access to any wallet D app anything in the blockchain ecosystem and I think this is truly the future of the blockchain ecosystem and that's definitely where we're going towards so yeah it's very very cool we already have the Json RPC that's all already like fully compatible with starknet and
ethereum so we have 46 RPC endpoints uh and it's working pretty well uh we still have a little bit of work to do on them so as I said open source contributors always happy to onboard you guys and always happy to to do a lot of work with you guys because it's truly incredible uh wasn't we already have uh the wasm version of beerus running there's oh even people working on integrating it in Mac OS or so on Apple Store and things like that so you can just download the beerus app and just run it on your phone which I think is really really cool uh so yeah there's a lot of work going on and is getting more and more portable so
yeah so slowly to to recap what is the powers of beerus the powers of viewers you can run it anywhere it wasn't you can run into a new browser it opens an enormous dose for iot so you can run it on your car on your smart toaster on your washing machine I I don't know anywhere you want man and you can actually enable all these devices to connect to the blockchain in a secure way and that's incredible to me um so yeah that's really cool and then you can also run it in your metamask or anywhere so that's also really cool uh there's very cheap gas fees and account extraction I haven't implemented that that's the really cool guys at stockware uh they just made a really really cool
blockchain with Native and construction and very cheap gas fees because we're really interesting scaling solution and we're using zikri so yeah and it's fully open source and we're using rust uh so it's very very performant and blazingly fast and so that also means that we can do really cool things thanks to start net because let's say you wanted to do some things you would be limited right now on ethereum because it costs too much to send transactions and just use it every day let's say in the future in the near future I believe let's say you want to go to the gas station and you plug in your Tesla and you just want to get a little bit of electricity or something then what you can have is basically the biggest Lifeline running inside your Tesla and at the moment you unplug basically it sends a transaction
to from under Start net like ecosystem directly to Tesla and it pays for your electricity and so you didn't have to take out your card and do anything you can directly do it automatically using the beers like line in your car so that's pretty cool so very cool examples a little bit like I said local verification you can trustlessly connect to metamask or any type of browser like a browser extension or any type of d-app uh we're talking and working really hard with the Argent X team to be able to integrate beerus in a very near proof of concept inside inside urgent text and the argentex team
are very cool guys they're very like forward-looking and then we're also waiting for to this type of innovation so maybe soon almost 100 of people using Stark net will have beerus directly on their wallet so we we will touch like 100 of people on startnet that's pretty cool and you you will not even see it you will not know it but you will have beerus embedded and uh and that's the really cool part about it um and the normal enormous world of iot as I said many times uh you can put it anywhere so what's the road map bureau's version one is coming pretty soon um with the verified data using storage proofs uh real world use so basically we're in connection with different
pretty cool VCS and pretty cool companies uh that really really want to integrate viewers and light clients in their Hardware uh I won't say names for legal purposes but they're pretty pretty big big big companies and they're really interested in going into blockchain but they didn't really have the software or the knowledge to be able to do it but now we're trying to bring this expertise to them and try to integrate some of our Tech inside these Hardware so potentially soon you'll use your microphone and there will be beerus in it just kidding um and then start proof syncing start proof thinking is basically you could instantly sync any type of node using star proofs almost instantly and that's
really cool and very soon will be the most used node on the ethereum on the stock net Network I hope uh and I'm almost sure of that in conclusion uh I just think uh I just want to thank firstly the incredible people that have accompanied me in this journey we've had an incredible right up to up to now uh very very cool developers very cool Engineers very cool people so feel free to contact me and just join us to try to build the future of starknet and the just the future of of the blockchain so yeah incredible times incredible moments incredible technology and uh let's keep
starting it strange guys thank you very much [Applause] [Music] foreign thank you um if you think with the L1 does it mean that you have latency about the last block you can prove uh typically you you need to wait for the stack net approver to prove the block and then push the proof right yeah exactly so you have a like a
latency slot in the sense that the proof is not settled like every second another one right so we're not able to prove the latest latest data so we need to be sure that the proof has been settled on L1 validated on L1 and that is correct uh so we actually definitely have this latency but in the future is getting faster and faster and faster so potentially right now we need to wait a little bit but in the near future with the big Evolutions that we're having on start net for example if you watch like 0.12 AKA more TPS daddy uh and other things like that um we're having incredible like Evolutions or stock net and so the proof are going to be settled faster and
faster and faster so right now we have the small emulation but we're building like Forward Thinking and so it's gonna it's not going to be a problem at all thank you very much [Applause] [Music]