Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dashpay/sentinel
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: zocteam/sentinel
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
Loading
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@ var/
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.pyc
*.spec

# Installer logs
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ python:
- "2.7"
- "3.5"
- "3.6"
before_install:
- chmod +x share/travis_setup.sh

install:
- pip install -r requirements.txt
5 changes: 3 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
The MIT License (MIT)

Copyright (c) 2016 The Dash Developers
Copyright (c) 2016-2018 The Dash Developers
Copyright (c) 2018-2019 The 01coin Developers

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
@@ -17,4 +18,4 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
74 changes: 53 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
# Dash Sentinel
# 01Coin Sentinel

An all-powerful toolset for Dash.
An all-powerful toolset for 01coin.

[![Build Status](https://travis-ci.org/dashpay/sentinel.svg?branch=master)](https://travis-ci.org/dashpay/sentinel)
Sentinel is an autonomous agent for persisting, processing and automating 01coin governance objects and tasks, and for expanded functions in upcoming 01coin releases.

Sentinel is an autonomous agent for persisting, processing and automating Dash governance objects and tasks, and for expanded functions in the upcoming Dash V13 release (Evolution).

Sentinel is implemented as a Python application that binds to a local version 12 dashd instance on each Dash Masternode.
Sentinel is implemented as a Python application that binds to a local version 0.12.3 zerooned instance on each 01coin Masternode.

This guide covers installing Sentinel onto an existing Masternode in Ubuntu 14.04 / 16.04.


## Installation

The following detailed steps are all condensed into ONE easy command that you can take advantage of if your 01coin Masternode was previously installed using the scripts provided by the 01coin community (NB: the script requires you have sudo/root password), or manually using the same installation method as the scripts.

wget https://raw.githubusercontent.com/zocteam/sentinel/master/sentinel-one-line-installer.sh && chmod +x sentinel-one-line-installer.sh && ./sentinel-one-line-installer.sh


### 1. Install Prerequisites

Make sure Python version 2.7.x or above is installed:
@@ -21,57 +25,83 @@ Make sure Python version 2.7.x or above is installed:
Update system packages and ensure virtualenv is installed:

$ sudo apt-get update
$ sudo apt-get -y install python-virtualenv

Make sure the local Dash daemon running is at least version 12.1 (120100)
$ sudo apt-get -y install python-virtualenv virtualenv

$ dash-cli getinfo | grep version

### 2. Install Sentinel

Clone the Sentinel repo and install Python dependencies.

$ git clone https://github.com/dashpay/sentinel.git && cd sentinel
$ git clone https://github.com/zocteam/sentinel.git sentinel && cd sentinel
$ virtualenv ./venv
$ ./venv/bin/pip install -r requirements.txt

### 3. Set up Cron

### 3. Set up Linux Cron / Windows Task Scheduler

#### On Linux:

Set up a crontab entry to call Sentinel every minute:

$ crontab -e

In the crontab editor, add the lines below, replacing '/home/YOURUSERNAME/sentinel' to the path where you cloned sentinel to:
In the crontab editor, add the lines below, replacing '$HOME/sentinel' to the path where you cloned sentinel to:

* * * * * cd $HOME/sentinel && SENTINEL_DEBUG=1 ./venv/bin/python bin/sentinel.py >> sentinel.log 2>&1

#### On Windows:

Using the “Windows Key“ + “R” to open run and type “taskschd.msc“. This will open Task Scheduler. Program a 1 minute schedule for the sentinel.bat, or `when the computer starts` for the sentinel.exe .

Or from the commandline schedule a windows task for every minute (MINUTE):
`SCHTASKS /Create /U domain\user /P password /SC MINUTE /MO 1 /TN sentinel /TR c:\sentinel\sentinel.bat /ST 00:01 /RU runasuser /RP password`
or using the exe at windows startup (ONSTART) or user logon (ONLOGON):
`SCHTASKS /Create /U domain\user /P password /SC ONSTART /TN sentinel /TR c:\sentinel\sentinel.exe /RU runasuser /RP password`

* * * * * cd /home/YOURUSERNAME/sentinel && ./venv/bin/python bin/sentinel.py >/dev/null 2>&1

### 4. Test the Configuration

Test the config by running all tests from the sentinel folder you cloned into

$ ./venv/bin/py.test ./test

With all tests passing and crontab setup, Sentinel will stay in sync with dashd and the installation is complete
With all tests passing and crontab setup, Sentinel will stay in sync with zerooned and the installation is complete


## Configuration

An alternative (non-default) path to the `dash.conf` file can be specified in `sentinel.conf`:
An alternative (non-default) path to the `zeroone.conf` file can be specified in `sentinel.conf`:

zeroone_conf=/path/to/zeroone.conf


## Building

Install pyinstaller `pip install pyinstaller`

Generate output EXE/ELF: `pyinstaller --onefile --paths lib;bin main.py`

dash_conf=/path/to/dash.conf

## Troubleshooting

To view debug output, set the `SENTINEL_DEBUG` environment variable to anything non-zero, then run the script manually:

$ SENTINEL_DEBUG=1 ./venv/bin/python bin/sentinel.py

#### On windows:

set SENTINEL_DEBUG=1
cd sentinel
python bin/sentinel.py


## Contributing

Please follow the [DashCore guidelines for contributing](https://github.com/dashpay/dash/blob/master/CONTRIBUTING.md).
Please follow the [ZeroOneCore guidelines for contributing](https://github.com/zocteam/zeroonecoin/blob/master/CONTRIBUTING.md).

Specifically:

* [Contributor Workflow](https://github.com/dashpay/dash/blob/master/CONTRIBUTING.md#contributor-workflow)
* [Contributor Workflow](https://github.com/zocteam/zeroonecoin/blob/master/CONTRIBUTING.md#contributor-workflow)

To contribute a patch, the workflow is as follows:

@@ -83,6 +113,8 @@ Specifically:

Commit messages should be verbose by default, consisting of a short subject line (50 chars max), a blank line and detailed explanatory text as separate paragraph(s); unless the title alone is self-explanatory (like "Corrected typo in main.cpp") then a single title line is sufficient. Commit messages should be helpful to people reading your code in the future, so explain the reasoning for your decisions. Further explanation [here](http://chris.beams.io/posts/git-commit/).


### License

Released under the MIT license, under the same terms as DashCore itself. See [LICENSE](LICENSE) for more info.
Released under the MIT license, under the same terms as 01coin itself. See [LICENSE](LICENSE) for more info.
This sw was forked from DashCore and follows the same terms.
16 changes: 8 additions & 8 deletions bin/dbtest.py
Original file line number Diff line number Diff line change
@@ -9,18 +9,18 @@
from models import Superblock, Proposal, GovernanceObject, Setting, Signal, Vote, Outcome
from models import VoteSignals, VoteOutcomes
from peewee import PeeweeException # , OperationalError, IntegrityError
from dashd import DashDaemon
import dashlib
from zerooned import ZeroOneDaemon
import zeroonelib
from decimal import Decimal
dashd = DashDaemon.from_dash_conf(config.dash_conf)
zerooned = ZeroOneDaemon.from_zeroone_conf(config.zeroone_conf)
import misc
# ==============================================================================
# do stuff here

pr = Proposal(
name='proposal7',
url='https://dashcentral.com/proposal7',
payment_address='yTC62huR4YQEPn9AJHjnQxxreHSbgAoatV',
url='https://zeroonecentral.com/proposal7',
payment_address='nF3PndkR4vttZKUpYdYQjDCCrfsfhNGs6A',
payment_amount=39.23,
start_epoch=1483250400,
end_epoch=1491022800,
@@ -33,13 +33,13 @@
# )


# TODO: make this a test, mock 'dashd' and tie a test block height to a
# TODO: make this a test, mock 'zerooned' and tie a test block height to a
# timestamp, ensure only unit testing a within_window method
#
# also, create the `within_window` or similar method & use that.
#
bh = 131112
bh_epoch = dashd.block_height_to_epoch(bh)
bh_epoch = zerooned.block_height_to_epoch(bh)

fudge = 72000
window_start = 1483689082 - fudge
@@ -56,7 +56,7 @@
print("Within window, we're good!")

# pdb.set_trace()
# dashd.get_object_list()
# zerooned.get_object_list()
# ==============================================================================
# pdb.set_trace()
1
6 changes: 3 additions & 3 deletions bin/rehex.py
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
import sys
import os
sys.path.append(os.path.normpath(os.path.join(os.path.dirname(__file__), '../lib')))
import dashlib
import zeroonelib
# ============================================================================
usage = "%s <hex>" % sys.argv[0]

@@ -15,7 +15,7 @@
print(usage)
sys.exit(1)
else:
obj = dashlib.deserialise(sys.argv[1])
obj = zeroonelib.deserialise(sys.argv[1])

pdb.set_trace()
1
1
Loading