Monorepo
Home for all packages related to the Counterfactual project
Install / Use
/learn @counterfactual/MonorepoREADME
NOTE: This repository has been moved. Work is continuing under the @statechannels organization as part of statechannels.org project to unify state channels initiatives.
<h1 align="center"> <br> <a href="https://counterfactual.com"><img src="./logo.svg" alt="Counterfactual" width="150"></a> <br> Counterfactual <br> <br> </h1> <h4 align="center">Simple off-chain applications framework for Ethereum.</h4> <p align="center"> <a href="https://circleci.com/gh/counterfactual/monorepo"><img src="https://circleci.com/gh/counterfactual/monorepo.svg?style=shield&circle-token=adc9e1576b770585a350141b2a90fc3d68bc048c" alt="circleci"></a> <a href="https://lernajs.io/"><img src="https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg"/></a> <a href="https://counterfactual.com/chat"><img src="https://img.shields.io/discord/500370633901735947.svg"/></a> <a href="https://github.com/renovatebot/renovate"><img src="https://badges.renovateapi.com/github/counterfactual/monorepo"/></a> <a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="license"></a> </p> <br>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.
Packages
Solidity Packages
| Package | Version | Description |
| --- | --- | --- |
| @counterfactual/cf-funding-protocol-contracts | | Contracts implementation of the Counterfactual funding protocol |
|
@counterfactual/cf-adjudicator-contracts | | Contracts implementation of an AppInstance Adjudicator |
Typescript/Javascript Packages
Counterfactual-specific packages
| Package | Version | Description |
| --- | --- | --- |
| @counterfactual/node | | The core state channels client that a user runs |
|
@counterfactual/cf.js | | A JS API for interacting with off-chain apps |
|
@counterfactual/node-provider | | Wrapper around API calls to a Node |
Utilities
| Package | Version | Description |
| --- | --- | --- |
| @counterfactual/types | | Shared type declarations |
|
@counterfactual/typescript-typings | | Shims for external library typings |
Contributing
- Join us in Discord to help with development or to hang out with some ethereum hackers :)
- Create a new issue to report bugs
- Fix an issue. Counterfactual is an Open Source Project!
Ethereum Networks
The Playground currently only supports the Kovan network.
Installing dependencies
Make sure you have Yarn v1.19.0 installed. For easy management of specific Yarn versions, we recommend using Yarn Version Manager (YVM).
To install the dependencies:
yarn
Building packages
It is recommended (optional) that you installed solc compiler binary on your machine (installation guide) and specify the following in your .env under cf-funding-protocol-contracts and apps
NATIVE_SOLC=true
To build all packages:
yarn build
Clean
To clean all packages:
yarn clean
Lint
To lint all packages:
yarn lint
To also apply automatic fixes:
yarn lint:fix
Tests
To run all tests:
yarn test
To run E2E tests:
- If you're using E2E tests for the first time or have done recent changes to the code, run:
yarn test:e2e:setup
- If you're re-running tests or writing new scenarios, run:
NODE_EXTENDED_PRIVATE_KEY="..." yarn test:e2e
See the "Funding the Hub Account for Playground Testing" section on the Simple Hub Server package for more information about NODE_EXTENDED_PRIVATE_KEY.
Patches
We generate patches using the patch-package tool with a workaround described in this issue for yarn workspaces.
Related Skills
node-connect
337.7kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
337.7kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.3kCommit, push, and open a PR
