raiden-ts
v3.1.1
Published
Raiden Light Client Typescript/Javascript SDK
Downloads
58
Readme
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.
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 it is crucial to read this readme including the security notes carefully before using the software.
Table of Contents
Important information for users The Raiden Light Client is an application that allows you to interact with the Raiden network. 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 the blog posts on Medium
Terms of Use By accessing the Raiden Light Client through our website you agree to the Terms of Use and Privacy Policy.
Disclaimer The Raiden Light Client is a beta version of experimental open source software released as a test version under an MIT license and may contain errors and/or bugs. No guarantee or representation whatsoever is made regarding its suitability (or its use) for any purpose or regarding its compliance with any applicable laws and regulations. Use of the Raiden Light Client is at your own risk and discretion and by using the software you warrant and represent that you have read this disclaimer, understand its contents, assume all risk related thereto and hereby release, waive, discharge and covenant not to hold us or any of our officers, employees or affiliates from and for any direct or indirect damage resulting from the Raiden Light Client or the use thereof. Such to the extent as permissible by applicable laws and regulations.
Privacy warning Please be aware, that by using the Raiden Light Client, among others your Ethereum address, channels, channel deposits, settlements and the Ethereum address of your channel counterparty will be stored on the Ethereum chain, i.e. on servers of Ethereum node operators and ergo are to a certain extent publicly available. The same might also be stored on systems of parties running Raiden nodes connected to the same token network. Data present in the Ethereum chain is very unlikely to be able to be changed, removed or deleted from the public arena.
Also be aware, that data on individual Raiden token transfers will be made available via the Matrix protocol to the recipient, intermediating nodes of a specific transfer as well as to the Matrix server operators, see Raiden Transport Specification.
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 main entry point of the SDK is the Raiden
class, which exposes an async
/promise-based public API to fetch state, events and perform every action provided by the SDK on the blockchain and the Raiden Network.
Internally, the SDK architecture is a Redux-powered state machine, where every blockchain event, user request and off-chain message from other Raiden nodes and service providers follows an unified flow as actions on this state machine. These actions produce deterministic changes to the state and may cause other actions to be emitted as well. Asynchronous operations are handled by a pipeline of redux-observable epics, an RxJs async extension for Redux which unleashes the power, versatility and correctness of observables to Redux actions processing. These epics interact with the blockchain through ethers.js providers, signers and contracts, allowing seamless integration with different web3 providers, such as Metamask. Redux state is persisted using PouchDB, with indexedDB
as backend on browsers, if you use the raiden-dapp
, or LevelDown
if used with raiden-cli
on NodeJS. Tests are implemented with Jest.
External off-chain communication with the Raiden Network is provided by a dedicated federation of community-provided matrix.org homeservers, accessed through matrix-js-sdk, and WebRTC for fast p2p communication.
Architecture diagram
+---------+---------+
| |
| Raiden SDK |
| |
+----+----+----+----+
| | | +--------------+
+---+ redux + epics +------+ Matrix.org / |
| | | | | WebRTC |
| +---------+-----+---+ +-------+------+
| | |
+-------+--------+ +------+------+ +------+------+
| pouchDB | | ethers.js | | Raiden |
+----------------+ +------+------+ | Network |
| +-------------+
+------+------+
| ethereum |
+-------------+
A technical deep dive into the SDK architecture, technologies, tips and details on the design goals and decisions can be found in the SDK Development document. 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.
Requirements for Safe Usage
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 IndexedDB storage on browser environments, and local LevelDown database folder on NodeJS environments. 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.
Raiden account has sufficient ETH: You need to ensure that your account has enough ETH at all times when performing on-chain transactions. Most of those are on-demand/interactive, but some may be required as a reaction to some non-interactive event (e.g. registering the secret for a received but not unlocked transfer).
Getting Started
Go to the full documentation including this readme and the documentation of the SDK classes, enums and interfaces. to learn how to install and use the Light Client SDK.
Contributing
Any contributions you make are greatly appreciated. Refer to the Raiden Light Client Development Guide for details on how to comply with our codestyle, patterns and quality requirements.
License
Distributed under the MIT License.