I'll guide you through a simple example project so that you can see state channels in action. They use commitment schemes, which are just encrypted transactions that you can't change to commit to your actions before revealing the result when the players decide to show their cards.
The smart contract will be the entry and exit point of the state channel. What happens in-between is outside of the blockchain's control, although we'll define what goes inside each encrypted message so that we can verify it when ending. These are the steps:
- Each player that participates in the game must open the state channel by calling a function in the smart contract to define who they are. When they do that, ...