Skip to content
Home for all packages related to the Counterfactual project
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Deploy heroku stuff after npm (#1087) Mar 18, 2019
packages [machine] replace Context with generator-based communication (#890) Mar 20, 2019
.yarnrc Create (#173) Nov 6, 2018
LICENSE [playground][playground-server][apps][node][dapp-tic-tac-toe] Support… Mar 12, 2019
lerna.json Publish to npm if versions are bumped in source code (#895) Mar 1, 2019
logo.svg 🛠 Ensure `yarn build` and `yarn test` work as expected (#143) Oct 23, 2018


Simple off-chain applications framework for Ethereum.

circleci license

Counterfactual is a simple off-chain framework for building state channel applications on top of the Ethereum blockchain. It aims to make it simpler to build permissionless applications that have instant finality with zero-fee transactions.

You can learn more about what state channels are by reading our whitepaper or a less technical written description. Further, if you want to dive into the specifications of the Counterfactual protocol you can read them here.

🚨 WARNING: the code found here has been created for demonstration and example purposes, with developers looking to build state channel applications as the intended audience and user-base. This code is not yet intended for production use with real funds, assets or users. In particular, specific safety measures have been intentionally omitted from this early version for the sake of simplicity, and various pieces of its architecture (e.g., the messaging layer) use trust assumptions that, while appropriate to a "playtesting" development environment, would have serious consequences if used to protect actual assets in the real world. This framework, once further developed, finalized, and hardened, is intended to eventually become a tool that will be used in production deployments. If you have those use cases in mind we welcome your participation and feedback now, to ensure that early production versions will meet your needs. But please don't deploy this framework in its current form. That is not its intended use.


Solidity Packages

Package Version Description
@counterfactual/contracts npm Core implementation of on-chain state resolution mechanisms

Typescript/Javascript Packages

Counterfactual-specific packages

Package Version Description
@counterfactual/node npm The core state channels client that a user runs
@counterfactual/cf.js npm A JS API for interacting with off-chain apps
@counterfactual/node-provider npm Wrapper around API calls to a Node
@counterfactual/machine npm Extendible middleware-based executor of Counterfactual protocols


Package Version Description
@counterfactual/types npm Shared type declarations
@counterfactual/typescript-typings npm Shims for external library typings


Ethereum Networks

The Playground currently only supports the Kovan network.

Installing dependencies

Make sure you have Yarn v1.10.1 installed or higher. Refer to Yarn's installation guide for setup instructions for your operating system.

To install the dependencies:


Building packages

To build all packages:

yarn build


To clean all packages:

yarn clean


To lint all packages:

yarn lint

To also apply automatic fixes:

yarn lint:fix


To run all tests:

yarn test


We generate patches using the patch-package tool with a workaround described in this issue for yarn workspaces.

You can’t perform that action at this time.