An Overview of the Force-Move Games Framework for State Channels
The force-move games framework is an attempt to build the simplest possible state channel framework that’s still practical for real-world use. The framework is designed only to support turn-based games whose moves don’t depend on time or data that is external to the channel. By focussing on a restricted set of games, we are able to specify the full, on-chain dispute resolution process, handling an area of complexity that would otherwise fall to the application developers.
In this post we give a brief overview of the framework and give an example of how it can be used. For more about the tradeoffs made in the force-move game approach, please see our Introducing Force-Move Games post.
Brief overview of the framework
Like all state channels, force-move games need to be backed by an on-chain deposit. In the force-move games framework, an adjudicator contract is responsible for both holding these funds and enforcing the rules of the game in the case of an on-chain challenge.
Once the channel is funded by assets in an adjudicator, play progresses off-chain as players take turns in order, broadcasting cryptographically signed state updates to all other players in the game. The enforced turn order removes any dispute over whose turn it is, ruling out one class of disputes.
In the case where one player stalls or becomes unresponsive, one of their opponents can call the force-move operation on the adjudicator, which starts a time-out period. If there is no response to the force-move before the end of the time-out period, the game ends, with funds distributed according to the resolution of the current state. We require that the resolution be a pure function of the state’s attributes, which enforces the framework’s restriction to time-independent games. The resolution in each state must be specified by the application developer, taking into account the game-theoretic dynamics of the game.
There is a special procedure to conclude games off-chain, allowing the funds to be withdrawn ‘instantly’, without having to wait for the usual force-move time-out. For more information on this and the rest of the framework, please read the paper!
Ok, but how do I use it?
We’ve designed the force-move game framework with developers in mind, trying to provide a simple way for application developers to model and code state channel applications. The developer is responsible for writing a game library contract that defines application-specific states, and the transitions between them.
As an example, here is the (complete) on-chain application code for an implementation of a bi-directional payment channel between two parties.
The code here is particularly simple as all the state is provided by the framework — a payment channel can be viewed as a set of rules about how the current resolution (the amounts paid out to players if the game stalled) can be updated. The rules enforce the usual principle that you can’t unilaterally take funds from your “opponent” in a payment channel.
We have also implemented the game of rock-paper-scissors in the force-move games repo.
Where can I learn more?
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.