GithubHelp home page GithubHelp logo

azmiruddin / contracts-eth Goto Github PK

View Code? Open in Web Editor NEW

This project forked from perun-network/contracts-eth_archived

0.0 1.0 0.0 777 KB

:moon: Perun's Ethereum State Channel Contracts

Home Page: https://perun.network/

License: Apache License 2.0

JavaScript 2.51% TypeScript 52.66% Shell 2.92% Solidity 41.91%

contracts-eth's Introduction


Perun

Perun State Channels Framework - Ethereum Backend Smart Contracts

This repository contains the Ethereum smart contracts for 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 wiki.

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. Yarn, Typescript, and Truffle are expected to be installed globally. To run the tests, run

$ yarn
$ yarn build
$ yarn test

This has been tested with Truffle version 5.1.46.

Copyright

Copyright 2020 - See 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.

Contact us at [email protected].

contracts-eth's People

Contributors

sebastianst avatar ggwpez avatar matthiasgeihs avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.