Skip to content
Switch branches/tags


Failed to load latest commit information.
Latest commit message
Commit time


Trinity is a universal off-chain scaling solution, which aims to achieve real-time payments with low transaction fees, scalability and privacy protection for mainchain assets. Using state channel technology, Trinity will significantly increase the transaction throughput of underlying chains as well as the assets on smart contracts. TNC cross-chain converter facilitates the data and value flow between multiple chains. Trinity will be a fully autonomous and decentralized performance-enhancing network for the entire ecosystem and provides all-round support to Dapps on bottom layer chains in the future.


trinity-neo is the implementation of trinity protocol based on NEO.

Trinity-neo Network Configuration Guide

note:Trinity routing nodes require the configuration environment be no less than python3.6.
As Trinity develops, this file may not apply to the new version. This file was tested on Ubuntu16.04 desktop.

Trinity-neo Runtime Environment Preparation

Install system library and system tools

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

Install mongodb and launch the service

sudo apt-key adv --keyserver hkp:// --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5

echo "deb [ arch=amd64,arm64 ] xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list

sudo apt-get update

sudo apt-get install mongodb-org

sudo service mongod start

Ref:mongodb configuration details, please visit:

Configure python3.6

sudo apt-get install software-properties-common

sudo add-apt-repository ppa:jonathonf/python-3.6

sudo apt-get update

sudo apt-get install python3.6 python3.6-dev

Install pip3.6

sudo wget

sudo python3.6

Install virtualenv

sudo pip3.6 install virtualenv

Get Trinity-neo Source Code

git clone /home

Open trinity source code catalo

cd /home/trinity

Create and activate virtual environment

virtualenv -p /usr/bin/python3.6 venv

source venv/bin/activate

Install trinity node requirement package

pip install -r requirements

Install Trinity Routing Node Gateway

Open gateway configuration file

vi gateway/

Find'cg_public_ip_port = "localhost:8089"' and Put user’s public ip address at the localhost

eg:cg_public_ip_port = ""

Create a new session window

screen -S TrinityGateway #TrinityGateway: 用户可替换该名称

Enter virtual environment

source venv/bin/activate

Run the Gateway service


The code below indicates the Gateway successfully started

###### Trinity Gateway Start Successfully! ######

Use ctrl+a+d to close current TrinityGateway session window

Note: call the function below to re-open the existing TrinityGateway session window

screen -r TrinityGateway

Install Trinity Routing Node Wallet

Revise configuration file

vi wallet/ 

The default configure file applies to the testnet, for which and co-exist in the wallet catalog. For the mainnet, simply copy and paste it to

Please refer to notes for configuration details.

Create a new session window

    screen -S TrinityWallet

Activate python3.6 virtualenv

   source venv/bin/activate

Run the Gateway service(Enter trinity/ wallet source code catelog)

  • Mainnet Wallet
    python3.6 -m
  • Testnet Wallet

close or reopen the gateway session please refer to the details of 'run the gateway service'

Channel Nodes Interworking

After trinity CLI wallet running, the subsequent channel and wallet operations can be performed on the wallet console.

Input help to the wallet console to view all trinity CLI wallet commands.

Here are a few channel-related commands:

1.Use create wallet command to create an address before using state channels.

trinity> create wallet /root/test/test.json # /root/test/test.json is the path of wallet

2.Use open wallet command to open existing wallet. Note: open a wallet with channel function, or the function will be restricted.

trinity> open wallet /root/test/test.json

Note:After creating or re-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 activate channel function before operating on state channels.

trinity> channel enable show uri

trinity> channel show uri

5.Use channel create

trinity> channel create xxxxxxxxxxxxx@xx.xx.xx.xx:xxxx TNC <tnc_count>

6.Call channel tx to execute off-chain transactions. tx parameters supports pymentlink code, or use uri + asset + value

trinity> channel tx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # payment link code


trinity> channel tx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@xx.xx.xx.xx:xxxx TNC <count>

7.Call channel payment to generate payment code

trinity> channel payment TNC 10 "mytest"

8.Call channel close to complete settlement and close the channel

trinity> channel close xxxxxxxxxxxxxxx peer is for peer node review

trinity> channel peer


Trinity state channel protocol





No packages published