Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hyperledger-labs/perun-eth-contracts
🌔 Perun's Ethereum State Channel Contracts
https://github.com/hyperledger-labs/perun-eth-contracts
blockchain go state-channels
Last synced: about 1 month ago
JSON representation
🌔 Perun's Ethereum State Channel Contracts
- Host: GitHub
- URL: https://github.com/hyperledger-labs/perun-eth-contracts
- Owner: hyperledger-labs
- License: apache-2.0
- Created: 2020-07-23T21:44:18.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-02-03T11:38:00.000Z (almost 2 years ago)
- Last Synced: 2024-08-01T22:54:51.348Z (5 months ago)
- Topics: blockchain, go, state-channels
- Language: TypeScript
- Homepage: https://perun.network/
- Size: 1.22 MB
- Stars: 9
- Watchers: 8
- Forks: 5
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Perun State Channels Framework - Ethereum Backend Smart Contracts
This repository contains the Ethereum smart contracts for [go-perun](https://github.com/hyperledger-labs/go-perun)'s Ethereum backend.
## Security Disclaimer
The smart contracts presented in this directory are under active development and are not ready for production use.
The authors take no responsibility for any loss of digital assets or other damage caused by their use.## Contracts
Perun's Generalized State Channels Framework uses a set of interconnected smart contracts to define the on-chain logic for channel deposits, disputes, settlements and withdrawals.
For more detailed information, check out the [documentation](https://labs.hyperledger.org/perun-doc/index.html).### Asset Holder
Asset holders are singleton contracts that hold the assets for ledger channels.
They are deployed once per asset (ETH, ERC-20, ...) and are shared between all channels that reference the same Adjudicator contract for channel disputing and closing.Deposits are directly transferred to the Asset Holders.
The outcome of closed channels are set by the Adjudicator on the channel's asset holders.
After the outcome has been set, channel participants can withdraw their assets from the asset holders, sending a Withdrawal Authorization that has to be signed by the respective channel participant.### Adjudicator
The Adjudicator contract is called to dispute or close a channel.
It interprets channel states and sets finalized channel outcomes on the asset holders.**Collaborative Close** 
All channel participants can agree on a final state off-chain.
In this case they can settle a channel without waiting for any timeouts by calling `concludeFinal` on the Adjudicator.
The Adjudicator will set the outcome on the individual asset holders, ready for withdrawal.**Dispute** 
In case of a channel dispute, any party can `register` their final state on the Adjudicator contract.
After state registration, the other channel participants have the chance to `refute` the submitted state with a higher-version state during the challenge period.
After the challenge period is over, the channel outcome can either be finalized on the asset holders by calling `conclude` or the app's state can be progressed on-chain by calling `progress`.### App Contracts
State Channel apps define a single method, `validTransition`, which defines the app-specific state transition rules.
When a channel state is progressed on-chain on the Adjudicator by calling `progress`, the Adjudicator reads the address of the channel app from the channel parameters and, after performing generic state progression checks, calls the `validTransition` method on the app.
It is assumed to revert if any app-specific check fails.## Testing
The repository must be cloned recursively including [submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules).
[Yarn](https://yarnpkg.com) is expected to be installed globally.
To run the tests, run
```sh
$ yarn
$ yarn build
$ yarn test
```## Copyright
Copyright 2021 - See [NOTICE](NOTICE) file for copyright holders.
Use of the source code is governed by the Apache 2.0 license that can be found in the [LICENSE file](LICENSE).Contact us at [[email protected]](mailto:[email protected]).