JavaScript SDK 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 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 and dApp are work in progress, don't work for token transfers yet and currently can only be used on the Ethereum Testnets.
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 with a limited alpha release of the Raiden Network in December 2018.
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 dev 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.
- It should be possible to send tokens using low end devices, which would not be capable of running a full Raiden node.
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 into interacting with and performing payments through the Raiden Network from their apps. Targeting browsers and Node.js as initial platforms allows it to reach the majority of current and in-development dApps, as well as to work as a common language reference implementation for ports and re-implementations in other future languages and environments.
Look at the Raiden Light Client SDK folder of this repository for more information.
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.
+-------------------+
| |
| Raiden dApp |
| |
| vue/vuex/vuetify |
| |
+---------+---------+
| |
| Raiden SDK |
| |
+----+----+----+----+
| | | +------------+
+--+ redux + epics +------+ Matrix.org |
| | | | +-----+------+
| +---------+-----+---+ |
| | +-----+------+
+--------+-------+ +------+------+ | Raiden |
| localStorage | | ethers.js | | Network |
+----------------+ +------+------+ +------------+
|
+------+------+
| ethereum |
+-------------+
If you didn't use Raiden before, you can
- Checkout the developer portal
- Look at the documentation
- Learn more by watching explanatory videos
- Read the blog posts on Medium
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.
npm install <raiden_npm_package>
Then in your JavaScript or TypeScript project:
import { Raiden } from 'raiden';
# async factory
const raiden = await Raiden.create(web3.currentProvider, 0, localStorage);
# subscribe to channels$ observable
raiden.channels$.subscribe((channels) => console.log('# raiden channels:', channels));
# open a Raiden payment channel!
const openTxHash = await raiden.openChannel('0xtoken', '0xpartner');
# output:
# {
# '0xtoken': {
# '0xpartner': {
# state: 'open',
# totalDeposit: BigNumber(0),
# partnerDeposit: BigNumber(0),
# id: 123,
# settleTimeout: 500,
# openBlock: 5123
# }
# }
# }
You can find more detailed information on how to use the SDK in the Raiden Light Client SDK folder of this repository.
git clone 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.
cd ../raiden
npm install
npm run build
Then you need to install the wallet app dependencies.
cd ../raiden-dapp
npm install
This will also create a symbolic link in raiden-dapp/node_modules/raiden
to raiden
.
To start the development server you have to run the following command.
npm run serve
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. We are currently working towards milestone 0, where the SDK and dApp are able to send payments, but will not be able to receive payments.
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: [email protected]
Project Link: https://github.com/raiden-network/light-client