JavaScript SDK, CLI and dApp to carry out fast, cheap, scalable off-chain token transfers with other Raiden Clients.
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.
- About the Project
- Architecture
- Learn about Raiden
- Try Out the Raiden dApp
- Run the Repository Code
- Requirements for Safe Usage
- Roadmap and Timeline
- Contributing
- Bug Bounty
- License
- Contact
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.
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:
- Enabling dApps to easier interact with the Raiden Network.
- Helping users to make token transfers using consumer wallets like MetaMask and imToken.
- Enabling transferring and receiving tokens using low-end devices.
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.
+-------------------+
| |
| Raiden dApp |
| |
| vue/vuex/vuetify |
| |
+---------+---------+
| |
| Raiden SDK |
| |
+----+----+----+----+
| | | +--------------+
+---+ redux + epics +------+ Matrix.org / |
| | | | | WebRTC |
| +---------+-----+---+ +-------+------+
| | |
+-------+--------+ +------+------+ +------+------+
| pouchDB | | ethers.js | | Raiden |
+----------------+ +------+------+ | Network |
| +-------------+
+------+------+
| ethereum |
+-------------+
If you are new to Raiden, we recommend:
- Browsing the developer portal.
- Reading the Raiden documentation.
- Watching the explanatory videos.
- Reading our blog posts on Medium.
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.
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:
- visiting a Goerli faucet either at https://faucet.goerli.mudit.blog or https://goerli-faucet.slock.it/.
- Follow the instructions on respective faucet on how to acquire the ETH.
-
Connect to the dApp
-
Connect using the Browser Extension
- Visit the Light Client.
- Make sure Ethereum Mainnet is selected in MetaMask.
- Click on Browser Extension.
- Click on Connect and sign the messages on MetaMask to establish a connection.
-
Connect using WalletConnect
- Visit the Light Client.
- Click on WalletConnect.
- By default a bridge server provided by WalletConnect is used. It is however possible to use an alternative bridge server.
- Choose to provide either an Infura ID or a RPC endpoint.
- Click on Connect.
- Scan the QR code using a wallet of your choice. Make sure mainnet is used and sign all necessary signatures.
-
-
Select a Hub and Open a Channel
- Click the + icon and select a mainnet token to use. You need to have a balance of the token.
- 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.
- Enter an address of your choice to connect to or select a suggested hub if any are available.
- Click the Select Hub button
- Enter the amount of tokens you want to deposit when opening the channel.
- Click the Open Channel button and sign with MetaMask.
-
Make a Transfer
- Enter the address of the node receiving your transfer.
- Enter the amount you want to transfer.
- Click the Transfer button.
-
Connect to the dApp
- Visit the Raiden Hub page.
- Click on the Open Channel with Hub button.
When redirected to the Light Client choose to connect by using either:
-
Browser Extension
- Make sure Goerli Test Network is selected in MetaMask.
- Click on Browser Extension.
- Click on Connect and sign the messages on MetaMask to establish a connection.
-
WalletConnect
- Click on WalletConnect.
- By default the bridge server provided by WalletConnect is used. It is however possible to use an alternative bridge server.
- Choose to provide either an Infura ID or a RPC endpoint.
- Click on Connect.
- Scan the QR code using a wallet of your choice. Make sure Goerli Test Network is used and sign all necessary signatures.
-
Select a Hub and Open a Channel
- If you don't have any SVT (utility tokens), you can click the icon to mint and deposit SVT.
- Click on the icon at the very bottom to the right of the TTT symbol to mint TTT tokens.
- Click the Select Hub button.
- Enter the amount of tokens you want to deposit when opening the channel.
- Click Open Channel and sign with MetaMask.
-
Make a Transfer
- Enter the address of the node receiving your transfer.
- Enter the amount you want to transfer.
- Click the Transfer button.
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.
You should store a backup of your state to avoid losing tokens in case:
- You delete your local browser storage.
- You change computer.
- You use another browser.
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
}
]
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.
Go to the SDK Documentation for more information on how to install and use the SDK.
Go to the CLI README for installation instructions and the current status of the API.
-
Clone repository
git clone --recurse-submodules https://github.com/raiden-network/light-client.git cd light-client
-
Install dependencies
yarn install
-
Update the sdk submodules
yarn workspace raiden-ts update-submodules
-
Build the Raiden SDK
yarn workspace raiden-ts build
-
Run the dApp locally
yarn workspace raiden-dapp serve
After the development server starts, navigate to
http://localhost:8080
to use the Raiden dApp.
In order to use Raiden correctly and safely there are some things that need to be taken care of by the user:
-
Layer 1 works reliably: That means that you have got a web3 provider (eg. MetaMask) that is always synced and working reliably. If there are any problems or bugs on the client then Raiden can not work reliably.
-
Persistency of local DB: Your local state database is stored in your browser storage (IndexedDB). This data should not be deleted by the user or tampered with in any way. Frequent backups are also recommended. Deleting this storage could mean losing funds.
We are working in 2 weekly iterations. Priorities are managed within the Product Backlog.
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.
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.
Distributed under the MIT License.
Dev Chat: Gitter
Twitter: @raiden_network
Website: Raiden Network
Mail: [email protected]
Project Link: https://github.com/raiden-network/light-client