A group of students from the Technical University of Berlin (TU) has created a chess game on Ethereum using blockchain-based, distributed computing tools. Their mission was to observe how protocols like smart contracts can apply to the age-old strategy game.
Technical University of Berlin Students Research a Blockchain Chess App
The blockchain-based chess game took place during TU’s last semester, according to a recent Medium blog post written by student Paul Grau. It was deployed using Solidity and Ethereum developmental tools while students evaluated both positive and negative aspects of the platform.
The project was mentored by Christian Reitwiessner from the Ethereum foundation and the TU Department of Information Systems Engineering.
The team grew out of a group of students with programming skills and who chose the game chess due to its popularity in the computer science field. With a game that consists of 64 squares and two players controlling 16 pieces, the students had to apply “data structures for all of these, plus logic for making and verifying moves and end game conditions.” To demonstrate the attributes of an Ethereum distributed application, they also added methods for betting.
The team explained:
We abstracted all code that applies to turn-based games in general into an abstract base class. Chess is the main contract the clients interact with. Game rules (state and move validation) are in a sub-library ChessLogic. Some helper functions like signature validation (Auth) and Elo score calculation are also outsourced into libraries. A complete game of Chess can be played reliably on-chain, meaning no other communication is involved except messages from and to the Smart Contract.
On-Chain Cost Difficulties & Block Times
The students said they quickly ran into a major roadblock, discovering it was computationally impossible for the blockchain to end a match. In order to verify a checkmate, Grau wrote, all possible moves must be calculated and verified, which he and his peers found was not feasible on the blockchain.
Another issue with basing the game on-chain was the lack of real-time moves. The students said Ethereum processes blocks every 14 seconds, which in contrast to a real live playing match is quite long.
The team had discovered they should approach certain aspects of the project with off-chain techniques. They found that, in the future, Ethereum’s Whisper may be a better framework for blockchain-based chess.
The Medium post explained the student’s conclusion:
Fundamentally, the decentralised web is about a new way of modelling problems. For that, Smart Contracts provide a good framework of thinking, but additional ideas have to be employed. The Ethereum virtual machine is turing-complete, but that doesn’t mean that everything should be computed on it. Since there is a clear cost assigned to every operation, we have to model our applications in creative ways to use the available resources effectively.
The students concluded that while decentralized games using Ethereum are plausible, their design needs to be a “smart model to make them efficient and usable.”
Back in May, Bitcoin.com reported on a similar Ethereum-based blockchain strategy game using Monopoly as the model. Blocktech IVS founder and CEO Thorkild Grothe-Møller published a video of his proof-of-concept that applies distributed ledger technology to the board game.
The open-source code for the Berlin students’ Chess project can be viewed on GitHub.
What do you think about a blockchain-based Chess game? Let us know in the comments below.
Images courtesy of Shutterstock & Paul Grau‘s Medium Post
Purchase Bitcoin without visiting a cryptocurrency exchange. Buy BTC and BCH here.