A Relayer Manager Application, built with Python, Tornado, and React's Create-React-App
The following must be included in the development toolbelt:
- pyenv
- Python 3.7.* (recommended installing with pyenv)
- Python 2.7 (recommended installing with pyenv, if not in the system yet)
- pipenv
- nvm
- node 10+ && npm 6+
- Docker
You can test if any tool above work as expected using the which command below
$ which <library>
If the installing is correct, you should see some path or text got printed out in the terminal.
As usual, clone the repository to your local machine and cd into it.
$ git clone <tomorelayer-repository>
$ cd <tomorelayer-repository>
After that, install the specified application dependencies with npm and pipenv
# Install frontend & node scripts dependencies
$ npm install
# Install backend dependencies
$ pipenv install
Next, setup local databases with Docker
For development purpose, we are going to have 2 PosgreSQL docker-containers, one for developing & the other for testing - each get exposed on its own local port
$ npm run docker
You will need a local .env.local file. Copy the existing .env.development to make your own. Then you can make changes to your local env file if needed. (actually in most case, you wont need to make any change, unless you have some docker-exposing-port-conflict problem)
$ cp .env.development .env.local
Start backend & frontend on 2 different terminal tabs
# The frontend - since CREATE-REACT-APP takes quite some time to start - in another terminal
$ npm start
# Finally, Backend - certainly in another different terminal as well
$ npm run backend
Testing Contract
- Modify Lock-time of Relayer Contract's refund function from
4 weeks
to, like,4
(seconds). - Filling a development mnemonic for testing to
ebconfig/contract.js
andtest/relayer-contract.test.js
- Run test with Embark using command
npm run ctest
- Check if all tests are passed.
For any installation/running problem, check out Troubleshooting guide
backend has the entry point called "app", frontend "index.jsx" Those are where you get started.
- Made with Create-React-App
- State Management with Redux-Zero (not the well-known, original Redux - since it introduces way too much boilerplate codes)
- UI/UX Development with Material-UI
-
Checkout Python Tornado docs…
-
Models & available API
-
Admin (not used)
-
Contract: GET, POST, PATCH (method in bold format require admin privilieges)
id name owner address abi obsolete int string string eth_address bjson boolean - Relayer: GET POST PATCH DELETE
id owner name coinbase deposit trade_fee from_tokens to_tokens logo link resigning lock_time int address string address int int array array link link boolean int - Token: GET POST
id name symbol address total_supply logo is_major int string string address number link boolean -
Please refer to this short Deployment Guideline
- Backend
- Backend Database Models & available API
- Authentication (with JWT)
- Depovs Document & Deployment
- Caching with Redis
- Open API for calling with other application (TomoIssuer, DEX)
- Client manually update token from TomoXListing Contract
- Notifying DEX about Token Change for Relayer
- Blockchain & Infras
- SmartContract
- Testing SmartContract
- Frontend development
- Finalized UI/UX Design
- Complete Wallet-Integration
- Client Searching
- Integrate JSON Schema Validator (AJV)
- Customizing Material-UI
- Deployment
- Test app
- How-To Documentation
- Statistics views
- Prepare charts & statistics
- Documentation
- API Document
- Make Portable/Reusable API Kit
1. I can't install web3
, something went wrong with the node-gyp
build process.
Our project is using python 3.7.x, which is not yet supported by node-gyp. In order to install web3 correctly, install python2.7 (if not installed yet), and config your npm's python path to it
$ pyenv install 2.7
Inquire python2.7 path, and copy it
$ which python2.7
Config npm's python path
$ npm config set python <your-python2.7-path>
Then you can re-install things by running npm i
2. I can't get the Backend running, something is wrong with the 'Port already in use' warning.
Probably your Backend's last working session encountered some error and the event-loop is still occupying the
development port (eg 8888). Just kill the port and restart the app as normal, using task kill-port 8888