Skip to content

levelkdev/state-channel-manager

Repository files navigation

State Channel Manager

An extensible state channel manager for Ethereum.

The goals of this state channel implementation are to:

  • Minimize the marginal gas cost of using a state channel
  • Handle generalized state channels and counterfactual instantiation

A single ChannelManager contract manages all unidirectional state channels. For simplicity, there is no "opening" or "closing" channels. Each channel lives for the entire life of the ChannelManager contract and can be deposited into and withdrawn from.

The ChannelManager contract does not directly handle any dispute resolution or signed messages, just the state channel deposits. Each channel references an external arbiter contract that will return the correct channel value in case of a dispute. State channels are identified by their sender, receiver, and the arbiter contract address.

Arbiter contracts must implement the IChannelArbiter interface:

interface IChannelArbiter {
  function channelValueForUpdate(address sender, address receiver, uint256 nonce) external view returns (uint256 value);
}

Arbiter contracts can be used for a single state channel or multiple channels. If a channel does not have a previously deployed arbiter contract, the arbiter contract can be deployed counterfactually and only used in case of a dispute.

Contracts

ChannelManager.sol

Central contract that manages all deposits. Each deposit is tied to a unidirectional state channel.

Get started

$ npm install

After pulling down the repo for the first time, run chmod +x scripts/** to make scripts executable.

Compile contracts

$ npm run compile

Run tests

$ npm test

Todo: Write README

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published