Giter Site home page Giter Site logo

trinity's Introduction

Trinity

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. https://trinity.tech

Trinity-neo

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://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/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: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/

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 https://bootstrap.pypa.io/get-pip.py

sudo python3.6 get-pip.py

Install virtualenv

sudo pip3.6 install virtualenv

Get Trinity-neo Source Code

git clone https://github.com/trinity-project/trinity.git /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/config.py

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

eg:cg_public_ip_port = "8.8.8.8:8089"

Create a new session window

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

Enter virtual environment

source venv/bin/activate

Run the Gateway service

python start.py

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/configure.py 

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

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 prompt.py -m
  • Testnet Wallet
   python3.6 prompt.py

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 

4.channel show uri

trinity> channel show uri

5.Use channel create

trinity> channel create [email protected]: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

or

trinity> channel tx [email protected]: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

9.channel peer is for peer node review

trinity> channel peer

trinity's People

Contributors

kantoule avatar maiganne avatar pigxo avatar wjlu avatar xiaohuta avatar yilwhust avatar zhangguangfeng avatar zhuofanxu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

trinity's Issues

Error: ImportError: No module named 'NodeB'

I'm getting an error when running command below.
alex@alex-VirtualBox:/trinity-master/src/NodeB$ python3 store_block_data.py -->null &
[1] 18625
alex@alex-VirtualBox:
/trinity/src/NodeB$ Traceback (most recent call last):
File "store_block_data.py", line 10, in
from NodeB.config import *
ImportError: No module named 'NodeB'

v0.2 Help!

Hello,

I am receiving the following errors when trying to set up Trinity node;
screenshot from 2018-04-02 10-16-40
screenshot from 2018-04-02 10-17-14
screenshot from 2018-04-02 10-17-38
screenshot from 2018-04-02 10-18-08

Any idea what is causing each?

python3 store_block_data.py -->null &

Hi fellow TNCers

Been trying to setup the node but i think(hope) am getting an easy error but as im new to ubuntu its quite hard....running desktop ubuntu 16.04. If correct its not letting me connect to localhost or something? hope someone can help

thanks

 File "/home/tim/.local/lib/python3.5/site-packages/urllib3/connection.py", line 141, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/home/tim/.local/lib/python3.5/site-packages/urllib3/util/connection.py", line 83, in create_connection
    raise err
  File "/home/tim/.local/lib/python3.5/site-packages/urllib3/util/connection.py", line 73, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tim/.local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/home/tim/.local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 357, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.5/http/client.py", line 1106, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python3.5/http/client.py", line 1151, in _send_request
    self.endheaders(body)
  File "/usr/lib/python3.5/http/client.py", line 1102, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python3.5/http/client.py", line 934, in _send_output
    self.send(msg)
  File "/usr/lib/python3.5/http/client.py", line 877, in send
    self.connect()
  File "/home/tim/.local/lib/python3.5/site-packages/urllib3/connection.py", line 166, in connect
    conn = self._new_conn()
  File "/home/tim/.local/lib/python3.5/site-packages/urllib3/connection.py", line 150, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fb2f08d1c50>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tim/.local/lib/python3.5/site-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/home/tim/.local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/home/tim/.local/lib/python3.5/site-packages/urllib3/util/retry.py", line 388, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=20332): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb2f08d1c50>: Failed to establish a new connection: [Errno 111] Connection refused',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "store_block_data.py", line 162, in <module>
    chain_block_count=getblockcount()
  File "store_block_data.py", line 134, in getblockcount
    res = requests.post(NEOCLIURL, headers=headers, json=data).json()
  File "/home/tim/.local/lib/python3.5/site-packages/requests/api.py", line 112, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/home/tim/.local/lib/python3.5/site-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/tim/.local/lib/python3.5/site-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/tim/.local/lib/python3.5/site-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/home/tim/.local/lib/python3.5/site-packages/requests/adapters.py", line 508, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=20332): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb2f08d1c50>: Failed to establish a new connection: [Errno 111] Connection refused',))

access to html page when running node

I got the node up running, however when trying to open the html I get the following error:
Method Not Allowed
The method is not allowed for the requested URL.

The debugger mentions the html request:
84.199.11.174 - - [21/Mar/2018 16:06:50] "GET / HTTP/1.1" 405 -
84.199.11.174 - - [21/Mar/2018 16:06:50] "GET /favicon.ico HTTP/1.1" 404 -

image

python3 runserver.py & (OSError: [WinError 193] %1 is not a valid Win32 application)

Hi all,

Trying to run a node on the TestNet using Windows and came across this error with runserver.py.

Has anyone encountered this issue and know of a way around it?
Some googling suggested it might be related to python 32bit being incompatible with something that's 64bit or visa-versa.

Any help will be appreciated!

c:\Neo\trinity-master\src\NodeB>python runserver.py &
Traceback (most recent call last):
File "runserver.py", line 1, in
from NodeB.app.app import app
File "C:\Neo\trinity-master\src\NodeB\app\app.py", line 43, in
from .controller import *
File "C:\Neo\trinity-master\src\NodeB\app\controller.py", line 4, in
from NodeB import service
File "C:\Neo\trinity-master\src\NodeB\service.py", line 4, in
from NodeB.utils import createMultiSigAddress, ToScriptHash, int_to_hex, con
struct_opdata, privtkey_sign, hex_reverse,
File "C:\Neo\trinity-master\src\NodeB\utils.py", line 6, in
from neocore.KeyPair import KeyPair
File "C:\Python\Python36-32\lib\site-packages\neocore\KeyPair.py", line 4, in

import scrypt
File "C:\Python\Python36-32\lib\site-packages\scrypt.py", line 11, in

_scrypt = cdll.LoadLibrary(imp.find_module('_scrypt')[1])

File "C:\Python\Python36-32\lib\ctypes_init_.py", line 426, in LoadLibrary
return self.dlltype(name)
File "C:\Python\Python36-32\lib\ctypes_init
.py", line 348, in init
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application

Where do I enter my server IP adress in the OPEN GATEWAY CONFIGURATION FILE ?

Install Trinity Routing Node Gateway
Open gateway configuration file

vi gateway/config.py
Find'cg_public_ip_port = "localhost:8089"' and Put user’s public ip address at the localhost

eg:cg_public_ip_port = "8.8.8.8:8089"

My question is do I have to replace "8.8.8.8:8089" by my server IP adress in the command line?

Internet stop working

When I launch a node, after a while, the Internet slows down and eventually stops working. Is it need some minimal internet speeds?

python3 store_block_data.py -->null &

I'm stuck on step 11. I am getting an error after entering the command "python3 store_block_data.py -->null &"

The error says: "ImportError: No module named 'pymysql'

screen shot 2018-03-12 at 11 44 17 pm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.