The Raiden Network and Trinity-ETH are scaling projects that adopt state channels based on the etherenet. This article deploys these two protocols and makes a contrast.

Overview

Raiden Network and Trinity are not only leaders in state channels to scale Ethereum, but also two excellent projects whose state channel technology can be used currently. Both of them have pros and cons in design and user experience and they are still under development. In addition, the state channel technology keeps updating. Generalized state channel and cross-chain state channel have been frequently mentioned lately. It can be seen that the technology has been recognized more and more. There is still a long way to go to scale the blockchain through state channel, accelerate the development of blockchain and serve real economy. Hope that these two projects will invent new technologies.

Raiden Network

Brief Intro

Raiden Network is an off-chain scaling solution, enabling near-instant, low-cost and scalable payments. It’s complementary to the Ethereum blockchain and works with any ERC20 compatible token. The Raiden project is working in progress. Its goal is to research state channel technology, define protocols and develop reference implementations.

Status Quo

Since 2016, the development of the Raiden Network has experienced nearly two years. After µRaiden went live in early 2017, the Raiden Network released several versions on its main net to pave the way for Red Eyes Release. According to the release frequency of its code in github, it is believed that the Red Eyes will go live soon. The decentralized exchange based on the Raiden Network is also under development, but its development progress has not been disclosed.

Installation

Version

Currently, the Raiden Network has released v0.15. However, maybe for security reasons, the Raiden Network sets limits on the function of tokens registration.

Installation

The Raiden Network uses python for development and users can install it from source.

Clone the repository:

2. Create a virtualenv

virtualenv -p python3.6 raiden/venv/

3. Install the dependencies

pip install -c constraints.txt --upgrade -r requirements-dev.txt

4. Install

python setup.py develop

The Raiden Network also provides a compiled binary file for users to use. Users can download zip files for corresponding systems in github, such as tar -xvzf raiden–linux.tar.gz for Linux users. After extracting the files, users can get binary files and run through command line. Mac users can also use brew for installation.

brew tap raiden-network/raiden brew install raiden

Raiden Network needs to use rpc service of an eth node. Users can have an eth node through installing geth or parity. Command line –eth-rpc-endpoint “https://mainnet.infura.io/v3/” is also provided for users to use the rpc service provided by the third party. This article will not go into details about eth nodes.

Launch

For users who install from source, launch Raiden with Raiden command.

raiden --keystore-path --keystore-path eth_keystore/ --eth-rpc-endpoint "https://mainnet.infura.io/v3/<yourToken>"

In my test of launching v0.15, en error occurred:

Method Not Allowed for url: https://ropsten.infura.io/v3/933cac866c194896b9b3dd7ddb5e327a

It was unknown whether it was because of the limit that the team set or my software. After I switched to v0.14, it was launched successfully.

Output:

Welcome to Raiden, version 0.14.0! ---------------------------------------------------------------------- | This is an Alpha 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 representations 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 software is at your own risk and discretion and by | | using the software you acknowledge that you have read this | | disclaimer, understand its contents, assume all risk related | | thereto and hereby release, waive, discharge and covenant not to | | sue Brainbot Labs Establishment or any officers, employees or | | affiliates from and for any direct or indirect liability resulting| | from the use of the software as permissible by applicable laws and| | regulations. | | | | Privacy Warning: Please be aware, that by using the Raiden 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 Raide| | 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. |------------------------------------------------------------------- Have you read, understood and hereby accept the above disclaimer and privacy warning? [y/N]:

Select Y and continue. Users need to select their wallet addresses

The following accounts were found in your machine: [ 0] - 0xb.....................................................................de08 [ 1] - 0x2.....................................................................f089 Select one of them by index to continue: 0 Enter the password to unlock *********** 0xb.....................................................................de08: Checking if the ethereum node is synchronized You are connected to the 'ropsten' network and the DB path is: /Users/weiwu/.raiden/node_bd704cca/netid_3/network_40a5d15f/v8_log.db

The Raiden Network supports both udp and default matrix in transport layer. The default is matrix. In my test, because of the unstable matrix, it was not easy to launch even when I stood a ladder.

matrix_client.errors.MatrixRequestError: 500

