Arena is a P2P communication protocol to exchange temporary hidden information in PvP games
This protocol is a simple but powerful way to exchange temporary hidden strategic information between peers.
Why? There are some kind of games that are still a challenge to be developed enterely using descentralized computation. Imagine something as simple as a rock, paper, scissor game. as all information in blockchain should be public, the first player that submit her action will be in disadvantage as the other player can use that info to beat her easily. Current alternatives require complex encryption techniques that can be slow or expensive to use. This protocol pretends to be a simple, fast and maybe free alternative for this problem.
How? A practical way to solve the previous problem of the example of the Rock, Paper, Scissor game is to transform the player actions into cards, each card representing the desired action of the player. players should decide an action and play that card face down, then when both players are ready they reveal their cards and check who won.
Arena protocol propose the following for two already connected players:
1 - at the beginning of each new turn both player agree in a common keyword
2 - each player generate a secret key
3 - each player select and action (or a card)
4 - action is hashed along with the secret key
5 - common keyword is hashed with the secret key as well
6 - both hashedAction and hashedKeywords are shared with the other player (this is play the card face down)
7 - once both players shared their hashed information they must share the secret key and the action they played in first place
8 - opposite players validate that the information provided generate the same shared hashed information.
It is possible that other peers can participate in the validation process, as well as submit these hashes into a blockchain to save the log of this matches.
appart from games these protocol could be useful for non biased voting for fast decision making process. (I imagine a planning poker meeting ie)
As agnostic as it is it could be integrated along with other great blockchain technologies. (I only can achieve to implement this in hackathon time)
https://arena-protocol-demo.s3.us-east-1.amazonaws.com/godotDemo.html (promise to upload it later to ipfs) demo uses Klaytn, you will need a Kaikas wallet
To test this protocol idea, several things were made: a JavaScript browser library (Arena) in charge of executing the protocol, the communication is stablished using p2p webrtc. A Rock, Paper, Scissor pvp game was made in Godot using the Arena library. Klaytn Blockchain was used to register and save unique peer ids to make it discoverables for other players. thanks to its short transaction times it makes it a good partner for this use case.
How it works? Game runs embebed on a web page where it has access to the JavaScript library, as soon as the player request to connect to the game, a webrtc peer connection is opened and registered to Klaytn. A Lobby dashboard displays all connected players that can be challenged to a match. Once a player chooses an opponent the p2p webrtc connection is stablished between them. then the game applies the Arena protocol to solve each turn until one player won.