Skip to content

w3f-grants-archive/state-channels-plus

 
 

Repository files navigation

Peer3 - State Channels Plus

This is an SDK for creating scalable and resilient client side peer-to-peer (p2p) state channels for arbitrary state machines with shared security inherited from a distributed ledger (blockchain).

The repository currently holds a Minimal Feature Set (MFS) as part of our grant agreement with the Web3 Foundation.

We recommend waiting for the Full Feature Set before using it in production.

Table of Contents

Videos

Installation

yarn add @peer3/state-channels-plus

Getting Started

The SDK currently supports running EVM smart contracts (state machines). We recommend watching our tech explanation video to have a rough estimate how things work.

While you can do general (arbitrary) execution, the SDK requires the state machines to implement a base contract AStateMachine. The implemented contract executes p2p with shared security enforced by a blockchain, concretely by a StateChannelManager contract that extends AStateChannelManager.

The TypeScript part of the SDK currently builds on top of ethers.

The SDK abstracts away most of the complexities of the system and is designed to have the same development experience as if the contracts were executing on-chain. It takes an ethers contract instance and enshrines it during setup. The enshrined contract has the same type and functionality as the original contract, but it executes p2p. The setup also wraps the ethers signer by giving it more functionality that's used within the system.

Examples

Tic-Tac-Toe - the code used in the demo video

Run Tests

Install local dependencies

yarn

Compile the contracts and run tests

yarn testc

Contact

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 73.9%
  • Solidity 26.0%
  • Dockerfile 0.1%