Home

Awesome

<!-- PROJECT SHIELDS --> <h2 align="center"> <br/> <a href='https://raiden.network/'><img width='400px' alt='Raiden Logo' src="https://user-images.githubusercontent.com/35398162/54018436-ee3f6300-4188-11e9-9b4e-0666c44cda53.png" /></a> <br/> Raiden Light Client SDK, CLI and dApp <br/> </h2> <h4 align="center"> JavaScript SDK, CLI and dApp to carry out fast, cheap, scalable off-chain token transfers with other <a href="https://github.com/raiden-network/raiden">Raiden Clients</a>. </h4> <p align="center"> <a href="#getting-started">Getting Started</a> ∙ <a href="#contact">Contact</a> </p> <p align="center"> <a href="#try-out-the-raiden-demo-dapp">Try Out the Raiden dApp</a> </p> <p align="center"> <a href="https://circleci.com/gh/raiden-network/light-client"> <img src="https://circleci.com/gh/raiden-network/light-client.svg?style=svg&circle-token=2586ec4e7d610d2a114e4a833fa44ef6c00d9e97" alt="CircleCI Badge"/> </a> <a href="https://codecov.io/gh/raiden-network/light-client"> <img src="https://codecov.io/gh/raiden-network/light-client/branch/master/graph/badge.svg?token=QzmREKozOH" alt="Codecov Badge"> </a> <a href="https://codeclimate.com/github/raiden-network/light-client/maintainability"> <img src="https://api.codeclimate.com/v1/badges/d59cce05c229296c848d/maintainability" alt="Code Climate Badge"/> </a> <a href="https://github.com/prettier/prettier"> <img src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square" alt="Code Style: prettier Badge"> </a> <a href="https://gitter.im/raiden-network/raiden"> <img src="https://badges.gitter.im/gitterHQ/gitter.png" alt="Gitter Raiden Badge"> </a> </p>

The Raiden Light Client SDK is a Raiden Network compatible client written in JavaScript/Typescript, capable of running in modern web3-enabled browsers, wallets and Node.js environments.

The Raiden CLI is a reference implementation that provides a HTTP REST server which is fully compatible with the Raiden API specification.

The Raiden dApp is a reference implementation of the Raiden Light Client SDK, which can be used with web3 wallets like Metamask (Desktop) or imToken (mobile).

INFO: The Light Client SDK, CLI and dApp are all work in progress projects. All three projects have been released for mainnet and all code is available in the Light Client repository. As this release still has its limitations and is a beta release, it is crucial to read this readme including the security notes carefully before using the software.

Table of Contents

About The Project

The Raiden Network is an off-chain scaling solution, enabling near-instant, low-fee and scalable payments. It’s complementary to the Ethereum blockchain and works with any ERC20 compatible token.

The Raiden client code is available here and has been released for mainnet.

<center> <img width='750px' alt='Raiden Diagram' src="https://user-images.githubusercontent.com/43838780/85526750-8ecdc680-b60a-11ea-8a42-07da6b0f8296.png" /> </center>

The goal of the Raiden Light Client SDK is to provide an easy-to-use framework, which can be integrated by any JavaScript developer. The SDK simplifies the process for developers to embed and use the Raiden Network for token transfers in decentralized applications

The SDK aims to make the life of dApp developer easier by:

Architecture

Raiden Light Client SDK

The Raiden Light Client SDK is a standalone TypeScript library which contains all the low level machinery to interact with the Ethereum blockchain and the Raiden Network.

Its target audience is blockchain and dApp developers looking to perform transfers in the Raiden Network from their dApps.

By targeting browsers and Node.js as initial platforms, the SDK can reach a majority of the current and in-development dApps, as well as providing a common language reference implementation for re-implementations in other languages and environments.

Look at the Raiden Light Client SDK folder of this repository for more information and a technical deep dive into the SDK architecture, technologies and details on the design goals and decisions.

Reading the documentation is highly recommended for anyone who wishes to better understand how the Raiden Light Client works under the hood or wants to contribute to its development.

Architecture diagram

            +-------------------+
            |                   |
            |   Raiden dApp     |
            |                   |
            |  vue/vuex/vuetify |
            |                   |
            +---------+---------+
            |                   |
            |    Raiden SDK     |
            |                   |
            +----+----+----+----+
            |         |         |      +--------------+
        +---+  redux  +  epics  +------+ Matrix.org / |
        |   |         |         |      |    WebRTC    |
        |   +---------+-----+---+      +-------+------+
        |                   |                  |
+-------+--------+   +------+------+    +------+------+
|    pouchDB     |   |  ethers.js  |    |    Raiden   |
+----------------+   +------+------+    |    Network  |
                            |           +-------------+
                     +------+------+
                     |  ethereum   |
                     +-------------+

Learn about Raiden

If you are new to Raiden, we recommend:

Try Out the Raiden dApp

Before trying out the dApp, make sure that you've read and understood the requirements for safe usage

The Raiden dApp is a demo and the first dApp to be built on the SDK. It's a single page application (SPA) built on top of Vue.js, vuex and uses vuetify Material Design as UI framework.

These step-by-step instructions will guide you through the process for trying out the Raiden demo dApp.

The dApp is hosted on https://lightclient.raiden.network and in this quick start guide we will be making a transfer using the Light Client on both mainnet and the Goerli testnet with the MetaMask wallet.

For a more in depth user guide, see the Light Client documentation.

Prerequisites

For these step-by-step instructions the MetaMask browser extension will be used. Make sure MetaMask is installed on your browser. the plugin can be downloaded from their website. Alternatively WalletConnect can be used for connecting with supported wallets, note that this is an experimental feature limited to how well any of the external wallets integrate with WalletConnect.

