Simple lottery based on ethereum smart contracts.
- Create directory for environment and app
cd ~/apps/
virtualenv -p /usr/bin/python3.5 unilot
- Activate environment settings (see virtualenv docs for more info)
source ~/apps/unilot/bin/activate
- 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
- 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.
- Install requirements
pip install -r requirements
- Run migrations
python manage.py migrate
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 whenMODE
is set toIPC
. Absolute path to IPC socket.IS_TESTNET
- Default:False
, optional. Used only forMODE
-IPC
. Identifies thatIPC
works with testnet (rinkeby).HOST
- Default:127.0.0.1
, required whenMODE
is set toRPC
. Host to connect.PORT
- Default:8545
, required whenMODE
is set toRPC
. Port to connect.PREFIX
- Default:/
, optional. Used only forMODE
-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.
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