Introducing the Force-Move Games Framework for State Channels

The following post is a guest post from Tom Close, Founder and Researcher at Magmo, who has been collaborating closely with the Counterfactual team for the last few months towards our goal of making state channels more accessible to the ethereum community.

Work is underway to accelerate the adoption of state channels, aiming to make them the most accessible technique for scaling blockchain applications. As part of this effort, the team at Magmo have been working to construct the simplest possible state channel framework that’s still practical for real-world use. Today we’re releasing our first paper, describing the outcome of this work: the force-move games framework.

Our framework is designed only to support turn-based games whose moves don’t depend on time or data that is external to the channel. Though this seems restrictive, many state channel use-cases fall into this class: two-player strategy games (e.g. chess, Gomuku, rock-paper-scissors), provably fair games of chance (e.g. dice, roulette), payment channels, and many others, can all be built on top of the framework.

Rock-paper-scissors as a force-move game. For further details, see the “Informal Introduction” section of the paper.

Games involving an oracle (e.g. betting on the outcome of a sports game or election) and games involving steps with fixed deadlines (e.g. “you must accept this agreement by 6pm for it to be valid”) can’t currently be built on the framework, though in the latter case, these games can sometimes be reformulated so that they can.

Using a more restrictive framework like force-move comes with advantages. Because we are only concerned about a certain class of relatively simple game, it becomes possible for the framework to specify the full, on-chain dispute resolution process, handling an area of complexity that would otherwise fall to the application developers. In contrast, frameworks like Counterfactual give greater power to the application developers but (currently) require a greater understanding of state channel techniques.

The force-move games framework specifies both the format of the off-chain messages and the full, on-chain dispute process for the reduced set of state channel applications. It provides a simple interface for application developers to write applications, allowing them to minimize the amount of solidity code that they need to write. An application developer need only write a single ‘game library’ contract, which implements a single ‘validTransition’ function that defines the state transitions allowed in the game. This game library is then deployed once on the blockchain, with its address serving as the unique identifier for that game.

Along with the core framework specification, we provide a simple reference implementation. This implementation provides the simplest possible way of supporting a force-move game, but requires on-chain operations every time a channel is opened and closed. We are designing implementations which support ledger and virtual channels, allowing multiple force-move games to be opened/closed off-chain, supported by a single on-chain deposit. There are also efforts underway to support force-move games on the Counterfactual framework.

Where can I learn more?

If you’d like to know more, we invite you to read the overview post, the paper itself or check out the code! For future releases, please follow @magmoHQ on twitter. We’d love to hear your feedback at research@magmo.com.

We’d like to thank Erik Bryn, Jeff Coleman, Liam Horne, and Li Xuanji for introducing us to state channels and for numerous formative discussions. We’re also very grateful to James Fickel and to L4 for providing us with funding for this work.