An ETH balance is also needed. For mainnet you'll have to purchase ETH, for the Goerli testnet you can acquire some test ETH by:

  1. visiting a Goerli faucet either at https://faucet.goerli.mudit.blog or https://goerli-faucet.slock.it/.
  2. Follow the instructions on respective faucet on how to acquire the ETH.

Making a First Transfer on Mainnet

  1. Connect to the dApp

    • Connect using the Browser Extension

      1. Visit the Light Client.
      2. Make sure Ethereum Mainnet is selected in MetaMask.
      3. Click on Browser Extension.
      4. Click on Connect and sign the messages on MetaMask to establish a connection.
    • Connect using WalletConnect

      1. Visit the Light Client.
      2. Click on WalletConnect.
      3. By default a bridge server provided by WalletConnect is used. It is however possible to use an alternative bridge server.
      4. Choose to provide either an Infura ID or a RPC endpoint.
      5. Click on Connect.
      6. Scan the QR code using a wallet of your choice. Make sure mainnet is used and sign all necessary signatures.
  2. Select a Hub and Open a Channel

    1. Click the + icon and select a mainnet token to use. You need to have a balance of the token.
    2. If you don't have any RDN (utility tokens), you can click the icon to open a dialog with a link for exchanging RDN and a button for depositing.
    3. Enter an address of your choice to connect to or select a suggested hub if any are available.
    4. Click the Select Hub button
    5. Enter the amount of tokens you want to deposit when opening the channel.
    6. Click the Open Channel button and sign with MetaMask.
  3. Make a Transfer

    1. Enter the address of the node receiving your transfer.
    2. Enter the amount you want to transfer.
    3. Click the Transfer button.

Making a First Transfer on Testnet

  1. Connect to the dApp

    1. Visit the Raiden Hub page.
    2. Click on the Open Channel with Hub button.

    When redirected to the Light Client choose to connect by using either:

    • Browser Extension

      1. Make sure Goerli Test Network is selected in MetaMask.
      2. Click on Browser Extension.
      3. Click on Connect and sign the messages on MetaMask to establish a connection.
    • WalletConnect

      1. Click on WalletConnect.
      2. By default the bridge server provided by WalletConnect is used. It is however possible to use an alternative bridge server.
      3. Choose to provide either an Infura ID or a RPC endpoint.
      4. Click on Connect.
      5. Scan the QR code using a wallet of your choice. Make sure Goerli Test Network is used and sign all necessary signatures.
  2. Select a Hub and Open a Channel

    1. If you don't have any SVT (utility tokens), you can click the icon to mint and deposit SVT.
    2. Click on the icon at the very bottom to the right of the TTT symbol to mint TTT tokens.
    3. Click the Select Hub button.
    4. Enter the amount of tokens you want to deposit when opening the channel.
    5. Click Open Channel and sign with MetaMask.
  3. Make a Transfer

    1. Enter the address of the node receiving your transfer.
    2. Enter the amount you want to transfer.
    3. Click the Transfer button.

Receiving Transfers

Receiving of transfers will be disabled if the utility token (RND on mainnet and SVT on testnet) balance is too low.

To enable receiving again, make sure to add a utility token balance by either making an exchange and deposit if using the Light Client on mainnet or by minting and depositing if using the Light Client on testnet.

Backup the State to Keep Your Tokens

You should store a backup of your state to avoid losing tokens in case:

If you want to continue using the dApp with a specific account after switching browser or changing computer, you'll need to make sure that the dApp is connecting with the most recent state.

This is important because the state contains all off-chain information needed for making transactions in the Raiden Network.

The state is stored in the browser across sessions and therefore needs to be downloaded and uploaded whenever you switch browser or computer.

You can download and upload the state from the General Menu.

If you lose or delete your state you will also lose your token.

Example of a part of the JSON state file:

[
  {
    "_id": "_meta",
    "version": 2,
    "network": 5,
    "registry": "0x9b0c8C8C75904CEf5B7a8dbF59c3459Ea85c6526",
    "address": "0x2a23F385d32dcce35824D4498Bb10f9B6575B2de",
    "blockNumber": 2561973
  }
]

Run the Repository Code

Prerequisites

To run the code in this repository, you must have Node.js 14+ and Yarn installed as well as a web3-enabled browser (e.g. Firefox with Metamask extension), with some ETH on the account.

SDK Documentation

Go to the SDK Documentation for more information on how to install and use the SDK.

CLI Documentation

Go to the CLI README for installation instructions and the current status of the API.

Install and Run the dApp

  1. Clone repository

    git clone --recurse-submodules https://github.com/raiden-network/light-client.git
    cd light-client
    
  2. Install dependencies

    yarn install
    
  3. Update the sdk submodules

    yarn workspace raiden-ts update-submodules
    
  4. Build the Raiden SDK

    yarn workspace raiden-ts build
    
  5. Run the dApp locally

    yarn workspace raiden-dapp serve
    

    After the development server starts, navigate to http://localhost:8080 to use the Raiden dApp.

Requirements for Safe Usage

In order to use Raiden correctly and safely there are some things that need to be taken care of by the user:

Roadmap and Timeline

We are working in 2 weekly iterations. Priorities are managed within the Product Backlog.

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

Also have a look at the Raiden Light Client Development Guide for more info.

Bug Bounty

The Raiden team has undertaken several risk mitigation measures to limit any potential damage caused by bugs or misuse of the software. In addition, a bug bounty is run in order to make sure the software lives up to the highest standards possible. For more information and to participate visit the Raiden Bug Bounty website.

License

Distributed under the MIT License.

Contact

Dev Chat: Gitter

Twitter: @raiden_network

Website: Raiden Network

Mail: contact@raiden.network

Project Link: https://github.com/raiden-network/light-client