zk card game, Applied ZK - Day 1
Ethereum DEV NL·Sun, Oct 9, 2022, 12:00 AM
Minion fight is a zero-knowledge incomplete-information card game where private information such as hands and decks are simulated on chain. Each player gets a set of cute minion cards with different abilities and battles against a friend! Speaker(s): Abby Lu Hosted at Devconnect Amsterdam, 2022 Visit the website: https://devconnect.org/ Or follow @EFDevconnect on Twitter
Transcript
[Music] okay hi everyone my name is abby and today i'll be presenting about zk card game i believe that all of us have played card game at some point in your life personally card game brought me a lot of fun memories from childhood we all have our favorite card games it could be poker pokemon or hearthstone in these collectible card games player has their own hands constructed from a very large pool of unit cards in the commercial market the cars usually have different effects costs and art which allow players to adopt different strategies against opponents one commonality among all collectible card games is that they are incomplete information game what it means is that there exist private information such as your private handoff card or private deck of cards the presence of private information makes it extremely challenging to stimulate such games fully unchained that's why the commercial available card games usually involve an off-chain game play without on-chain nft release only one way we can simulate such card game completely unchained is to through a commit a reviews approach where it means that at each game staff will commit a hash value of our private hand and private dac and all the information will be reviewed at the very end there is some obvious drawback to this approach firstly we need to review all information at the end so the bluffing strategy will be known by your all your friends and secondly we are not able to cut the liar on the spot we only know if someone's lying at the very end of the game which will make which void the entire game after a long long play hence are we able to simulate such card game completely unchained without revealing any private information even at the very end while making sure we can cut the liars on the spot i think we all know the answer we have some amazing technology called zero knowledge proof so without further ado let's do a live demo of the game the game minify is a game of strategy between two players it started by selecting yourself either as player one or player two and we need to enter a few random numbers before starting the game and landing in the main page so there are three random numbers the first one is called seat to randomly draw a card we need private source of randomness the seed and public source of randomness which are block hash or timestamp of the opponent has finished the game we need these two sorts of randomness to prevent the user from selecting a random number to his own advantage or including with the miners to generate timestamps to his advantage the next numbers are called sought during the gameplay we'll commit a hash value of our private hands on chain the slot will be added to the input to prevent users from enumerating over all input space we can try all the card possible combinations to reverse engineer the memc hash function as a possible attack so the soft values are added to prevent such rainbow attacks and now we can start the game so the first thing you can do in the game is that you can draw a card the audio is not working but it's fine so during the drawcard step what happens is that we are doing a zero knowledge proof to prove the source of randomness as well as the current draw process is fair according to the protocol and now we have a doc which has health value of one as well as attack value of 100 and the next thing we can do is that we can play the card during the placed card step we are proving a permutation that ohen is the permutation of the new hand and we can attack the plan since there are no minions defending the opponent's plant and you can see the flowers are gone and similarly the opponents are able to draw a card as well as well oh give it a second it's able to draw a card as well as well as placing the card attacking the opponent's minion as you can see the game will take a while so there's a recorded video of a gameplay between shu and i so in this game i've adopted a smarter rabbit strategy so spoiler rabbit will have tremendous coverage if it's the solo defender on the board so a double attack and health value so i deliberately withhold all my other cards so my smarter rabbit can maximize its health value and as you can see the spoiler rabbit basically solo against the ego the fox as well as the other non-spider rabbit which sure has and the rest of the game is easy i use ego which is a angel which has the special ability to revive acute minion i revive dark and then i'm able to place kitty which is so cute that all other minions on board will double its attack value to protect the cutie and lastly i place the fox which is the healer it's able to add health to all the minions on the board and now i'm basically invisible and the rest of game is quick and there are no minions left defense shoes planned and i'm able to easily win the game as you can see this card game could have a lot of possible variation you can adopt different strategies against opponents and here are the six cards we currently have where each card has different special effects as well as different abilities and here is a recap of our protocol the game started by a commitment of a c and hash value uh the hash of the c and salt value on chain and during a card draw we'll compute card using public and private source of randomness to produce a current commit and afterwards we'll have a new hand hash and o hand hash and commit those hash value of those things on chain as well during the curve play step we are able to do a permutation between the o hand and new hand we will see that the o hand plus zero will be a permutation of the new hand plus the card placed and now we've come to the end of our ck card game i hope you enjoy our demo thank you [Music]
Automatic transcript — names and jargon may be misspelled.