Multiplayer blackjack using payment channels
DAO.Casino presents Multiplayer for BlackJack Empowered by Payment Channels technology
Just as we referred in our nearest plans article, multiplayer for BlackJack game is one of DAO.Casino priorities. We have started development in August and now finally ready to introduce it to our community.
We have powered up Multiplayer with Payment Channels, which boosted speed and reduced transaction cost. Implementation of this technology is a new step in using P2P communication channels between players “offchain”. All transactions occur directly between participants through the channel, and only after they decide to close the channel, the data is written to the blockchain.Multiplayer benefits
Deployment of multiplayer is a very important step in protocol evolution. A lot of games in gambling world are based on interaction between players, both in social and game parts. From now on, we can more effectively develop new game contracts (such as poker contract, for example) with multiplayer feature.
This also simplifies work for independent developers. In order to develop multiplayer blockchain games, they can use our experience and our code. What concerns big casino operators, most of their games uses multiplayer elements. Obviously, availability of multiplayer will certainly benefits us during the protocol integration into their systems.
All of the above extends the functionality of our token. In addition, holders of our token receive additional opportunities to become a bankroller and to provide game sessions. All these circumstances create reliable prospects for DAO.Casino as a pioneer and architect of the industry.Why BlackJack?
BlackJack is a comparing game between several players and a dealer, where each player competes against the dealer. But even though players don’t interact with each other, in a normal casino environment you would sit with other people at one table. It is a social experience, which makes multiplayer an important part of this game. That’s why it is perfect for p2p experiments.
Whoever downloads and runs our Bankroller App becomes a dealer, and has his own table that people can join and play. Let’s take a closer look at how this technology works and describe in detail its mechanismTechnology Summary
Our new BlackJack combines “onchain” transactions — interaction with the game’s smart contract and a secure p2p communication “offchain” (in the channel). This method combines a Solidity contract and a client-side functionality.
According to Jeff Coleman’s explanation of state channels this method can be considered a state channel implementation. This particular implementation uses WebRTC for the peers to communicate, EDSA for signing off chain transactions and ecrecover function for signing and verifying signatures with Solidity.
We also added a feature that allows a bankroller to create several “rooms” with different players. When the first “room” is filled with three players (max capacity for BlackJack), the bankroller can create another one to support other players with the funds. Such feature allows bankroller to back as many games, as he could. From the other hand, new players will have more chances to find a room for playing.Workflow
Now let’s look at how the multiplayer backend functions. First of all, players join the bankroller’s “table” via WebRTC protocols, which enables real-time communication over peer-to-peer connections without the need for plug-ins or other requirements. This allows web browsers to not only request resources from servers, but also real-time information from browsers of other users. RTC stands for real time communication.“There are two classes in the game: RoomJS and LogicJS. These classes are duplicated in Bankroller App. We have 3 clients and 1 bankroller with the same game logic. The player chooses a bankroller address, amount of BET to deposit and sends a tx to the bankroller’s contract” Alexander Stepanchenko, DAO.Casino Full Stack Developer “That’s when the channel is created. The room is also created at the same time, unless it has been created before. All the participants (lets say 3 players and 1 bankroller) initialise RoomJS class, in which initialisation of LogicJS for all participants takes place” Sergey Pomorin, DAO.Casino Game developer Game Session Sequence Player sends a tx to the game contract, indicating that he’s ready to play. By sending a tx, player also creating a channel. This is a standard Ethereum tx which is propagated through devp2p network and is recorded into Ethereum blockchain.Now bankroller (a person who installed a Bankroller App) can see that someone wants to play.Bankroller opens a room — that means that the players can now connect to the Bankroller App p2p without intermediaries. It’s a bit like having a BlackJack table people can come to.Once player joined a table he can see others playing against the dealer.Each player has an “offchain” channel between them and a dealer, using same signatures that are used on Ethereum network, yet the tx are only added to the block in Ethereum blockchain when the channel is closed.Player can close the channel any time when he decides to stop playing. “After one round is played, a player can either start a new game or take their BET they have won and leave. When a player leaves the channel closes (that’s a tx to the contract). In a current test implementation the channel for all players closes when just one player wants to close it. When one of the players closes a channel all the players leave the room. This is of course a temporary solution” Sergey Pomorin, DAO.Casino Game developer Conclusion
Multiplayer is a very important upgrade for the BlackJack contract and the entire DAO.Casino protocol. It enhances the integrity of the protocol and encourages casino operators and independent developers to implement our product, which means raising the functionality of our BET token. And since multiplayer is ready, our developers will now concentrate their efforts on the new game. Which one? Soon we will announce, stay tuned!DAO.Casino Essential Links
Website: https://dao.casino Prototype: https://platform.dao.casino GitHub: https://github.com/daocasino Email: [email protected] White Paper: https://github.com/DaoCasino/Whitepaper/blob/master/DAO.Casino%20WP.md Slack Invite: https://dao.casino/slack-invite.html Facebook: https://www.facebook.com/Dao.casino/ Twitter: https://twitter.com/daocasino Blog: https://firstname.lastname@example.org/ YouTube: https://www.youtube.com/channel/UCkggi9VnPJ0qUzfj7h70-pQ