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 which provides a HTTP REST server that 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.
- About the Project
- Architecture
- Getting Started
- Try Out the Raiden Demo dApp
- Run Repository Code
- Roadmap and Timeline
- Contributing
- 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 will simplify the process of embedding and using the Raiden Network for token transfers in decentralized applications
With the SDK we want to make your life as a dApp developer easier.
- You should be able to interact with the Raiden Network easily with your dApp.
- We want to help you to enable your users to make token transfers using their consumer wallets like imToken or Metamask.
- You should be able to transfer and receive tokens using low end devices.
This 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 apps. Targeting browsers and Node.js as initial platforms allows the SDK to reach a majority of the current and in-development dApps, as well as to work as a common language reference implementation for ports and 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, tips and details on the design goals and decisions. Reading it is highly recommended to anyone wishing to better understand how the Raiden Light Client works under the hood or to contribute to it, though not required to use this library as a dApp developer.
+-------------------+
| |
| Raiden dApp |
| |
| vue/vuex/vuetify |
| |
+---------+---------+
| |
| Raiden SDK |
| |
+----+----+----+----+
| | | +------------+
+--+ redux + epics +------+ Matrix.org |
| | | | +-----+------+
| +---------+-----+---+ |
| | +-----+------+
+--------+-------+ +------+------+ | Raiden |
| localStorage | | ethers.js | | Network |
+----------------+ +------+------+ +------------+
|
+------+------+
| ethereum |
+-------------+
If you haven't used Raiden before we recommend that you:
- Checkout the developer portal
- Look at the documentation
- Learn more by watching explanatory videos
- Read our blog posts on Medium
The Raiden dApp is the demo and first dApp user of the SDK. It's a single page application (SPA) built on top of Vue.js, vuex and vuetify as UI framework which uses Material Design as the design guideline.
These step-by-step instructions will guide you through the process for trying out the Raiden demo dApp. The dApp is hosted at https://lightclient.raiden.network/ and we will be using the Goerli testnet and MetaMask wallet in this example.
- You need to have MetaMask installed for your browser. If you don't have MetaMask, visit their website to download and install it.
- It is NOT recommended to use the dApp on mobile (but it works).
- Go to the Goerli faucet at htts://faucet.goerli.mudit.blog or https://goerli-faucet.slock.it/
- Follow the instructions on how to acquire Goerli ETH on respective website
- Visit the Raiden Hub Page at https://hub.raiden.network/
- Click Open Channel with Hub to get forwarded to https://lightclient.raiden.network/
- Click Connect to connect the dApp to your MetaMask
- Click the mint button next to your token balance, to mint some TTT tokens.
- Click Select Hub
- Enter the amount of TTT Tokens you want to deposit when opening a channel with the hub
- Sign the deposit with your MetaMask.
- Click Open Channel.
- Sign "Open Channel", "Approve" and "Set Total Deposit" with your MetaMask when prompted
- Enter the address of the node receiving your transfer (eg.
hub.raiden.network
) - Enter the amount you want to transfer
- Click Transfer
Store a backup of your state to avoid loosing tokens in case you:
- Delete your local browser storage
- Change your computer
- Change your browser
If you want to continue using the dApp with a specific account when switching browser or changing computer you need to make sure that the dApp is connecting with the most recent state.
This is important because your state contains all the off-chain information which is needed to make transactions in the Raiden Network. Your state is stored in the browser across sessions and therefore it needs to be downloaded and uploaded whenever you switch browser or change computer.
You can download and upload your state via the General Menu
. Note that if you loose or delete your state you will also loose your tokens.
Structure of the state file:
{
"address": "0x2a23F385d32dcce35824D4498Bb10f9B6575B2de",
"version": 2,
"chainId": 5,
"registry": "0x9b0c8C8C75904CEf5B7a8dbF59c3459Ea85c6526",
"blockNumber": 2561973,
"config": {},
"channels": {},
"tokens": {
"0xE2b702eD684bEb02850ac604278f078A4ce8b6E6": "0x2001E8851d33CA476e209e37ED8db1BB9E72334F"
},
"transport": {},
"sent": {},
"received": {},
"path": { "iou": {} },
"pendingTxs": []
}
To run the code in this repository, you must have Node.js 10+ on your computer and a web3-enabled browser (e.g. Firefox with Metamask extension), as well as 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.
git clone --recurse-submodules https://github.com/raiden-network/light-client.git
cd light-client/raiden-dapp
First you need to build the sdk. For this you have to go to the raiden
directory and run the following commands.
pnpm install
pnpm run build --filter raiden-ts
To start the development server you have to run the following command.
pnpm run serve --filter raiden-dapp
After the development server starts you have to navigate to http://localhost:8080
, in order to use the Raiden dApp. It requires either MetaMask to be installed on your browser or some other web3 provider (e.g. Wallet apps with dApp support).
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.
Distributed under the MIT License.
Dev Chat: Gitter
Twitter: @raiden_network
Website: Raiden Network
Mail: contact@raiden.network
Project Link: https://github.com/raiden-network/light-client