class: title # Hands on State Channels --- # Agenda - State Channel Review - Defining State - Adding Rules - Adding Members - Escrow - Signing --- class: title # State Channel Review --- # Defining State - Definition - What is State? - Different methods of representing state --- class: title ## Demo: Adding State to Contract --- ## Exercise - Adding State We're going to build the state channel that you architected last time. Implement the following: - Initialization of State - Ability to change state --- class: title # Start Game Functionality --- # Exercise - Build Functions Create a struct that will represent the data in your state channel. Set up the basic functionality to do the following: - Initialize the contract - Set up a new instance --- class: title # Members of a State Channel --- class: title ## Demo: Implementing members in a state channel --- ## Exercise - Architecting Members When a user creates a state channel, you should define the following: - Parties involved in your state channel - Ensure only allowed parties can interact with it --- class: title # Smart Contract Escrow --- class: title ## Demo: Building an Escrow Contract --- ## Exercise - Escrow Assurance - Build escrow functionality into your contract. - Ensure users are unable to change the state without putting in escrow --- class: title # Signing Transactions --- # Signing Transactions Signing offers: - Integrity of data - Authenticity of the sender -- Putting signatures onto the blockchain can happen in two ways: - Signing a message - Signing hash of a message --- class: title # Dispute Period --- class: title # Demo: Implementing Dispute Period --- # Lab Build a state channel that has the following implementations: - Encompasses a basic state - Allows you to create instances of a contract - Implements required checks to change state - Has a dispute period