class: title # Introduction to State Channels --- # Outline - "State" and the concept of state - Blockchain vs Centralized Solutions - Role o Smart Contract - What goes on-chain and stays off-chain --- class: title # State --- class: img-caption  State are (Heads, Tails) usually maps to one person (Winning, Losing) --- class: img-caption  State in a Tic Tac Toe game can be [Started, Playing, Won, Loss, Tie] --- # State Channel Characteristics - Members allowed to interact with it - Rules of the game - Changing of state - Disputing changing state --- class: title # Discussion: Tic Tac Toe on State Channels --- ## Exercise - Architecture - What are the states required to play Tic Tac Toe on the blockchain? - What about off-chain? --- class: title # Members of a State Channel --- class: img-caption  Members of a coin-toss game are the two members who are betting on either Heads/Tails. --- class: img-caption  Members of a tic-tac-toe game are the two members who are making the X O moves. --- # Rules of Tic Tac Toe - Once player A plays, it's player B's turn - A Player wins when there are three consecutive letters in one direction - It is not necessary for a game to have a winner --- # State Channel Smart Contract - State channels is the third party arbitrator - Defines the rules of the game - Handles paymets, if necesssary --- class: title # Discussion: How do smart contracts verify information? --- # Signatures - Assumption: Owner of the private key is the owner of the account - Signs data using the private key - Like an unfforgeable signature on an important letter --- class: title # The state of a state channel should NEVER change without a dispute period. --- # Dispute Period - A finite amount of time where both parties are allowed to provide updated signatures - Failsafe: In case a party tries to replay an old signature --- # Lab Architect your smart contract by defining the following interface: - List your public methods - Have at least 3 states - Identify parameters/arguments/return values of functions - One function has to take signatures - Identify where you would need a dispute period