State channels and multy-signed contracts

This is depending on what type of example you want.

In order to have a valid state channels - the on-chain protocol must be satisfied. Everything beyond that is to make our lives easier.

If you want an example for how to write yourself a service that acts as a participant in a State Channel - I can not show you example code for that.

If you want to build an app that consumes the WebSocket APIs - you can check this as it covers all the communication between participants for opening, making a few off-chain payments and closing the channel. This is a simple synchronous JSON-RPC WebSocket protocol you can build your apps on top of. You can consume this API using any stack that provides WebSocket support.

If you want a JS example - you can check this pull request. Please keep in mind that it is still work in progress, so it is not polished, it does not communicate with a wallet and etc. I am not sure what its fate would be and it could as well be a throwaway example - I see it is based on roma release :slight_smile: Nevertheless - you can draw a lot of inspiration from there.

1 Like