ZK Paris: Tarrance Van As - Applications of Zero Knowledge Primitives to Gaming
4 Aug 2023 · 19:10
Recorded at zkParis on July 20, 2023 and presented by Geometry and ZKValidator, this talk features Tarrance Van As on applications of zero-knowledge proof primitives to gaming. He walks through how ZK proofs can support verifiable, privacy-preserving game mechanics, an emerging use case for zero-knowledge technology beyond the more familiar scaling and identity applications in the ecosystem.
Speakers
Topics
Transcript
okay so uh next up is applications of zero knowledge Primitives to gaming from uh Terence vaness at cartridge thank you thank you hey everyone um I'm Terence I'm one of the co-founders of cartridge and for the past about a year and a half now we've been building fully on-chain games and taking advantage of a lot of the exciting research that you guys have been doing to to enable this new medium and so I'm going to give a little bit maybe of a more of a practical um talk here of some of how we're using
you know zero knowledge proofs and in practice to scale the about to the amount of compute that meets the requirements of pretty complex games that we're trying to put on chain and then I'll I'll wrap it up with a few existing open challenges that we're still trying to solve that are necessary to you know fully realize this idea so like I mentioned I I I'm the co-founder of cartridge we've been building tooling and infrastructure in games primarily on top of Stark net for the past year and a half I'm also one of the core developers of Dojo Dojo is a provable game engine uh so it's a game engine where you can implement the logic and the state of your application uh and that and it's written in Cairo so you can prove those computations and then
you can uh and it enables like a whole lot of different types of architectures that allow us to start to expose essentially like the existing server size infrastructure that had to be centralized to kind of arbitrate like the Integrity of the participants in a game you can now start to remove that and and decentralize that uh so what are autonomous worlds so autonomous worlds is a is a category of these fully on chain games it's a it's quite an ambitious objective it's quite you know a small nascent field right now um of maybe you know 50 to 100 developers that are incredibly excited about leveraging these new affordances provided by zero knowledge Crews primarily like a massive increase in the
amount of computation that you can do and different scaling architectures to basically land entire games on chain so that games can inherit the hardness of the blockchain you can have games that uh can be live perpetually they don't have like some centralized server that needs to be operated by a for-profit company they can be permissionly expanded you can build architectures that allow anyone to contribute and to extend like the lore of the game and to build new interpretations of it and new experiences on on top of it and so why should this be interesting to you guys I think like you know there's a whole lot to say about like why on-chain games are compelling from a game developer or player perspective but for this particular audience I think like
the the main takeaway is that games the games provide a a really uh low stakes playground for experimenting and deploying these new technologies in a way that there's much less obviously financial and Regulatory downside so you know when you're experimenting with privacy Technologies for example if you want to deploy them into production as soon as you start touching financialized assets there's a lot the you know the scope of what could go wrong increases dramatically in the on-chain gaming space where you know a lot of developers are very eager to apply these things in a lot you know very experimental playful ways that allows you to ship them into production start playing with them you can really you can relax some of the constraints around you know
decentralization or censorship resistance and uh and and test like isolated pieces of technology and it's a concrete use case that people are excited to use today so what do we need to enable these uh fully Unchained games you know at the end of the day we kind of want it all uh we want fast cheap composable responsive and private and obviously this is not accomplishable within like the single context of a single blockchain so I'm going to talk a little bit about the architecture and how we can use fractal scaling and and how we're using it today to try and enable an architecture that can support a fully unchain game and I'll reference a canonical example of a game that I think looks very similar
what to what an autonomous world could eventually look like which is uh World of Warcraft uh which was like a massive uh massively popular game it's an MMORPG where basically people role play as different characters and it has a bunch of different layers to the complexity of the game that map quite well to how we can start to architect the uh the roll-up infrastructure for to support these types of games at the base you have you know the accounts and then you have the in-game economy the in-game economy has certain requirements where it has you know like Global context you want to be able to sell and exchange things across everyone in the universe is probably less frequent transactions and they're higher value transactions then you have like the general population like the shared context for maybe a particular part of the map or a
particular server a particular region where there's a bunch of players they maybe are not like interacting too much them doing more social coordination and then you have things like instances and dungeons where you have participants doing like high frequency interactions with the world but in a very in a very small context right it might just be you and five friends and you don't need to execute this computation or you don't need to touch the state of the entire world and so how can we kind of start to scale up the back end for these games using roll apps to be able to support these different contexts so this is where we are today we have you know we as I mentioned have been primarily focused on starknet you have like structure Layer Two it's a
significant Improvement on top of the existing uh on top of like layer one as far as a capacity you have 10 times faster 10 times cheaper transactions you have faster block times five seconds and then you have composability across the D5 ecosystem one of the challenges is it's still not cheap enough it's not fast enough and it's not private so it is a great layer to support like things like you know the marketplace in a game so in the case of World of Warcraft you have the auction house which is you know very similar to open sea or uniswap that exists today on in most D5 ecosystems it's just like a place for people to transact and trade across the entire universe and Layer Two like Stark net is a perfect place to support something
like this but to enable like the actual gameplay where you have the interactions that people are doing fully on chain and to have a much faster block confirmations and lower latency we have to scale to the next level which is layer three and so you have gaming specific Roll-Ups it might be region specific Roll-Ups so they might be located you know closer to the player so they have lower latency they might even Shard like a particular map into different logical regions based on the population of the people that are participating in at any given point in time and so the great thing about this is you know in most cases we're willing in the gaming industry right now to trade off uh centralization for uh throughput and performance so basically giving up on some of the censorship resistance that
you get from decentralized networks but removing all the overhead that's necessary for like for decentralized consensus and so when you have a game specifically or three you have a lot more options around the configurability of the nerd you can you know the transaction cross with this additional level of aggregation up to like you know sometimes 100 times cheaper you can have much faster block on transaction confirmations in the order of like hundreds of milliseconds uh probably even faster and it's very easily horizontally scalable so you can use Solutions and you can use Solutions like eroticists like with storage proofs to provide access from these game specific Roll-Ups to the shared World State and you can use things like shade sequencing to allow interactions across these different shards to allow people to like
phase between different Roll-Ups and you have this like pseudo private because you know this is one of the hardest problems with with Unchained games obviously with exposing the back end is private information and we'll talk a little bit then about more about that in a second but if it's operating in this by a centralized sequencer um the threat model is at least a little bit better than in a decentralized context where you you can't have anyone extracting Mev you have some trust that you're giving to the the sequencer and you have like yeah the pseudo com this pseudo private um property uh and then yeah some of the cons is obviously is less composable with the rest of the D5 ecosystem you're in this isolated world you maybe have latency to step down in the stack down to the layer below and it's much more
trusted and these type of you know layer three game shards can support this type of interaction so here in the World of Warcraft you have for example Orgrimmar which has a lot of people just hanging around it's where a lot of social coordination happens and you need like uh it's it's very geographically constrained as far as where the participants participants are going to be so it's very easy to you know allocate them to a particular context but it requires at least like significant more uh transaction throughput or the compute to be able to allow them to all interact with each other and then you have the next layer which in this case is like if you're just uh
the idea is if you're just like an example of World of Warcraft running a dungeon where it's just you and five friends and you're just doing some PVE events or you know completing some series of actions into defeating a boss and you want to prove to the rest of the world that you did that um you don't have to do that in the shared context of the entire blockchain right like you can have a specific roll up or you know it's not really even a roll-up in this there's different I think constructions of how you can sequence the transactions but the the Practical implication is that you can basically move this computation fully off chain no one cares about like how you accomplish the goal you just want at the end of it to prove that you accomplished some goal that you can settle to the layer below and then you
can uh you can unlock the rewards for accomplishing that um so this is uh I think like ultimately the way to scale blockchain games to like allow a lot of people to uh play their own little instances potentially you know even single player game locally and then just decide like oh if this is a good outcome I want to prove it generate the proof and then set alarm chain and unlock the rewards in the in the global context and so this is you know an example in World of Warcraft if you're uh in an instance it's just you and some friends five of you and you're fighting some monsters and the objective obviously kill the boss and then uh once you kill the boss you get some Loot and for your character improve it over time
um but it it does introduce some additional challenges which I'll touch on in in just a moment so in this the the benefits here are obvious like it's cheap and potentially free if you're just doing this by yourself improving it locally on your computer uh the interactions can be very fast lately and see and it's very efficient to settle the outcomes you don't need to care about all the previous history of like how people accomplished a a particular objective you just want to know like they just want to convince you that they did it and that's very interesting to do with obviously it was Snorks another practical outcome is that you you don't have to share the strategy of how you did it right like that can remain private like the how you
accomplish the goal can still be uh opaque to others the cons in in this kind of configuration is it is potentially grindable like if you have everyone just doing this on their own you can just you know throw a lot of computers at it you can run a lot of instances in parallel and try and get all the best rewards and so there needs to be some thought around like game mechanics that fit well into these constraints as well as what are some approaches that we can use to solve them so some of the challenges I mentioned a couple of them I mean I think the biggest one is fog of War fog of war is this idea um is you know in the in the research it's called witness encryption uh in games like Age of Empires or Warcraft
it's this idea of there's like you know some information that players know and so you may have a map where you know you know the your immediate vicinity what you can see you know that map and you have another player and they can see theirs and then there's some parts of the map that nobody knows and you need to like contextually reveal that information based on some action so you know as you move troops across a map or Scout across a map you want to discover resources and the important thing is that no one should know ahead of time that where those resources are you have to do the work to go and expose it and some of the solutions that people are working on I think you know there's a decent amount of trade-offs in these uh are using secure enclaves and mpc-based constructions but I think like you know
this very interesting approaches that can solve this with uh in the in the short term at least well enough to start to prove that the problem is like fundamentally we're solving for for Unchained games another is obviously privacy so zero knowledge proofs enable this but it introduces a lot of downsides oftentimes to get privacy you have to do client-side proving which can be on the order of seconds and you have to hold a lock on the shared state which is challenging to do in the context of of multiplayer games so if you have to do a client-side proof and it's one second and you have to ensure that the global State doesn't shift underneath you you now have like the synchronous proving overhead and so like the what are some
of the approaches that we can use to take advantage of this property of zero knowledge proofs but minimize the downsides like I think like one interesting one is incremental proving with recursive proofs to be able to do some part of the computation locally only enough to Blind the inputs and then pass that transaction onto a sequencer that can sequence it and execute like and commit to some transaction ordering and then the proving overhead becomes asynchronous again I think there might be some interesting work in in homomorphic encryption that could potentially be applied in this context as well and then the other one is fairness uh the final challenge this is what I was mentioning like in the context of if you have players that are participating in a dungeon and they're executing it fully
off chain how can you ensure that they're you know that what they're doing is fair they're not just uh using up throwing a lot of computational power at the problem um they're not they're like the run the numbers that they're using are actually random they're not necessarily like rewinding time if they if they wipe and just do like a few steps before and then like running all the different permutations to figure it out I think there's like some interesting uh applications of you know obviously verifiable random functions uh in this context I think like in a lot of the approaches today that I've seen uh introduce like a lot of latency and have a lot of you know overhead to Generate random numbers and we need ways to or generate them with a much higher
frequency and then potentially verified vdfs or verifiable delay functions for uh basically time scoping the the Run of a of a off-chain game so if you have if you think about in a game today oftentimes you have like a casting time for some spell and can you use like vdfs and some bounding on the the time that you have to run an instance to be able to prevent people from basically trying all the different permutations at least like add some computational overhead so that it becomes much harder to do that cool so that's uh that's it for my my talk um and yeah happy to take any questions if there are
[Applause] thank you for the talk um you mentioned kind of like three configurations of Roll-Ups one is um kind of like large scale then medium scaled and small scale it's probably in the small scale one is seems like it's kind of a peer-to-peer you know game session based sort of roll up um do you imagine uh sequencer um kind of like a central sequencer still kind of sequencing user transactions in that small roll-up scenario or more of like a peer-to-peer and yeah I think it's a yeah so I think it's an open question and I think it
depends a lot on the relationship between the participants um like if you think about just playing a board game at home it's totally fine for you and your five friends to enforce like The Ordering of transactions just locally right just like through you're users with friends and you know if someone's gonna cheat then you're just not going to play the game with them um if you have I think like if there's potentially like 1v1 PVP types of games where actions can be very close to simultaneous where they might be a little bit more contention on The Ordering of things so I'm not sure exactly the the correct architecture for it the aperture guys that are here to today I have also posted some uh cool thoughts on their
idea of battle servers which I think is is primarily like one versus the like a one a PVE like you're playing Just against the world um but yeah I think it's a it's a open question of like how best to sequence the transactions in in that uh and maybe a roll up is not like the best word for it cool uh I thank you for the presentation so in uh this slide where you describe the problem of fog of War you mentioned uh secure enclaves as a possible solution
can you explain more what does it mean um I I'm probably not the best person to explain this I don't know if lyron is here today but uh he's been working on some research in this regard of basically using um the secure enclave and attributes-based encryption to basically like conditionally expose information so from my understanding which is is not very good like I've just had informal conversations with him uh you anytime you submit a transaction you would first submit it to the secure Enclave which would create some attestation that had seen it and then I and then it would be sequenced on chain and then like another participant can basically query the a
secure Enclave given you know like for example an XY coordinate and say like do you know any additional information about this coordinate and then the secure Enclave would expose that if it meets the criteria okay okay thank you cool thank you guys [Applause] cool thank you Terence