Therefore, I switched to udp through –transport udp.

The Raiden Network has provided webgui and users can start gui to interact with Raiden. The default port is 5001.

The Raiden API RPC server is now running at http://127.0.0.1:5001/.

In token page, only one token weth is found.

In the latest version, the function of registering a token is restricted on the main net. In addition, the method of collecting test tokens is not specified. Even after using –enviroment-type development, I couldn’t register a token. Later, I reviewed its source code and found a code error:

if environment_type == Environment.PRODUCTION: # Safe configuration: restrictions for mainnet apply and matrix rooms have to be private config['environment_type'] = Environment.PRODUCTION config['transport']['matrix']['private_rooms'] = True else: config['environment_type'] = Environment.PRODUCTION

This bug has been fixed, but it is a bit inappropriate to have such an error in the release. I wonder if there will be tests before released.

Finally, I added the token of TNC.

By the way, Trinity has a faucet in its experience center. Anyone can receive test tokens of TNC. This is very useful during test. Otherwise, I couldn’t find test tokens in my Raiden test. Kudos to Trinity.

The next step was to open a channel.

After a while, the channel was opened.

In my transfer test, the user experience was good. Transfer was nearly instant.

The counterparty received the payment.

During my repeated procedures of opening a channel, payment and closing a channel, there was a network anomaly. It didn’t work after closing a channel and withdrawal of the tokens in the channel failed.

Summary

Advantages

1）Raiden Network provides the function of registering tokens, which facilitates the opening of channels for many erc20 tokens. However, the code error is a bit discouraging.

2）The Raiden Network has provided user-friendly webgui, which helps users to open channels and check the state of channels. The user experience is friendlier than command line operations.

Disadvantages

1）Although it has provided comprehensive command line parameters, the learning cost is still relatively high in the actual operation. It is not suitable for tech-neptitude.

2）In the new version, its support for the rpc service provided by the third party does not work well. Users need to run full Ethereum nodes and the cost is high.

3）Its code and technology keep updating, but its codes in different versions are a bit different. The learning cost of technology enthusiasts who are eager to participate in the learning is high.

4）There is no distinction between user groups. Node service providers and users have different technical requirements. However, Raiden hasn’t taken this into consideration and adapted its technology to user groups, such as wallet, node browser and experience center.

5）If one part of the transaction is offline due to network and some other factors, withdrawal problem maybe occur in closing the channel.

Trinity — — ETH

Trinity Network and Ethereum

Brief Intro

As an off-chain scaling solution, Trinity aims to achieve scalability with real-time payments, low transaction fees and privacy protection. It will greatly enhance the throughput of the underlying chain and lower the transaction cost for digital assets. TNC cross-chain converter makes cross-chain value and data flow possible. Trinity will evolve towards a decentralized self-governance network, providing comprehensive support for future dapps. Using state channel technology, Trinity has developed Trinity-Neo and Trinity-eth for Neo and Ethereum network respectively.

Status Quo

Since the launch of Trinity project in Feb, 2017, Trinity released Trinity-neo and Trinity-eth (July, 2018) protocols consecutively. The latest ETH-based version is v0.2.1. Trinity wallet app, explorer, Experience Center, Test Faucet, and the tool kit can be found at https://trinity.tech/#.

Installation

Version

Trinity adopts pluggable designs, including Trinity-gateway, Trinity-eht, Trinity-neo. We will mainly go through Trinity-eth (v0.2.1) in this article.

installation

Trinity is developed on python3.6 and uses virtaulenv to create virtual environment when deploy nodes.

Clone the repository.

2. Create virtual environment.

virtualenv -p python3 trinity-eth/venv/

3. Activate virtual environment.

source trintiy-eth/venv/bin/active

4. Install dependency package.

sudo apt-get install screen git libleveldb-dev libssl-dev g++

5. Trinity uses mongodb as the local database，so install mongo.

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5 echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sourcves.list.d/mongodb-org-3.6.list sudo apt-get update sudo apt-get install mongodb-org sudo service mongod start

6. Install python

Eneter gate and trinity-eth directory and install in order.

pip install -r requirements.txt

