Simple off-chain applications framework for Ethereum.
statechannels 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.
- app-wallet-interface : API docs for the interface betwen a state channel Dapp and the wallet
- channel-provider : A browser-based loader for the Embedded Wallet.
- client-api-schema : JSON-RPC based schema definitions for the Client API with TypeScript typings
- devtools : Developer tooling
- embedded-wallet : Allows DApps to integrate with statechannels system
- ganache-deployer : Manages cross-package contract deployment and a consistent network context
- hub : Server wallet for mediating virtual channels
- jest-gas-reporter : Reports the gas used by various calls to ethereum contracts
- nitro-protocol : Smart contracts and documentation website
- rps : Rock paper scissors DApp
- wallet : Core wallet logic that follows ForceMove and Nitro protocols
- web3torrent : DApp extension of webtorrent including micropayments
- wallet-protocols : Core protocols written using
- xstate-wallet : A wallet written on top of wallet-protocols
Make sure you have Yarn v1.17.3 installed. For easy management of specific Yarn versions, we recommend using Yarn Version Manager (YVM).
To install the dependencies:
from the monorepo root.
To build all packages:
To clean all packages:
To lint all packages:
To also apply automatic fixes:
To run all tests:
hub packages will need to interact with a local
blockchain when running and testing locally.
When running locally, it's often important to have the packages pointing to the same contracts on the same local blockchain.
When started via
yarn start the
hub packages will:
- Check for a "shared ganache" instance running at the
SHARED_GANACHE_PORT, as defined in their
.envfile. (This is currently set the same for all packages.) This shared ganache instance can be started by running
yarn start:shared-ganachefrom any of the packages.
- If the shared ganache instance is found, they will deploy contracts to this instance, and
make the addresses available in the application via
process.ENV. Details of the deployed contract will also be stored in the
monorepo/ganache-deployments.jsonfile, so that if another project attempts to deploy another contract with the same args and bytecode, the address of the existing contract will be returned instead.
- If no shared ganache instance is found, the package will start their own ganache instance, which won't be shared with any other package.
TL;DR: to share deployed contracts between packages in development, you must start a shared
ganache server with
State Channels Forums: https://research.statechannels.org/