Skip to content

Commit

Permalink
cChannel v0.11.0 (#6)
Browse files Browse the repository at this point in the history
* withdraw to another channel

* gas used log 

* lightweight cooperative on-chain checkpoint

* fix null sub msg bug

* Proto 93 update protoc gen sol

* fix create bug

* separate PayRegistry

* add mock ERC20 details

* support numeric conditions

* limit per channel deposit sum

* Rename references of chain2 to chain

* remove unnecessary abi.encodePacked

* withdraw only during operable channel status

* fix withdraw bug

* upgrade libs to latest stable version

* add require msg

* add EthPool tests

* downgrade openzeppelin

* Update README.md
  • Loading branch information
stevenlcf authored May 9, 2019
1 parent 8827e41 commit 6454c0e
Show file tree
Hide file tree
Showing 40 changed files with 3,648 additions and 6,289 deletions.
8 changes: 1 addition & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
sudo: required
language: node_js
node_js:
- "10"
- "10.15.3"
cache:
directories:
- node_modules
addons:
apt:
sources:
- sourceline: "ppa:ethereum/ethereum"
packages:
- abigen
install:
- npm install
- npm install -g truffle ganache-cli
Expand Down
46 changes: 26 additions & 20 deletions README.md
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

* [Overview](https://github.com/celer-network/cChannel-eth#overview)
* [Work In Progress (WIP) Notice](https://github.com/celer-network/cChannel-eth#work-in-progress-wip-notice)
* [Release Features](https://github.com/celer-network/cChannel-eth#release-features)
* [Core Concepts](https://github.com/celer-network/cChannel-eth#core-concepts)
* [Release Features](https://github.com/celer-network/cChannel-eth#release-features)
* [Protocol Buffers Usage](https://github.com/celer-network/cChannel-eth#protocol-buffers-usage)
* [Testnet](https://github.com/celer-network/cChannel-eth#testnet)
* [Solidity Version](https://github.com/celer-network/cChannel-eth#solidity-version)
Expand All @@ -24,25 +24,9 @@ For more details about cChannel and Celer Network, please refer to [Celer Networ
cChannel-eth is currently under active developments in our private repo. This public repo only acts as a showcase of periodically public updates.
**This repo is not intended for production use and please DO NOT use the code in this repo with any real money, funds or assets.**

## Release Features
* **Single-contract Multiple-token Support**: supports multiple Ethereum token standards in different channels under one single contract.
* **ETH Support**: users can specify ETH to open an ETH-based channel.
* **ERC20 Token Support**: users can specify an ERC20 token to open an ERC20-based channel.
* **Generalized State Channel**: resolves conditional state dependency by relying on dependent virtual channels.
* **Fully Duplex Channel**: supports two independent simplex (single-direction) channels in a duplex channel, which makes off-chain communications much simpler and more efficient.
* **Boolean Condition Interface**: defines the condition that returns boolean value.
* **Boolean AND Resolution Logic**: resolves a group of conditions based on a simple boolean AND logic.
* **Boolean OR Resolution Logic**: resolves a group of conditions based on a simple boolean OR logic.
* **ERC20-like ETH wrapper**: provides similar APIs of ERC20 tokens for ETH to enable more efficient onchain operations.
* **Single-transaction Channel Opening**: opens channel with a single on-chain transaction through funds approval for both ETH and ERC20 tokens.
* **Batch Multi-Channel Settlements**: intends to settle multiple channels in one batch with a single on-chain transaction.
* **Batch Multi-Payment Liquidation**: liquidates *N* payments in one batch with a single on-chain transaction using PayHashList, which only requires O(1) on-chain storage and O(*n*/*N*) on-chain verifications to liquidate *n* payments.
* **Cooperative Dynamic Withdraw**: skips challenge period and withdraws fund before channel finalized when both participants reach an agreement.
* **Cooperative Settle**: skips challenge period and settles a channel when both participants reach an agreement.

## Core Concepts
* **Peers**: channel participants (only supports two-peer channel for now).
* **Simplex Channel**: a single-direction payment channel from one peer to another peer.
* **Simplex Channel**: a single-direction payment channel from one peer to the other peer.
* **Duplex Channel**: a bidirectional payment channel between peers including two independent simplex channels.
* **Simplex State**: a piece of data describing the state of a simplex channel.
* **Signed Simplex State**: Simplex State signed by channel participants, which serves as a bridge data structure between on-chain contracts and off-chain communication protocols.
Expand All @@ -57,13 +41,35 @@ cChannel-eth is currently under active developments in our private repo. This pu
* **EthPool**: A ETH wrapper to provide ERC20-like APIs for ETH.
* **Virtual Address Resolver**: establishes the mapping from off-chain address to on-chain address.

## Release Features
* **Single-contract Multiple-token Support**: supports multiple Ethereum token standards in different channels under one single contract.
* **ETH Support**: users can specify ETH to open an ETH-based channel.
* **ERC20 Token Support**: users can specify an ERC20 token to open an ERC20-based channel.
* **Generalized State Channel**: resolves conditional state dependency by relying on dependent virtual channels.
* **Fully Duplex Channel**: supports two independent simplex (single-direction) channels in a duplex channel, which makes off-chain communications much simpler and more efficient.
* **Boolean Condition Interface**: defines the condition that returns boolean value.
* **Boolean AND Resolution Logic**: resolves a group of conditions based on boolean AND logic.
* **Boolean OR Resolution Logic**: resolves a group of conditions based on boolean OR logic.
* **Numeric Condition Interface**: defines the condition that returns numeric value.
* **Numeric ADD Resolution Logic**: resolves a group of conditions based on numeric ADD logic.
* **Numeric MAX Resolution Logic**: resolves a group of conditions based on numeric MAX logic.
* **Numeric MIN Resolution Logic**: resolves a group of conditions based on numeric MIN logic.
* **ERC20-like ETH wrapper**: provides similar APIs of ERC20 tokens for ETH to enable more efficient onchain operations.
* **Single-transaction Channel Opening**: opens channel with a single on-chain transaction through funds approval for both ETH and ERC20 tokens.
* **Dynamic Withdraw**: withdraws fund before channel finalized as long as no peers disagree during challenge period.
* **Cooperative Dynamic Withdraw**: skips challenge period and withdraws fund before channel finalized when both peers reach an agreement.
* **Lightweight cooperative on-chain checkpoint**: support snapshotting transfer map of co-signed states on-chain.
* **Batch Multi-Channel Settlements**: intends to settle multiple channels in one batch with a single on-chain transaction.
* **Batch Multi-Payment Liquidation**: liquidates *N* payments in one batch with a single on-chain transaction using PayHashList, which only requires O(1) on-chain storage and O(*n*/*N*) on-chain verifications to liquidate *n* payments.
* **Cooperative Settle**: skips challenge period and settles a channel when both peers reach an agreement.

## Protocol Buffers Usage
[Protocol Buffers (protobuf)](https://developers.google.com/protocol-buffers/) are "a language-neutral, platform-neutral extensible mechanism for serializing structured data" developed by Google.
We leverage Protocol Buffers to define a series of blockchain-neutral generalized data structures, which can be seamlessly used in off-chain communication protocols and instantly extended to other blockchains that we plan to support.

We also developed and open sourced a library generator of Solidity for decoding proto3 called [pb3-gen-sol](https://github.com/celer-network/pb3-gen-sol), which is listed in the official [Third-Party Add-ons for Protocol Buffers](https://github.com/protocolbuffers/protobuf/blob/master/docs/third_party.md).

Two proto3 files are used in cChannel-eth, `chain2.proto` and `entity.proto`, which are stored in `lib/data/proto/`. `chain2.proto` defines data structures only used in on-chain contracts ("2" means version 2) while `entity.proto` defines data structures used both in on-chain contracts and off-chain communication protocols.
Two proto3 files are used in cChannel-eth, `chain.proto` and `entity.proto`, which are stored in `lib/data/proto/`. `chain.proto` defines data structures only used in on-chain contracts ("2" means version 2) while `entity.proto` defines data structures used both in on-chain contracts and off-chain communication protocols.

## Testnet
This version is waiting for deployment.
Expand Down Expand Up @@ -103,7 +109,7 @@ npm install -g truffle ganache-cli
</pre>
5. Run ganache-cli
<pre>
ganache-cli
ganache-cli -l 8000000
</pre>
6. Use truffle to run tests of cChannel-eth contracts.
<pre>
Expand Down
Loading

0 comments on commit 6454c0e

Please sign in to comment.