Skip to content

unilot/unilot.io

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unilot

Simple lottery based on ethereum smart contracts.

Installation

  1. Create directory for environment and app
cd ~/apps/
virtualenv -p /usr/bin/python3.5 unilot
  1. Activate environment settings (see virtualenv docs for more info)
source ~/apps/unilot/bin/activate
  1. Pull code from repo
git pull https://github.com/unilot/unilot.io app

Result of this command will be pulled code located in ~/apps/unilot/app

  1. Now configure

Go to app dir (~/apps/unilot/app)

Copy example settings file and setup required settings.

cp unilot/local_settings.py.example unilot/local_settings.py

For simple app start you can just setup secret key and database.

For setting up connection to ethereum node see ethereum configuration.

  1. Install requirements
pip install -r requirements
  1. Run migrations
python manage.py migrate

Ethereum configuration

This part might change in future. Keep an eye on updates.

Ethereum related configuration is located in WEB3_CONFIG dictionary in settings file.

  • MODE - Required. Node connection mode. It can be via IPC socket file or http. Values can be: IPC, RPC. Depending on value different keys might be required.
  • PATH - Default: None, required when MODE is set to IPC. Absolute path to IPC socket.
  • IS_TESTNET - Default: False, optional. Used only for MODE - IPC. Identifies that IPC works with testnet (rinkeby).
  • HOST - Default: 127.0.0.1, required when MODE is set to RPC. Host to connect.
  • PORT - Default: 8545, required when MODE is set to RPC. Port to connect.
  • PREFIX - Default: /, optional. Used only for MODE - RPC.
  • ETHBASE - Required. Account that is used to run operations in API.
  • ETHBASE_PWD - Required. Password to account (ETHBASE) to unlock for operations that require password.

Example

This example considers that you use ubuntu 16.04 and have installed go-ethereum and you are able to run geth command in cmd (console).

I recommend to install command like screen or open 2 cmd windows/tabs.

If using screen:

screen -S eth-node

In example geth will be started with IPC and RPC enabled. RPC uses default port 8545. Set --rpcport option to set custom port. IPC socket's location is ~/.ethereum/geth.ipc. Node will connect to test network and make fast sycnronization (for details see docs).

In this example in only api required to operate unilot was enabled.

geth --rinkeby --fast --cache 1024 --rpc --rpcaddr 127.0.0.1 --rpcapi "eth,personal,web3,net" --ipcpath /home/ethereum/.ethereum/geth.ipc console

After start you will see geth console where you can operate with data in the node. See docs for details.

If you use screen to detach from session press and hold Ctrl and press a then d.

To access session again and return to console run:

screen -x eth-node

WIP