Launch

Install Trinity routing node gateway

Open gateway configuration file.

1.vi gateway/config.py

Find cg_public_ip_port = "localhost:8189" in the localhost and set it as user’s public ip address.

Eg：cg_public_ip_port = “8.8.8.8:8189”

python start.py

The message below on the console indicates the Gateway successfully started.

1.###### Trinity Gateway Start Successfully! ######

Install Trinity routing node wallet

Modify configuration file

cd trinity-eth/wallet

In trinity-eth wallet path, the default trinity.py file applies to testnet. Both trinity.py and trinity_mainnet.py exist in the wallet directory. When deploying on the mainnet, users can simply copy trinity_mainnet.py into trinity.py. Please refer to notes for configuration details.

As trinity cli requires the console remain open, we recommend using screen tool to manage shell. For the details on screen, please see http://man7.org/linux/man-pages/man1/screen.1.html.

For more details on trinity deployment, please see https://trinity.readthedocs.io/en/latest/zh-CN/index.html.

Create Channels

1.Use create wallet command to set up an address before using the channel.

trinity> create wallet testwallet.json

2.Open the existing wallet. Note: The wallet to be opened should have state-channel functions, otherwise the function will be limited.

trinity> open wallet testwallet.json

After creating or opening a wallet, the wallet will automatically connect to the gateway and enable channel function. If channel function was not enabled within 30s, please call channel function to open it manually.

3.Use channel enable command to enable channel function before operating on state channels.

trinity> channel enable

4.View the wallet uir through channel show uri command.

trinity> channel show uri

5.Create channel.

trinity> channel create @xx.xx.xx.xx:xxxx TNC 80000

6.Check the channel state.

trinity> channel state

Experience with the wallet

Create wallet

Trinity wallet provides web-based and app versions. The app has been listed on google play. We will mainly focus on the web version here. Wallet address: http://twallet.trinity.ink:7034/

After creating a wallet

2. Apply for the test tokens

Apply test TNC here, http://tfaucet.trinity.ink:7033/

Trinity Wallet recivied the asset from Faucet

Comparatively, Trinity’s test tokens invite more people in using trinity products, making it more user-friendly and customer-oriented.

3. Buy some fruits in the shop with payment code.

4. Copy the payment code into the wallet and make the payment.

Summary

Trinity started late after Raiden. However, Trinity has seen great improvement throughout the development, and produced high-quality products for users.

Advantages

1）As it adopts pluggable design, Trinity is more likely to integrate with other blockchains and evolve towards state channel and cross-chain communication.

2）Trinity provides user-friendly products, with specialized experiencing tools, such as test token faucet, multi-functional wallet, and shopping center, smoothing the whole process.

3）State channel explorer provides information on the status of channels and the trading ranks, which effectively help both channel providers and end users make full use of the resources.

4）Independent from local ETH nodes, which lowers the cost of deployment; separating nodes from channels, which makes services more specialized.

5）Channel providers can charge service fees and make profit. Raiden has the same design. Unfortunately, it was too complicated to build nodes for testing. Comparatively, Trinity-eth facilitates the testing process with web-based Trinity wallet. Charging fees for channel usage might not be a good news to the end users, but they can choose an alternative way of building payment channels with the service providers in Trinity network.

6） Trinity adopts command lines for communication during channel deployment. Using command lines to create wallet will also effectively avoid leakage of confidential information. (There is no negative comments on the security of web, this is a purely individual preference)

Disadvantages

1）As we mentioned above, Trinity specialized service providers and the end users, which makes it convenient for users but not for all channel providers. Though using command to deploy nodes is not difficult for most channel providers, the new comers with little programming basics may feel hard to do so. Inviting more people in is always a good thing, so this is something to be further improved.

2）Current documentations for deploying and experiencing channels are complete and easy to understand for non-developers, but more developer-oriented documentations are needed.

3）Compared with Raiden, Trinity is not easily accessible to other ERC20 tokens. Trinity do support ERC20 tokens, and support NEP5 tokens as well. But users need to fork Trinity protocol and modify token address before realizing the full functions. Raiden’s token registration api makes it convenient and fast for other ERC20 tokens.