GithubHelp home page GithubHelp logo

leass / rpi-reddcoin-interest-tracker Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 216 KB

A simple Python script to notify of interest generation from Raspberry-Pi based staking wallets

Python 100.00%

rpi-reddcoin-interest-tracker's Introduction

Reddcoin Interest Tracker

A simple Python script to notify of interest generation from Raspberry-Pi based staking Reddcoin wallets

This script is designed to be run from root CRON on a Raspberry Pie to track and notify the user of Reddcoin stake events. It maintains a file in the /tmp directory on the RPi that records the current amount of interest generated, when this amount is found to have changed (aka a wallet stake event has matured) it pulses the GPIO 18 pin (I have a cheap 3.3v piezo speaker attached on this pin) and sends an e-mail to the specified recipient.

I am using the gmail smtp server to send email from Python, its free and easy to setup (but it does require you to set up the gmail account to allow external application access to the smtp server)

Script requires the following libraries to run correctly

Note for .wav users:

Audio quality on the RPi is less than stellar however running this command in the console seems to help:

  • amixer set PCM -- 1000

Changelog

19/12/2014

  • Added WAV file playing functionality at the request of artiscience :) (system still toggles the GPIO 18 pin for any attached piezo speakers)
  • Moved to a config driven system (got tired of editing the code file to remove my passwords!)
  • Layout changes to the code to make it more readable
  • Added e-mail error reporting
  • Added better exception reporting for command errors
  • Updated code base to new Python version compliance

Script requires the following libraries

Bitcoinrpc

https://github.com/jgarzik/python-bitcoinrpc

(big thanks to jgarzik et.al for his excellent RPC lib)

RPi.GPIO

The script's other included function allows you to unlock the wallet for staking in the first place. This avoids you having to flush your terminal history every time you re-launch reddcoind. If unlock is successful then the command should return 'None' - go figure...

Config file

The script now checks a config file to pick up the user settings for passwords / email / reddcoind settings

uReddRpc.conf

The location of this config file must be specified when launching the script as an argument:

Usage: python uReddrpc.py [rpc_command] [config file path]

See below for examples - there is now no need to alter the python file itself :)

The script contains print statements so you will need to pipe the output in cron to a log file or null to avoid a cron e-mail **** storm every time the script runs

Example wallet unlock:

  • python /home/pi/uReddrpc.py unlockforstaking /home/pi/uReddRpc.conf
  • Enter wallet passphrase: ##########
  • None
  • $

(None = success, anything else = failure)

Example get staking info

  • python /home/pi/uReddRpc.py getstakinginfo /home/pi/uReddRpc.conf

Returns the JSON information about your current staking status

Example root crontab:

* * * * * python /home/pi/uReddRpc.py getinterest /home/pi/uReddRpc.conf >> /home/pi/uReddRpc.log

(under root cron so we have access to the GPIO pins)

Example terminal launch:

  • sudo python /home/pi/uReddrpc.py getinterest /home/pi/uReddRpc.conf

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.