Hardcore tech challenges in fully onchain gaming
ETHCC 6 · July 2023 · 17:57
Norswap examines technical limits faced by fully onchain games, including throughput, latency, zero-knowledge proofs, bridges, code size and data. The speaker discusses approaches to these challenges and gaps that remain.
Speakers
Topics
From ETHCC 6, hosted by Ethereum France.
Transcript
[Music] foreign [Music] So today we're going to talk about hardcore Tech challenges in fully Unchained gaming and basically why building unchain games sucks today but also why it's interesting and secretly the stock is every onion game wants to be its own roll-up because making a game on a roll up has a lot of
benefits that we'll get into but also right now it's still a big challenge so who am I where is going from some North swap I'm working on Xerox Fable which is a fully on chain trading card game so something like magic the Gathering or earthstone I guess if you're all nerds here you pretty much have heard of something like that but doing this right is a ton of work and doing this right means like doing this in a way that's decentralized not you know fully centralized and we just have nfts uh but just putting everything on the blockchain um why do we want to do that like that's kind of crazy put everything on blockchain it's a it's a very um difficult platform to work with compared to just you know using the traditional
tools that we have and I've ever talked in Denver that explains why I want to build on-chain games uh this is our topic today but like to just give you an idea I think the best reason to build on-chain games is we want to be able to extend the game the game does not just belong to the author of The Game it also belongs to a community that can change things in the game and so for my game it's a card game people can create new cards but they can also create new game modes they use existing cards so this sort of gives you an idea of why I want to do this so what are the challenges like what's difficult with making uh on chain games well first of all uh players will make a lot of actions so your chain needs to have surgeon throughput to make sure all
the actions go through secondly these actions cost money making a transaction in blockchain costs money and we might not want that right if you play a web 2 game especially like a card game or something like that it's often free to play so user don't feel really good paying like three cents each time they do an action in a game and for some game that just doesn't scale uh the third thing as difficult as making your game actually decentralized and we'll talk about that uh in depth uh and keeping the cost low so even if you make it free for a user you still have cost for yourself and you don't want this cost to be too high then all the classical challenges like like traditional Gamers that are not already blockchain native they're not
gonna install metamask if you send them to your game and you say okay you need to install metamask and then here's this 20 word password please write it down and store it under your underwear so that you can keep it safe and then please now go to your bank account and send money like that's just not gonna apply so you need to make it to make sure that at least at first they can play immediately with no money with no metamask no nothing and then later you sort of start adding these things funny games blockchains are public but games have secrets right in a card game you have a hands of cards that are known to you but unknown to the opponent how do you do that so we need to use zero knowledge but that's a whole other hardcore challenge
extensibility like I said that's the main reason to make games but then how do we do that and then if your game has some economic aspect to it there needs to be enough trading liquidity so I said one of the big piece of the puzzle is to make a roll up in your own game to make your game on its own roll up and this gives you a few of these um benefits right I've put the number that corresponds to the the number here so one is gas isolation meaning that if you have your enroll up you're sure that nobody's going to do nft drop on your chain that's going to change the gas price right because otherwise it might be someone drops the new uh a
penguin NFC profile picture and then your game is unplayable for three hours and that's just not good um if you're doing a roll up you can also customize the chain to do a bunch of things one of these things is a sponsor a transaction make them essentially free another thing is uh your chain is just for yourself so the throughput is a lot better than a shame that you have to share with our people it's cheaper and we'll see some reasons for that and then it's customizable meaning you can add you can change the implementation of the blockchain itself to achieve like these four last four here at least it can help so a big question is my thesis was a game wants to be its own roll up and
you could say well why not it's on blockchain you know why does it have to be a layer 2 roll-up not a blockchain and the answer to that is related to our goals like a roll up is cheaper and more secure for any amount of cost that you're gonna sink into the roll up and uh this is part of a vision of what I'm building um so that for instance to run a Rob the secure in a sequence or sequencer essentially The Entity that builds the blocks right and right now in Roll-Ups like optimism arbitrum this is centralized it's a single entity that does that this is not good enough it will change later but you need to do that but as a game builder right
it's it's good that I need to do that but then I need to find people maybe 100 nodes to run my game and that's a huge amount of effort instead I don't want to do that I want to go to a Marketplace and say hey guys I have this game in used to be sequenced I'm gonna pay you as much please just permissionlessly register to become a sequencer and then finally um there's something called shared sequencing and we'll see what that is and that allows you to make cross roll up transactions that are secure so no more Bridge hacks and are fast so now I'm going to explain a little bit more because I'm making a lot of claims and I'm going to explain why these claims are true so overlap's cheaper
when you run a chain it needs to be validated and these areas they can't be sybils though you need to make sure that validating this chain is expensive but then you need to give returns to the state that people have put and there's two way to do that you can use your own token well this is great because you're just printing money but this is also real money that you could you could sell the token to use for other things and because people are staking your token they're exposed to your new token your your token is unproven you're a new game nobody knows you and so they will demand High return because they're exposed to the price volatility of your token that nobody knows or you can use an existing code token
you could say well you know stake eth to validate my game but then you need to compete with all their source of returns and eth right like East taking is giving six percent or something like that and that's like um very like very secure people are very comfortable with that so you probably need to offer a lot more but in L2 you can use a technology called risk taking where I now want people take their eth they've also they've already used to validate lrm and additionally they say well over the terrarium but we also validate your game roll up and if you do that you don't need to pay the competitive rate because this rate go on top of the rates that they are getting paid for uh
Veritas so Roll-Ups are cheaper for that reason uh this is what I explained before you don't want to go to 100 people to find sequencers for your roll up instead you want to go to a contract or Marketplace that will find these these roll ups for you and uh you know if we don't do this then basically having games on their Roll Up is going to be a lot a lot a lot more difficult so shared sequencing is when you have a sequencer the sequence is multiple Roll-Ups so it's going to propose blocks for multiple Roll-Ups at the same time in general there's many ways to do this but in general it's an interest any scheme that ensures that you can take a set of transaction across roll up and
make sure they always succeed together or included at least if they don't if you don't guarantee they succeed you can at least guarantee they're included and this is useful for bridging this is the main use case but it could also be used if you have a game that you split the logic between multiple Roll-Ups or you could have cross roll ups actions between these things this is very useful uh this is a lot more Technical and I have a talk about this at the modeler cement this Saturday which should be posted online also um another thing is if you have um decentralized sequencing and so you don't write a sequencing you have a bunch of sequencer typically you're just gonna pick one that's gonna make the block but it's going to be
random and if you do that what you ensure is that if one falls down or you just miss one block that's not a big deal and they also can censor you because there's so much of them so if one tries to censor you well big deal the next one will let you in so that's how this that's how distributed sequencing works but if you take all your sequencers and you have them vote on the blocks so one of them is elected to propose the block all the other ones are gonna vote on the block that's selected right then you can use the signature to do interesting things like low security bridging you just check the signature verify oh okay these people are sequencers there's a tutorial majority and now I can do a fast bridge and this is great for games because games maybe
don't handle millions and billions of dollars um and and so the parts of the games may have lesser security requirements and so this this is enough even if you don't have that many sequencers it's it's a lot better than most bridges today which are like you know five five out of nine multi-sticks here we're talking about maybe hundreds of sequencers uh and they're also bonded so they can be slashed in case of Chrome um spinning a good roll up today is hard uh there's only one way to do it which is the op stack there's no competition right now hopefully there will be there's no full proof in your P stack they're working on it there's also trying sequencing that's what I'll just talked about and requires a lot of tech know-how there's somewhere up as a service
provider there's alt layer there's conduit there's Caldera but you opt into a vendor locking their attack is not open source and they don't have sequencing and so I'm personally working on making these roll apps and especially for games easy so I'm doing two things I'm trying to do some devops so that it's really easy to spin a roll up and I'm trying to work on the centralized and share sequencing and uh I'm looking for people to work on that with me so Reach Out so there are these two projects right like the first one sexy sequencers is the decentralized sequencer implementation and I want this to be open source and I want this to be collaborative with the whole community
and then simple up Europe stack is this configurator to make it easy to spin or roll up so some more ideas around roll ups why they're useful like I said you can split your game logic between multiple uh servers like a naive roller by itself will do at most 50 million gas per second this is what binance smart chain does and this is sort of my mental limit of what you can do that's not Reckless so it's about 500 uni swap swaps per second and a game might be a lot more hungry in terms of capacity but if it's not enough you can add more roll ups you could say well my economic layer is going to be on one roll up and then my game logic is going to be on
roll up or if you have multiple parts of the game logic if you're doing Pokemon maybe your battle logic is in Monroe lab but the word logic is another roll up and then these things communicate from time to time use share sequencing uh there are other things you could do I'm going to skip over them quickly like uh optimistic games State channels just do things up Shane and if there's a dispute prove them on train uh you know if you're interested in that talk to me um yeah if you want your game to be extensible other people have to be able to deploy contracts on your roll up and this means you can't make everything free otherwise you're just running arbitrary code for free but what you can do is sponsor the things that you think are good and for this use account extractions
and account obstruction is a way to let people sign transactions but then they don't have to pay gas for them someone else will pay yes for them maybe they don't pick us in the native currency of the robot they can use summer Arrangements and so this is a big solution if you spin your own roll up you can sort of integrate that natively um yeah we can expect users to install metamask and so again I can't abstraction smart accounts is the way to go there where we uh we give people a way to basically have a multi-sig including their device and the game provider instead of having dimensional metamask and maybe later we'll let them
installment I'm asking will reward them if they do that um other issues that that's very hard handling secret information in games and so zero knowledge proof right now they're very slow to to work so in my game I wanted to prove that you drew the correct card and that took like one minute on unlike Chrome you know in the browser and it requires you to deploy to download a three gigabyte witness file so that's like not great for something that's that simple but things are evolving fast the technology is moving and so I'm confident that that will be able to to make this thing easy in the next few years and you can always sort of get more clever so we fix this issue in the game
we made it a lot easier but we had to get really creative and and a robot also helps for this because if you add pre-compiles to verifying zero knowledge proof it makes it cheaper on the roll up side and yeah like I said Twitter we find a lot of good theories there are good papers around this the thing is they're not usable by people that are not CK experts that can't implement the thing themselves right there's not a lot of language and tools that you can use to just write circuits easily and put them in your game um how am I doing in time two minutes uh four questions maybe you're for finishing up if you want we do not yet have the next speaker or
maybe okay well if there's questions no problem okay perfect so yeah my other thoughts weren't making game extensible and if you want to ask about that uh I'll be happy to answer so just to conclude um I think gaming is super fascinating on chain because it's the joining of a lot of concerns are like at the frontier of what we can do you know like sharding constructions your knowledge roll ups um and it's a way to make something that's truly decentralized and games are like they're not super serious so they're it's an easy way to experiment like if you your game fails because not enough decentralized people
won't care as much it's a perfect experimentation ground but it's the first step towards making everything decentralized eventually everything owned by the community uh everything extensible like I personally have been a gamer most of my life and uh I've played games I can't play today because the editor of the game just stopped the servers and that's just heartbreaking uh I want us to go from open source which is the codes open to openstack like everything you need to run the game or the app is open there's no there's no Gatekeepers and so if you're excited about this if you're excited about games also the the technology behind it this is what's very much a talk about technology uh just talk to me and I'm happy to to answer
your questions any question one question if every game was running their own roll up wouldn't that kind of kill composability between different games so saying I have one asset from one game that I want to use in another and they are both on different roll ups that makes it somewhat complicated doesn't it yes this is a great point this is why we need the shared sequencing thing where there will be builders that build blocks for multiple roll ups and if they see you want to go from game a to game B the
available propose uh blocks for these two things together and guarantee that the the bridging goes through there's some challenges there to be sure like it's not like we know the solution there's like a design space that's pretty complex with different trade-offs but there are solutions that are just way better than what we have today for sure another question any other question we're still waiting for the next speaker apparently no or do you want to add something find out laughing it says this is good okay thank you [Applause] [Music]