├── var ├── sql │ └── README └── rrd │ └── README ├── etc ├── version ├── init.d │ └── miner-stop.sh └── cron.d │ ├── 1min │ └── README.md │ ├── hourly │ ├── README.md │ └── DONATE │ ├── 15min │ └── README.md │ ├── 2min │ └── README.md │ ├── 30min │ └── README.md │ └── 5min │ ├── README.md │ ├── RECORDPiTemperature │ ├── RECORDHashrate │ ├── ALERTHashrate │ ├── CHECKDonate │ └── ALERTDeviceCount ├── lib ├── libjansson.so ├── libjansson.so.4 ├── libusb-1.0.so ├── libusb-1.0.so.0 ├── libusb-1.0.so.2 ├── libblkmaker-0.1.so ├── libblkmaker-0.1.so.0 ├── libhidapi-hidraw.so ├── libhidapi-libusb.so ├── libhidapi-hidraw.so.0 ├── libhidapi-libusb.so.0 ├── libblkmaker_jansson-0.1.so ├── libblkmaker_jansson-0.1.so.0 ├── libjansson.a ├── libusb-1.0.a ├── libhidapi-hidraw.a ├── libhidapi-libusb.a ├── libjansson.so.4.5.0 ├── libusb-1.0.so.0.1.0 ├── libusb-1.0.so.2.0.0 ├── libblkmaker-0.1.so.0.4.1 ├── libhidapi-hidraw.so.0.0.0 ├── libhidapi-libusb.so.0.0.0 ├── libblkmaker_jansson-0.1.so.0.4.1 ├── pkgconfig │ ├── jansson.pc │ ├── hidapi-libusb.pc │ ├── libblkmaker_jansson-0.1.pc │ ├── hidapi-hidraw.pc │ └── libusb-1.0.pc ├── libjansson.la ├── libusb-1.0.la ├── libblkmaker-0.1.la ├── libhidapi-hidraw.la ├── libhidapi-libusb.la └── libblkmaker_jansson-0.1.la ├── http ├── rrd │ └── README ├── css │ ├── bg.gif │ ├── status.css │ └── bootstrap-minepeon.css ├── favicon.ico ├── img │ ├── ok.png │ ├── up.png │ ├── Logo.png │ ├── error.gif │ └── loader.gif ├── .htaccess ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.ttf │ └── glyphicons-halflings-regular.woff ├── inc │ ├── status.inc.php │ ├── miner.inc.php │ ├── settings.inc.php │ └── functions.inc.php ├── foot.php ├── logout.php ├── f_miner.php ├── backup.php ├── lang │ ├── en │ │ ├── license.en.php │ │ └── lang.en.php │ └── no │ │ └── lang.no.php ├── halt.php ├── reboot.php ├── restart.php ├── menu-nologin.php ├── menu.php ├── head.php ├── f_pools_save.php ├── setup.php ├── ajax │ ├── status.php │ ├── pools.php │ └── miners.php ├── about.php ├── login.php ├── update.php ├── index.php ├── pools.php └── plugins.php ├── bin ├── cgminer ├── bfgminer ├── bfgminer-rpc ├── cgminer-HEXu ├── cgminer-gc3355 ├── bitstreams │ ├── README │ ├── fpgaminer_top_fixed7_197MHz.ncd │ └── COPYING_fpgaminer ├── bitforce-firmware-flash ├── scripts │ ├── ArchUpdate.sh │ ├── MinePeonConfigUpdate.sh │ ├── MinePeonUIUpdate.sh │ └── FactoryReset.sh ├── MinePeonMenu.sh └── phatk121016.cl ├── share └── doc │ ├── hidapi │ ├── LICENSE-orig.txt │ ├── AUTHORS.txt │ ├── LICENSE.txt │ ├── LICENSE-bsd.txt │ └── README.txt │ └── bfgminer │ ├── example.conf │ ├── rpc-examples │ ├── api-example.py │ ├── api-example.php │ └── api-example.c │ ├── AUTHORS │ ├── HACKING │ ├── README.ASIC │ └── README.FPGA ├── README.md ├── include ├── libblkmaker-0.1 │ ├── blkmaker_jansson.h │ ├── blkmaker.h │ └── blktemplate.h ├── jansson_config.h └── jansson.h └── .gitignore /var/sql/README: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /etc/version: -------------------------------------------------------------------------------- 1 | 0.2.4.6 2 | -------------------------------------------------------------------------------- /lib/libjansson.so: -------------------------------------------------------------------------------- 1 | libjansson.so.4.5.0 -------------------------------------------------------------------------------- /lib/libjansson.so.4: -------------------------------------------------------------------------------- 1 | libjansson.so.4.5.0 -------------------------------------------------------------------------------- /lib/libusb-1.0.so: -------------------------------------------------------------------------------- 1 | libusb-1.0.so.2.0.0 -------------------------------------------------------------------------------- /lib/libusb-1.0.so.0: -------------------------------------------------------------------------------- 1 | libusb-1.0.so.0.1.0 -------------------------------------------------------------------------------- /lib/libusb-1.0.so.2: -------------------------------------------------------------------------------- 1 | libusb-1.0.so.2.0.0 -------------------------------------------------------------------------------- /var/rrd/README: -------------------------------------------------------------------------------- 1 | RRD File Directory 2 | -------------------------------------------------------------------------------- /lib/libblkmaker-0.1.so: -------------------------------------------------------------------------------- 1 | libblkmaker-0.1.so.0.4.1 -------------------------------------------------------------------------------- /lib/libblkmaker-0.1.so.0: -------------------------------------------------------------------------------- 1 | libblkmaker-0.1.so.0.4.1 -------------------------------------------------------------------------------- /lib/libhidapi-hidraw.so: -------------------------------------------------------------------------------- 1 | libhidapi-hidraw.so.0.0.0 -------------------------------------------------------------------------------- /lib/libhidapi-libusb.so: -------------------------------------------------------------------------------- 1 | libhidapi-libusb.so.0.0.0 -------------------------------------------------------------------------------- /lib/libhidapi-hidraw.so.0: -------------------------------------------------------------------------------- 1 | libhidapi-hidraw.so.0.0.0 -------------------------------------------------------------------------------- /lib/libhidapi-libusb.so.0: -------------------------------------------------------------------------------- 1 | libhidapi-libusb.so.0.0.0 -------------------------------------------------------------------------------- /http/rrd/README: -------------------------------------------------------------------------------- 1 | RRD directory for generated graphs 2 | -------------------------------------------------------------------------------- /lib/libblkmaker_jansson-0.1.so: -------------------------------------------------------------------------------- 1 | libblkmaker_jansson-0.1.so.0.4.1 -------------------------------------------------------------------------------- /lib/libblkmaker_jansson-0.1.so.0: -------------------------------------------------------------------------------- 1 | libblkmaker_jansson-0.1.so.0.4.1 -------------------------------------------------------------------------------- /etc/init.d/miner-stop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | /usr/bin/screen -S miner -X quit 3 | -------------------------------------------------------------------------------- /bin/cgminer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/bin/cgminer -------------------------------------------------------------------------------- /bin/bfgminer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/bin/bfgminer -------------------------------------------------------------------------------- /bin/bfgminer-rpc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/bin/bfgminer-rpc -------------------------------------------------------------------------------- /bin/cgminer-HEXu: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/bin/cgminer-HEXu -------------------------------------------------------------------------------- /http/css/bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/http/css/bg.gif -------------------------------------------------------------------------------- /http/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/http/favicon.ico -------------------------------------------------------------------------------- /http/img/ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/http/img/ok.png -------------------------------------------------------------------------------- /http/img/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/http/img/up.png -------------------------------------------------------------------------------- /lib/libjansson.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/lib/libjansson.a -------------------------------------------------------------------------------- /lib/libusb-1.0.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/lib/libusb-1.0.a -------------------------------------------------------------------------------- /bin/cgminer-gc3355: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/bin/cgminer-gc3355 -------------------------------------------------------------------------------- /http/img/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/http/img/Logo.png -------------------------------------------------------------------------------- /http/img/error.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/http/img/error.gif -------------------------------------------------------------------------------- /http/img/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/http/img/loader.gif -------------------------------------------------------------------------------- /bin/bitstreams/README: -------------------------------------------------------------------------------- 1 | You must put the file fpgaminer_top_fixed7_197MHz.ncd in here for modminer to work. -------------------------------------------------------------------------------- /lib/libhidapi-hidraw.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/lib/libhidapi-hidraw.a -------------------------------------------------------------------------------- /lib/libhidapi-libusb.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/lib/libhidapi-libusb.a -------------------------------------------------------------------------------- /lib/libjansson.so.4.5.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/lib/libjansson.so.4.5.0 -------------------------------------------------------------------------------- /lib/libusb-1.0.so.0.1.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/lib/libusb-1.0.so.0.1.0 -------------------------------------------------------------------------------- /lib/libusb-1.0.so.2.0.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/lib/libusb-1.0.so.2.0.0 -------------------------------------------------------------------------------- /bin/bitforce-firmware-flash: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/bin/bitforce-firmware-flash -------------------------------------------------------------------------------- /lib/libblkmaker-0.1.so.0.4.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/lib/libblkmaker-0.1.so.0.4.1 -------------------------------------------------------------------------------- /lib/libhidapi-hidraw.so.0.0.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/lib/libhidapi-hidraw.so.0.0.0 -------------------------------------------------------------------------------- /lib/libhidapi-libusb.so.0.0.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/lib/libhidapi-libusb.so.0.0.0 -------------------------------------------------------------------------------- /http/.htaccess: -------------------------------------------------------------------------------- 1 | AuthUserFile /opt/minepeon/etc/uipassword 2 | AuthType Basic 3 | AuthName "MinePeon" 4 | Require valid-user 5 | -------------------------------------------------------------------------------- /lib/libblkmaker_jansson-0.1.so.0.4.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/lib/libblkmaker_jansson-0.1.so.0.4.1 -------------------------------------------------------------------------------- /http/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/http/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /http/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/http/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /bin/bitstreams/fpgaminer_top_fixed7_197MHz.ncd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/bin/bitstreams/fpgaminer_top_fixed7_197MHz.ncd -------------------------------------------------------------------------------- /http/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MineForeman/minepeon-base/HEAD/http/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /bin/scripts/ArchUpdate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Simple script to update Arch Linux 3 | /usr/bin/sudo /usr/bin/pacman -Syu 4 | read -p "Press enter key to continue" 5 | -------------------------------------------------------------------------------- /bin/scripts/MinePeonConfigUpdate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Simple script to update Arch Linux 3 | cd / 4 | /usr/bin/sudo git pull 5 | read -p "Press enter key to continue" 6 | -------------------------------------------------------------------------------- /bin/scripts/MinePeonUIUpdate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Simple script to pull the latest from git 3 | cd /opt/minepeon 4 | git pull 5 | read -p "Press enter key to continue" 6 | -------------------------------------------------------------------------------- /lib/pkgconfig/jansson.pc: -------------------------------------------------------------------------------- 1 | prefix=/opt/minepeon 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: Jansson 7 | Description: Library for encoding, decoding and manipulating JSON data 8 | Version: 2.5 9 | Libs: -L${libdir} -ljansson 10 | Cflags: -I${includedir} 11 | -------------------------------------------------------------------------------- /share/doc/hidapi/LICENSE-orig.txt: -------------------------------------------------------------------------------- 1 | HIDAPI - Multi-Platform library for 2 | communication with HID devices. 3 | 4 | Copyright 2009, Alan Ott, Signal 11 Software. 5 | All Rights Reserved. 6 | 7 | This software may be used by anyone for any reason so 8 | long as the copyright notice in the source files 9 | remains intact. 10 | -------------------------------------------------------------------------------- /http/inc/status.inc.php: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /http/logout.php: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /lib/pkgconfig/hidapi-libusb.pc: -------------------------------------------------------------------------------- 1 | prefix=/opt/minepeon 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: hidapi-libusb 7 | Description: C Library for USB HID device access from Linux, Mac OS X, FreeBSD, and Windows. This is the libusb implementation. 8 | Version: 0.8.0-rc1 9 | Libs: -L${libdir} -lhidapi-libusb 10 | Cflags: -I${includedir}/hidapi 11 | -------------------------------------------------------------------------------- /lib/pkgconfig/libblkmaker_jansson-0.1.pc: -------------------------------------------------------------------------------- 1 | prefix=/opt/minepeon 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: libblkmaker_jansson 7 | Description: Bitcoin block maker library. 8 | Version: 0.1 9 | URL: http://gitorious.org/bitcoin/libblkmaker 10 | Libs: -L${libdir} -lblkmaker-0.1 -lblkmaker_jansson-0.1 11 | Cflags: -I${includedir}/libblkmaker-0.1 12 | -------------------------------------------------------------------------------- /lib/pkgconfig/hidapi-hidraw.pc: -------------------------------------------------------------------------------- 1 | prefix=/opt/minepeon 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: hidapi-hidraw 7 | Description: C Library for USB/Bluetooth HID device access from Linux, Mac OS X, FreeBSD, and Windows. This is the hidraw implementation. 8 | Version: 0.8.0-rc1 9 | Libs: -L${libdir} -lhidapi-hidraw 10 | Cflags: -I${includedir}/hidapi 11 | -------------------------------------------------------------------------------- /lib/pkgconfig/libusb-1.0.pc: -------------------------------------------------------------------------------- 1 | prefix=/opt/minepeon 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: libusb-1.0 7 | Description: C API for USB device access from Linux, Mac OS X, OpenBSD, NetBSD and Windows userspace 8 | Version: 1.0.16-rc10 9 | Libs: -L${libdir} -lusb-1.0 10 | Libs.private: -ludev -pthread 11 | Cflags: -I${includedir}/libusb-1.0 12 | 13 | -------------------------------------------------------------------------------- /etc/cron.d/1min/README.md: -------------------------------------------------------------------------------- 1 | 1 minute Cron Directory. 2 | 3 | Anything placed in this directory will be automaticly run every minute 4 | 5 | The files in this directory should be chmod 750 and the names must consist 6 | entirely of upper and lower case letters, digits, underscores, and hyphens. 7 | 8 | Be careful that the script name in these does not include a dot (.), e.g. 9 | backup.sh, since run-parts will ignore them. 10 | -------------------------------------------------------------------------------- /etc/cron.d/hourly/README.md: -------------------------------------------------------------------------------- 1 | Hour Cron Directory. 2 | 3 | Anything placed in this directory will be automaticly run every hour. 4 | 5 | The files in this directory should be chmod 750 and the names must consist 6 | entirely of upper and lower case letters, digits, underscores, and hyphens. 7 | 8 | Be careful that the script name in these does not include a dot (.), e.g. 9 | backup.sh, since run-parts will ignore them. 10 | -------------------------------------------------------------------------------- /etc/cron.d/15min/README.md: -------------------------------------------------------------------------------- 1 | 15 minute Cron Directory. 2 | 3 | Anything placed in this directory will be automaticly run every 15 minutes 4 | 5 | The files in this directory should be chmod 750 and the names must consist 6 | entirely of upper and lower case letters, digits, underscores, and hyphens. 7 | 8 | Be careful that the script name in these does not include a dot (.), e.g. 9 | backup.sh, since run-parts will ignore them. 10 | -------------------------------------------------------------------------------- /etc/cron.d/2min/README.md: -------------------------------------------------------------------------------- 1 | 2 minute Cron Directory. 2 | 3 | Anything placed in this directory will be automaticly run every 2 minutes 4 | 5 | The files in this directory should be chmod 750 and the names must consist 6 | entirely of upper and lower case letters, digits, underscores, and hyphens. 7 | 8 | Be careful that the script name in these does not include a dot (.), e.g. 9 | backup.sh, since run-parts will ignore them. 10 | -------------------------------------------------------------------------------- /etc/cron.d/30min/README.md: -------------------------------------------------------------------------------- 1 | 30 minute Cron Directory. 2 | 3 | Anything placed in this directory will be automaticly run every 30 minutes 4 | 5 | The files in this directory should be chmod 750 and the names must consist 6 | entirely of upper and lower case letters, digits, underscores, and hyphens. 7 | 8 | Be careful that the script name in these does not include a dot (.), e.g. 9 | backup.sh, since run-parts will ignore them. 10 | -------------------------------------------------------------------------------- /etc/cron.d/5min/README.md: -------------------------------------------------------------------------------- 1 | 5 minute Cron Directory. 2 | 3 | Anything placed in this directory will be automaticly run every 5 minutes 4 | 5 | The files in this directory should be chmod 750 and the names must consist 6 | entirely of upper and lower case letters, digits, underscores, and hyphens. 7 | 8 | Be careful that the script name in these does not include a dot (.), e.g. 9 | backup.sh, since run-parts will ignore them. 10 | -------------------------------------------------------------------------------- /share/doc/hidapi/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | 2 | HIDAPI Authors: 3 | 4 | Alan Ott : 5 | Original Author and Maintainer 6 | Linux, Windows, and Mac implementations 7 | 8 | Ludovic Rousseau : 9 | Formatting for Doxygen documentation 10 | Bug fixes 11 | Correctness fixes 12 | 13 | 14 | For a comprehensive list of contributions, see the commit list at github: 15 | http://github.com/signal11/hidapi/commits/master 16 | 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | minepeon-base 2 | ============= 3 | 4 | To make the MinePeon user;- 5 | 6 | groupadd -g 500 minepeon 7 | 8 | useradd -m -u 500 -g 500 -d /home/minepeon -p peon minepeon 9 | 10 | user: minepeon (UID 500) 11 | 12 | group: minepeon (GID 500) 13 | 14 | minepeon-base 15 | 16 | PHP branch 17 | 18 | 19 | How to make a Plugin to Minepeon 20 | = 21 | 22 | Take a look here at the wiki: 23 | https://github.com/MineForeman/minepeon-base/wiki/How-to-make-a-plugin-using-the-api 24 | -------------------------------------------------------------------------------- /http/css/status.css: -------------------------------------------------------------------------------- 1 | 2 | .inner { 3 | padding: 30px; 4 | 5 | } 6 | 7 | .mastfoot { 8 | color: #999; /* IE8 proofing */ 9 | vertical-align: right; 10 | } 11 | 12 | 13 | @media (min-width: 768px) { 14 | .mastfoot { 15 | position: fixed; 16 | top: 0; 17 | vertical-align: right; 18 | } 19 | /* Handle the widths */ 20 | 21 | .mastfoot { 22 | width: 100%; /* Must be percentage or pixels for horizontal alignment */ 23 | } 24 | } 25 | 26 | @media (min-width: 992px) { 27 | .mastfoot { 28 | width: 700px; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /share/doc/hidapi/LICENSE.txt: -------------------------------------------------------------------------------- 1 | HIDAPI can be used under one of three licenses. 2 | 3 | 1. The GNU General Public License, version 3.0, in LICENSE-gpl3.txt 4 | 2. A BSD-Style License, in LICENSE-bsd.txt. 5 | 3. The more liberal original HIDAPI license. LICENSE-orig.txt 6 | 7 | The license chosen is at the discretion of the user of HIDAPI. For example: 8 | 1. An author of GPL software would likely use HIDAPI under the terms of the 9 | GPL. 10 | 11 | 2. An author of commercial closed-source software would likely use HIDAPI 12 | under the terms of the BSD-style license or the original HIDAPI license. 13 | 14 | -------------------------------------------------------------------------------- /include/libblkmaker-0.1/blkmaker_jansson.h: -------------------------------------------------------------------------------- 1 | #ifndef BLKMAKER_JANSSON_H 2 | #define BLKMAKER_JANSSON_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | extern json_t *blktmpl_request_jansson(gbt_capabilities_t extracaps, const char *lpid); 9 | extern const char *blktmpl_add_jansson(blktemplate_t *, const json_t *, time_t time_rcvd); 10 | extern json_t *blkmk_submit_jansson(blktemplate_t *, const unsigned char *data, unsigned int dataid, blknonce_t); 11 | extern json_t *blkmk_submit_foreign_jansson(blktemplate_t *, const unsigned char *data, unsigned int dataid, blknonce_t); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /http/f_miner.php: -------------------------------------------------------------------------------- 1 | false, 'debug' => "No command given")); 13 | exit; 14 | } 15 | 16 | $command["command"] = $_REQUEST['command']; 17 | 18 | // Check for parameters 19 | if (!empty($_REQUEST['parameter'])) { 20 | $command['parameter']=$_REQUEST['parameter']; 21 | } 22 | 23 | miner($command["command"], $command['parameter']); 24 | 25 | 26 | $r['success'] = "true"; 27 | $r['command'] = $command; 28 | echo json_encode($r); 29 | ?> 30 | -------------------------------------------------------------------------------- /http/backup.php: -------------------------------------------------------------------------------- 1 | $command, 8 | "parameter" => $parameter 9 | ); 10 | 11 | $jsonCmd = json_encode($command); 12 | 13 | $host = "127.0.0.1"; 14 | $port = 4028; 15 | 16 | $client = @stream_socket_client("tcp://$host:$port", $errno, $errorMessage); 17 | 18 | if ($client === false) { 19 | return false; 20 | } 21 | fwrite($client, $jsonCmd); 22 | $response = stream_get_contents($client); 23 | fclose($client); 24 | $response = preg_replace("/[^[:alnum:][:punct:]]/","",$response); 25 | $response = json_decode($response, true); 26 | return $response; 27 | 28 | } 29 | 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | DEBUG 2 | .gitignore 3 | etc/init.d/miner-start.sh 4 | etc/init.d/miner-start.sh.a 5 | etc/minepeon.conf 6 | etc/miner.conf 7 | etc/miner.conf.orig 8 | etc/miner.user.conf 9 | etc/uipassword 10 | http/rrd/mhsav-day.png 11 | http/rrd/mhsav-hour.png 12 | http/rrd/mhsav-month.png 13 | http/rrd/mhsav-week.png 14 | http/rrd/mhsav-year.png 15 | var/rrd/hashrate.rrd 16 | var/rrd/temp.rrd 17 | bin/bfgminer.cfg 18 | etc/.DS_Store 19 | etc/._.DS_Store 20 | etc/contractStatus.dat 21 | etc/cron.d/.DS_Store 22 | etc/cron.d/._.DS_Store 23 | etc/cron.d/1min/MMAUpdate 24 | etc/cron.d/2min/.DS_Store 25 | etc/cron.d/2min/._.DS_Store 26 | etc/cron.d/2min/GHFCcontractStatus 27 | etc/cron.d/2min/MMACmdCheck 28 | etc/cron.d/5min/GHFCSubminerSTAT 29 | etc/cron.d/hourly/UPDATE 30 | etc/user.conf 31 | http/cex/ 32 | http/debug.php 33 | http/install_temp/ 34 | http/plugin.xml 35 | http/plugins/ 36 | http/redirect/ 37 | http/test.php 38 | var/sql/summary.db 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /http/lang/en/license.en.php: -------------------------------------------------------------------------------- 1 |

There are many different components to MinePeon and you will find that they all have some sort of license, please respect their intellectual property rights by complying with their license, you will find the licence details included in the upstream package of the software.

2 | 3 |

The MinePeon software is Copyright 2013 Neil Fincham under the GPLv3.

4 |
 5 |     This software is free software: you can redistribute it and/or 
 6 |     modify it under the terms of the GNU General Public License as 
 7 |     published by the Free Software Foundation version 3.
 8 | 
 9 |     This software is distributed in the hope that it will be useful,
10 |     but WITHOUT ANY WARRANTY; without even the implied warranty of
11 |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 |     GNU General Public License for more details.
13 | 
14 |     You should have received a copy of the GNU General Public License
15 |     along with this program.  If not, see http://www.gnu.org/licenses/.
16 | 
17 | -------------------------------------------------------------------------------- /share/doc/bfgminer/example.conf: -------------------------------------------------------------------------------- 1 | { 2 | "pools" : [ 3 | { 4 | "url" : "http://url1:8332", 5 | "user" : "user1", 6 | "pass" : "pass1" 7 | }, 8 | { 9 | "url" : "http://url2:8344", 10 | "pool-proxy" : "socks5://127.0.0.1:1080", 11 | "user" : "user2", 12 | "pass" : "pass2" 13 | }, 14 | { 15 | "url" : "http://url3:8332", 16 | "user" : "user3", 17 | "pass" : "pass3" 18 | } 19 | ], 20 | 21 | "intensity" : "d,9,9,9", 22 | "gpu-engine" : "0-985,0-950,0-960,0-1000", 23 | "gpu-fan" : "0-85,0-85,0-85,0-85", 24 | "gpu-memclock" : "860,825,835,875", 25 | "gpu-powertune" : "20,20,20,20", 26 | "temp-cutoff" : "95,95,95,95", 27 | "temp-overheat" : "85,85,85,85", 28 | "temp-target" : "75,75,75,75", 29 | 30 | "auto-fan" : true, 31 | "auto-gpu" : true, 32 | "expiry" : 120, 33 | "failover-only" : true, 34 | "gpu-threads" : 2, 35 | "log" : 5, 36 | "queue" : 1, 37 | "scan-time" : 60, 38 | "temp-hysteresis" : 3, 39 | 40 | "scan-serial" : [ 41 | "/dev/ttyUSB0", 42 | "/dev/ttyUSB1", 43 | "/dev/ttyUSB2", 44 | "/dev/ttyUSB3" 45 | ], 46 | 47 | "kernel-path" : "/usr/local/bin" 48 | } 49 | -------------------------------------------------------------------------------- /bin/bitstreams/COPYING_fpgaminer: -------------------------------------------------------------------------------- 1 | All the bitstream files included in this directory that follow the name pattern fpgaminer_*.ncd are: 2 | 3 | ---- 4 | 5 | Copyright (c) 2011-2012 fpgaminer@bitcoin-mining.com 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | 20 | ---- 21 | 22 | You can find the original sources at the Open Source FPGA Bitcoin Miner project GitHub repository: 23 | https://github.com/progranism/Open-Source-FPGA-Bitcoin-Miner/tree/master/projects/X6000_ztex_comm4/hdl 24 | -------------------------------------------------------------------------------- /etc/cron.d/5min/RECORDHashrate: -------------------------------------------------------------------------------- 1 | #!/usr/bin/php 2 | 48 | -------------------------------------------------------------------------------- /lib/libjansson.la: -------------------------------------------------------------------------------- 1 | # libjansson.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.2 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='libjansson.so.4' 9 | 10 | # Names of this library. 11 | library_names='libjansson.so.4.5.0 libjansson.so.4 libjansson.so' 12 | 13 | # The name of the static archive. 14 | old_library='libjansson.a' 15 | 16 | # Linker flags that can not go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs='' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libjansson. 26 | current=9 27 | age=5 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/opt/minepeon/lib' 42 | -------------------------------------------------------------------------------- /lib/libusb-1.0.la: -------------------------------------------------------------------------------- 1 | # libusb-1.0.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.2 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='libusb-1.0.so.2' 9 | 10 | # Names of this library. 11 | library_names='libusb-1.0.so.2.0.0 libusb-1.0.so.2 libusb-1.0.so' 12 | 13 | # The name of the static archive. 14 | old_library='libusb-1.0.a' 15 | 16 | # Linker flags that can not go in dependency_libs. 17 | inherited_linker_flags=' -pthread' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -ludev' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libusb-1.0. 26 | current=2 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/opt/minepeon/lib' 42 | -------------------------------------------------------------------------------- /lib/libblkmaker-0.1.la: -------------------------------------------------------------------------------- 1 | # libblkmaker-0.1.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.2 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='libblkmaker-0.1.so.0' 9 | 10 | # Names of this library. 11 | library_names='libblkmaker-0.1.so.0.4.1 libblkmaker-0.1.so.0 libblkmaker-0.1.so' 12 | 13 | # The name of the static archive. 14 | old_library='' 15 | 16 | # Linker flags that can not go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs='' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libblkmaker-0.1. 26 | current=4 27 | age=4 28 | revision=1 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/opt/minepeon/lib' 42 | -------------------------------------------------------------------------------- /lib/libhidapi-hidraw.la: -------------------------------------------------------------------------------- 1 | # libhidapi-hidraw.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.2 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='libhidapi-hidraw.so.0' 9 | 10 | # Names of this library. 11 | library_names='libhidapi-hidraw.so.0.0.0 libhidapi-hidraw.so.0 libhidapi-hidraw.so' 12 | 13 | # The name of the static archive. 14 | old_library='libhidapi-hidraw.a' 15 | 16 | # Linker flags that can not go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -ludev' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libhidapi-hidraw. 26 | current=0 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/opt/minepeon/lib' 42 | -------------------------------------------------------------------------------- /lib/libhidapi-libusb.la: -------------------------------------------------------------------------------- 1 | # libhidapi-libusb.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.2 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='libhidapi-libusb.so.0' 9 | 10 | # Names of this library. 11 | library_names='libhidapi-libusb.so.0.0.0 libhidapi-libusb.so.0 libhidapi-libusb.so' 12 | 13 | # The name of the static archive. 14 | old_library='libhidapi-libusb.a' 15 | 16 | # Linker flags that can not go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -lrt -lusb-1.0' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libhidapi-libusb. 26 | current=0 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/opt/minepeon/lib' 42 | -------------------------------------------------------------------------------- /include/libblkmaker-0.1/blkmaker.h: -------------------------------------------------------------------------------- 1 | #ifndef BLKMAKER_H 2 | #define BLKMAKER_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | #define BLKMAKER_VERSION (4L) 11 | #define BLKMAKER_MAX_BLOCK_VERSION (2) 12 | 13 | extern bool (*blkmk_sha256_impl)(void *hash_out, const void *data, size_t datasz); 14 | 15 | extern uint64_t blkmk_init_generation(blktemplate_t *, void *script, size_t scriptsz); 16 | extern uint64_t blkmk_init_generation2(blktemplate_t *, void *script, size_t scriptsz, bool *out_newcb); 17 | extern ssize_t blkmk_append_coinbase_safe(blktemplate_t *, const void *append, size_t appendsz); 18 | extern bool _blkmk_extranonce(blktemplate_t *tmpl, void *vout, unsigned int workid, size_t *offs); 19 | extern size_t blkmk_get_data(blktemplate_t *, void *buf, size_t bufsz, time_t usetime, int16_t *out_expire, unsigned int *out_dataid); 20 | extern blktime_diff_t blkmk_time_left(const blktemplate_t *, time_t nowtime); 21 | extern unsigned long blkmk_work_left(const blktemplate_t *); 22 | #define BLKMK_UNLIMITED_WORK_COUNT ULONG_MAX 23 | 24 | extern size_t blkmk_address_to_script(void *out, size_t outsz, const char *addr); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /etc/cron.d/5min/ALERTHashrate: -------------------------------------------------------------------------------- 1 | #!/usr/bin/php 2 | $hashrate and $settings['donateActive'] == 0) { 16 | 17 | // Send an email if the devices dont match and set the deviceWarn falt 18 | 19 | 20 | $warning = "MinePeon Fault: " . $settings['alertDevice'] . ": Unexpected hashrate " . $hashrate . " MH/s (Expected " . $settings['miningExpHash'] . " MH/s)"; 21 | 22 | sendEmail($settings, $warning, $warning); 23 | 24 | 25 | // Set the warning flag 26 | 27 | $settings['hashWarn'] = 1; 28 | writeSettings($settings); 29 | echo " fault"; 30 | 31 | } 32 | 33 | if($settings['hashWarn'] == 1 and $settings['miningExpHash'] < $hashrate) { 34 | 35 | $warning = "MinePeon Fault: " . $settings['alertDevice'] . ": Unexpected hashrate recovered"; 36 | 37 | sendEmail($settings, $warning, $warning); 38 | 39 | // Clear the warning flag 40 | $settings['hashWarn'] = 0; 41 | writeSettings($settings); 42 | echo " nofault"; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /lib/libblkmaker_jansson-0.1.la: -------------------------------------------------------------------------------- 1 | # libblkmaker_jansson-0.1.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.2 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='libblkmaker_jansson-0.1.so.0' 9 | 10 | # Names of this library. 11 | library_names='libblkmaker_jansson-0.1.so.0.4.1 libblkmaker_jansson-0.1.so.0 libblkmaker_jansson-0.1.so' 12 | 13 | # The name of the static archive. 14 | old_library='' 15 | 16 | # Linker flags that can not go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -L.libs /opt/minepeon/lib/libblkmaker-0.1.la -ljansson' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libblkmaker_jansson-0.1. 26 | current=4 27 | age=4 28 | revision=1 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/opt/minepeon/lib' 42 | -------------------------------------------------------------------------------- /include/jansson_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2013 Petri Lehtinen 3 | * 4 | * Jansson is free software; you can redistribute it and/or modify 5 | * it under the terms of the MIT license. See LICENSE for details. 6 | * 7 | * 8 | * This file specifies a part of the site-specific configuration for 9 | * Jansson, namely those things that affect the public API in 10 | * jansson.h. 11 | * 12 | * The configure script copies this file to jansson_config.h and 13 | * replaces @var@ substitutions by values that fit your system. If you 14 | * cannot run the configure script, you can do the value substitution 15 | * by hand. 16 | */ 17 | 18 | #ifndef JANSSON_CONFIG_H 19 | #define JANSSON_CONFIG_H 20 | 21 | /* If your compiler supports the inline keyword in C, JSON_INLINE is 22 | defined to `inline', otherwise empty. In C++, the inline is always 23 | supported. */ 24 | #ifdef __cplusplus 25 | #define JSON_INLINE inline 26 | #else 27 | #define JSON_INLINE inline 28 | #endif 29 | 30 | /* If your compiler supports the `long long` type and the strtoll() 31 | library function, JSON_INTEGER_IS_LONG_LONG is defined to 1, 32 | otherwise to 0. */ 33 | #define JSON_INTEGER_IS_LONG_LONG 1 34 | 35 | /* If locale.h and localeconv() are available, define to 1, 36 | otherwise to 0. */ 37 | #define JSON_HAVE_LOCALECONV 1 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /etc/cron.d/5min/CHECKDonate: -------------------------------------------------------------------------------- 1 | #!/usr/bin/php 2 | 0) { 16 | $settings['donateCheck'] = $settings['donateCheck'] - 5; 17 | writeSettings($settings); 18 | } 19 | else { 20 | $settings['donateCheck'] = 0; 21 | $settings['donateActive'] = false; 22 | writeSettings($settings); 23 | $donatepool = checkdonate(); 24 | miner('disablepool', $donatepool); 25 | sleep('3'); 26 | miner('removepool', $donatepool); 27 | } 28 | } 29 | else { 30 | $settings['donateActive'] = false; 31 | writeSettings($settings); 32 | $donatepool = checkdonate(); 33 | miner('disablepool', $donatepool); 34 | sleep('3'); 35 | miner('removepool', $donatepool); 36 | } 37 | } 38 | 39 | 40 | function checkdonate() 41 | { 42 | $poolUser = 'MinePeon_Donate'; 43 | $pools = miner('pools', '') ['POOLS']; 44 | $checkpool = - 1; 45 | $pooln = 0; 46 | foreach($pools as $k => $v) { 47 | if (isset($v['User']) && $v['User'] == $poolUser) { 48 | $checkpool = $pooln; 49 | } 50 | 51 | $pooln = $pooln + 1; 52 | } 53 | 54 | return $checkpool; 55 | } 56 | -------------------------------------------------------------------------------- /share/doc/hidapi/LICENSE-bsd.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010, Alan Ott, Signal 11 Software 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of Signal 11 Software nor the names of its 13 | contributors may be used to endorse or promote products derived from 14 | this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /bin/scripts/FactoryReset.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Factory Reset. You peobably don't want to do this! 3 | 4 | if [ "$UID" -ne 0 ] 5 | then echo "Please run as root, even then, You peobably don't want to do this!" 6 | exit 7 | fi 8 | 9 | read -p "Press enter key to continue or CTRL-C to abort" 10 | 11 | find / -type f -iname '*.old' -exec rm -f {} \+ 12 | find / -type f -iname '*.n' -exec rm -f {} \+ 13 | find / -type f -iname '*.pacnew' -exec rm -f {} \+ 14 | find /var/ -type f -iname '*.1' -exec rm -f {} \+ 15 | find /var/ -type f -iname '*.log' -exec cp /dev/null {} \+ 16 | 17 | echo "" > /var/log/pacman.log 18 | echo "" > /var/log/btmp 19 | echo "" > /var/log/faillog 20 | echo "" > /var/log/wtmp 21 | 22 | rm -rf /root/.config 23 | rm -rf /root/.bash_history 24 | rm -rf /root/.wicd 25 | rm -rf /root/.ssh 26 | rm -rf /root/.g* 27 | 28 | rm -rf /home/minepeon/* 29 | rm -rf /home/minepeon/.bash_history 30 | rm -rf /home/minepeon/.ssh 31 | rm -rf /home/minepeon/.viminfo 32 | rm -rf /home/minepeon/.wicd 33 | rm -rf /home/minepeon/.g* 34 | 35 | rm -rf /etc/ssh/ssh_host_rsa_key 36 | rm -rf /etc/ssh/ssh_host_dsa_key 37 | rm -rf /etc/ssh/ssh_host_ecdsa_key 38 | rm -rf /etc/ssh/ssh_host_ecdsa_key.pub 39 | rm -rf /etc/ssh/ssh_host_key.pub 40 | rm -rf /etc/ssh/ssh_host_key 41 | rm -rf /etc/ssh/ssh_host_rsa_key.pub 42 | rm -rf /etc/ssh/sshd_config.pacnew 43 | rm -rf /etc/ssh/ssh_host_dsa_key.pub 44 | 45 | rm -rf /var/log/httpd/* 46 | rm -rf /opt/minepeon/var/rrd/*.rrd 47 | rm -rf /opt/minepeon/http/rrd/*.png 48 | cp /opt/minepeon/var/sql/summary.db.clean /opt/minepeon/var/sql/summary.db 49 | rm /opt/minepeon/DEBUG 50 | 51 | dd if=/dev/zero of=/junk 52 | sync 53 | rm /junk 54 | 55 | read -p "Press enter key to continue" 56 | -------------------------------------------------------------------------------- /bin/MinePeonMenu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Script to perform some common system operations 4 | # 5 | while : 6 | do 7 | clear 8 | echo "########################################" 9 | echo "# MinePeon Console Menu #" 10 | echo "########################################" 11 | echo "# [a] Miner Screen (CTRL-A-D to exit) #" 12 | echo "# [s] Change console password #" 13 | echo "# [d] Stop Miner #" 14 | echo "# [f] Start Miner #" 15 | echo "# [g] Restart Miner #" 16 | echo "# [z] Update MinePeon #" 17 | echo "# [x] Update MinePeon Configuration #" 18 | echo "# [c] Update ArchLinux (MinePeon Base) #" 19 | echo "# [v] Reboot MinePeon #" 20 | echo "# [q] Exit to shell #" 21 | echo "########################################" 22 | echo "# [Some options require your password] #" 23 | echo "# [ Exit to shell and type logout to ] #" 24 | echo "# [ Exit System ] #" 25 | echo "########################################" 26 | echo "" 27 | echo -n "Enter your menu choice [a-0]: " 28 | read yourch 29 | case $yourch in 30 | a) /usr/bin/screen -r;; 31 | s) /usr/bin/passwd ;; 32 | d) /usr/bin/sudo /usr/bin/systemctl stop miner ;; 33 | f) /usr/bin/sudo /usr/bin/systemctl start miner ;; 34 | g) /usr/bin/sudo /usr/bin/systemctl restart miner ;; 35 | z) /opt/minepeon/bin/scripts/MinePeonUIUpdate.sh ;; 36 | x) /opt/minepeon/bin/scripts/MinePeonConfigUpdate.sh ;; 37 | c) /opt/minepeon/bin/scripts/ArchUpdate.sh ;; 38 | z) /usr/bin/sudo /usr/bin/reboot ;; 39 | q) exit 0;; 40 | *) echo "Please select one of the menu items"; 41 | echo "Press Enter to continue. . ." ; read ;; 42 | esac 43 | done 44 | 45 | -------------------------------------------------------------------------------- /http/halt.php: -------------------------------------------------------------------------------- 1 | 7 | 9 | 10 | 11 | Halting MinePeon 12 | 13 | 14 | 32 | 49 | 50 | 51 |
52 |

Shutting Down MinePeon

53 |

It should be safe to unplug in

54 |

30

55 |

seconds.

56 |
57 | 58 | 59 | 60 | /dev/null 2>&1 &'); 63 | -------------------------------------------------------------------------------- /http/reboot.php: -------------------------------------------------------------------------------- 1 | 7 | 9 | 10 | 11 | Rebooting MinePeon 12 | 13 | 14 | 32 | 49 | 50 | 51 |
52 |

Rebooting MinePeon

53 |

You will be redirected in

54 |

60

55 |

seconds.

56 |
57 | 58 | 59 | 60 | /dev/null 2>&1 &'); 63 | -------------------------------------------------------------------------------- /http/restart.php: -------------------------------------------------------------------------------- 1 | 7 | 9 | 10 | 11 | Restarting Miner 12 | 13 | 14 | 32 | 49 | 50 | 51 |
52 |

Restarting Miner

53 |

You will be redirected in

54 |

15

55 |

seconds.

56 |
57 | 58 | 59 | 60 | $devcount) { 20 | 21 | // Set the warning flag 22 | $settings['devicesWarn'] = true; 23 | writeSettings($settings); 24 | 25 | $message = "MinePeon Fault: " . $settings['alertDevice'] . ": Unexpected device count " . $devcount . " (Expected " . $settings['miningExpDev'] . ")"; 26 | 27 | // Send an email if the devices dont match and set the deviceWarn falt 28 | sendEmail($settings, $message, $message); 29 | } 30 | } else { 31 | if ($settings['miningExpDev'] == $devcount) { 32 | 33 | $message = "MinePeon Fault: " . $settings['alertDevice'] . ": Unexpected device count recovered " . $devcount . " devices now active"; 34 | 35 | sendEmail($settings, $message, $message); 36 | 37 | // Clear the warning flag 38 | $settings['devicesWarn'] = false; 39 | writeSettings($settings); 40 | } 41 | } 42 | } 43 | } 44 | 45 | 46 | function deviceCount($devs) 47 | { 48 | $devices = 0; 49 | 50 | foreach ($devs as $dev) { 51 | if ($dev['MHS5s'] > 0) { 52 | $devices++; 53 | } 54 | } 55 | return $devices; 56 | } -------------------------------------------------------------------------------- /http/menu-nologin.php: -------------------------------------------------------------------------------- 1 | 14 | 15 | 40 | 43 |
44 |
45 | 46 | Minepeon: Update available! Do you want to update? 47 |
48 |
49 | 52 | -------------------------------------------------------------------------------- /http/menu.php: -------------------------------------------------------------------------------- 1 | 17 | 18 | 43 | 46 |
47 |
48 | 49 | Minepeon: Update available! Do you want to update? 50 |
51 |
52 | 55 | -------------------------------------------------------------------------------- /http/inc/settings.inc.php: -------------------------------------------------------------------------------- 1 | 30 |

Plea

31 |

Please reconsider your decision to give back absolutely nothing to the project that is currently running your miners. A lot of time and effort has gone into making MinePeon what it is today and a small token of 15 minutes of your hash power would be greatly appreciated and will continue to fund the ongoing development and support of MinePeon.

32 |

It is such a small amount and well below the normal variance in bitcoin mining you will not even notice the difference. If you work it out for every 1 GH/s you have it is 0.00027 bitcoin a day, ask yourself, is that really too much to support MinePeon?

33 |

Some of the features that I would like to include are;-

34 |
    35 |
  • TFT Display
  • 36 |
  • LCD Display
  • 37 |
  • Android app
  • 38 |
  • iOS app
  • 39 |
  • Live Update
  • 40 |
  • SMS/Email Alerts
  • 41 |
  • Backup/Restore
  • 42 |
  • Cloud Control
  • 43 |
  • VPN Tunneling (DDOS Protection & Anonymity)
  • 44 |
45 |

Most of those new features cost money to setup and run, I would prefer not to have to make features available as "paid for" addons but it all depends on you.

46 |

Neil Fincham

47 |

The MineForeman

'; 48 | ?> 49 | -------------------------------------------------------------------------------- /http/head.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | MinePeon, from MineForeman 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 25 | 26 | 27 | 28 | 29 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /share/doc/bfgminer/AUTHORS: -------------------------------------------------------------------------------- 1 | FPGA/ASIC mining and refactor: Luke Dashjr 1QATWksNFGeUJCWBrN4g6hGM178Lovm7Wh 2 | GPU mining and refactor: Con Kolivas 15qSxP1SQcUX3o4nhkfdbgyoWEFMomJ4rZ 3 | AntMiner driver: Nate Woolls and Lingchao Xu 4 | DualMiner driver: Nate Woolls and Dualminer Team 5 | Bitfury GPIO-based drivers: Bitfury and Anatoly Legkodymov 6 | Big Picture Mining and TwinFury drivers: Andreas Auer 7 | Avalon and Icarus drivers: Xiangfu 8 | ZTEX FPGA driver: Nelisky 9 | Original CPU mining software: Jeff Garzik 10 | RPC API: Andrew Smith 1Jjk2LmktEQKnv8r2cZ9MvLiZwZ9gxabKm 11 | 12 | SUSE packaging: Christian Berendt 13 | Ubuntu packaging: Graeme Humphries 14 | 15 | Contributors: 16 | 17 | Jason Hughes 18 | Ycros 19 | Denis Ahrens 20 | blinkier 21 | Peter Stuge 22 | Paul Sheppard 23 | Vladimir Strinski 24 | Dmitry Sorokin 25 | Jason Snell 26 | Mark Crichton 27 | Zefir Kurtisi 28 | HashBuster team 29 | bluemurder 30 | Philip Kaufmann 31 | Rusty Russell 32 | Znort 987 33 | Phateus 34 | Olivier Gay 35 | Glenn Francis Murray 36 | fleger 37 | pooler 38 | Ricardo Iván Vieitez Parra 39 | gluk 40 | Paul Wouters 41 | Abracadabra 42 | Josh Lehan 43 | pontus 44 | Nico Oelgart 45 | Tydus 46 | Raulo 47 | Thorsten Gilling 48 | Isidoro Ghezzi 49 | capa66 50 | Red_Wolf_2 51 | Mr O 52 | -------------------------------------------------------------------------------- /etc/cron.d/hourly/DONATE: -------------------------------------------------------------------------------- 1 | #!/usr/bin/php 2 | branch; 9 | $upd = (string)$update->version; 10 | $upf = str_replace("\n", '', file_get_contents('/opt/minepeon/etc/version')); 11 | if ($upd != $upf && $upd != ""){ 12 | $settings['update'] = "true"; 13 | $settings['updatebranch'] = $bra; 14 | writeSettings($settings); 15 | }else{ 16 | $settings['update'] = "false"; 17 | $settings['updatebranch'] = "null"; 18 | writeSettings($settings); 19 | } 20 | 21 | if ($settings['donateTime'] != ""){ 22 | $dTime = $settings['donateTime']; 23 | }else{ 24 | $dTime = 12; 25 | } 26 | 27 | if(empty($settings['donateEnable']) || !$settings['donateEnable']){ 28 | exit; 29 | } 30 | 31 | if (date('G') <> $dTime) { 32 | exit; 33 | } 34 | 35 | $poolAddress = 'stratum+tcp://stratum.btcguild.com:3333'; 36 | $poolUser = 'MinePeon_Donate'; 37 | $poolPass = 'MinePeon_Donate'; 38 | 39 | //$poolAddress = 'stratum+tcp://us.ozco.in:3333'; 40 | //$poolUser = 'minepeon.donate'; 41 | //$poolPass = 'donate'; 42 | 43 | $donateAmount = 15; 44 | if(empty($settings['donateAmount'])){ 45 | $donateAmount = $settings['donateAmount']; 46 | } 47 | 48 | $settings['donateActive'] = true; 49 | $settings['donateCheck'] = $settings['donateAmount']; 50 | $settings['lastdonate'] = date('d') . "." . date('F'); 51 | writeSettings($settings); 52 | 53 | miner("addpool",$poolAddress . "," . $poolUser . "," . $poolPass); 54 | 55 | // Sleep for 5 secconds to avoid monitor scripts 56 | // Also give miner time to connect to eligius 57 | sleep(5); 58 | 59 | $pool = findDonatePool($poolUser); 60 | miner('switchpool',$pool); 61 | 62 | sleep($settings['donateAmount'] * 60); 63 | 64 | $pool = findDonatePool($poolUser); 65 | miner('disablepool',$pool); 66 | sleep('3'); 67 | miner('removepool',$pool); 68 | 69 | $settings['donateActive'] = false; 70 | writeSettings($settings); 71 | 72 | function findDonatePool($addr){ 73 | $pools = miner('pools','')['POOLS']; 74 | $donatePool = -1; 75 | $pooln = 0; 76 | foreach ($pools as $k => $v) { 77 | if(isset($v['User']) && $v['User']==$addr){ 78 | $donatePool = $pooln; 79 | 80 | } 81 | $pooln = $pooln + 1; 82 | } 83 | return $donatePool; 84 | } 85 | 86 | ?> 87 | -------------------------------------------------------------------------------- /http/f_pools_save.php: -------------------------------------------------------------------------------- 1 | false, 'debug' => "Not saving")); 13 | exit; 14 | } 15 | 16 | //initialize a limit to the number of pools that are added to the miner config file. is there an official limit? 17 | $poolLimit = 20; 18 | 19 | 20 | 21 | 22 | // Loop through all rows, stop after 3 empty rows or if poolLimit is exceeded, process the POST or GET data 23 | $e = 0; 24 | for($i=0;$i<$poolLimit || $e < 3;$i++) { 25 | if(!empty($_REQUEST['URL'.$i]) and !empty($_REQUEST['USER'.$i])){ 26 | 27 | // Set pool data 28 | // Avoid empty pool passwords because it might be problematic if used in a command 29 | $dataPools[] = array( 30 | "url" => $_REQUEST['URL'.$i], 31 | "user" => $_REQUEST['USER'.$i], 32 | "pass" => empty($_REQUEST['PASS'.$i])?"none":$_REQUEST['PASS'.$i] 33 | ); 34 | 35 | 36 | $e = 0; 37 | } 38 | else{ 39 | 40 | $e++; 41 | } 42 | 43 | 44 | } 45 | 46 | $written = 0; 47 | 48 | // Recode into JSON and save 49 | // Never save if no pools given 50 | if (!empty($dataPools)) { 51 | // Read current config, prefer miner.user.conf 52 | if(file_exists("/opt/minepeon/etc/miner.user.conf")){ 53 | $data = json_decode(file_get_contents("/opt/minepeon/etc/miner.user.conf", true), true); 54 | } 55 | else{ 56 | $data = json_decode(file_get_contents("/opt/minepeon/etc/miner.conf", true), true); 57 | } 58 | // Unset currect 59 | unset($data['pools']); 60 | // Set new pool data 61 | $data['pools']=$dataPools; 62 | //CG and BFG miner api setting 63 | $data['api-allow'] = "127.0.0.1"; 64 | $data['api-listen'] = true; 65 | $data['api-allow'] = "W:127.0.0.1"; 66 | // Write back to file 67 | $written = file_put_contents("/opt/minepeon/etc/miner.conf", json_encode($data, JSON_PRETTY_PRINT)); 68 | $written = file_put_contents("/opt/minepeon/etc/miner.user.conf", json_encode($data, JSON_PRETTY_PRINT)); 69 | 70 | 71 | } 72 | 73 | echo json_encode(array('success' => true, 'written' => $written, 'pools' => $dataPools)); 74 | ?> 75 | -------------------------------------------------------------------------------- /http/lang/no/lang.no.php: -------------------------------------------------------------------------------- 1 | 87 | -------------------------------------------------------------------------------- /share/doc/bfgminer/rpc-examples/api-example.php: -------------------------------------------------------------------------------- 1 | 0) 71 | { 72 | $items = explode(',', $obj); 73 | $item = $items[0]; 74 | $id = explode('=', $items[0], 2); 75 | if (count($id) == 1 or !ctype_digit($id[1])) 76 | $name = $id[0]; 77 | else 78 | $name = $id[0].$id[1]; 79 | 80 | if (strlen($name) == 0) 81 | $name = 'null'; 82 | 83 | if (isset($data[$name])) 84 | { 85 | $num = 1; 86 | while (isset($data[$name.$num])) 87 | $num++; 88 | $name .= $num; 89 | } 90 | 91 | $counter = 0; 92 | foreach ($items as $item) 93 | { 94 | $id = explode('=', $item, 2); 95 | if (count($id) == 2) 96 | $data[$name][$id[0]] = $id[1]; 97 | else 98 | $data[$name][$counter] = $id[0]; 99 | 100 | $counter++; 101 | } 102 | } 103 | } 104 | 105 | return $data; 106 | } 107 | 108 | return null; 109 | } 110 | # 111 | if (isset($argv) and count($argv) > 1) 112 | $r = request($argv[1]); 113 | else 114 | $r = request('summary'); 115 | # 116 | echo print_r($r, true)."\n"; 117 | # 118 | ?> 119 | -------------------------------------------------------------------------------- /http/setup.php: -------------------------------------------------------------------------------- 1 | 33 | 34 |
35 | 36 | 37 | 38 | 54 | 55 |
56 |
57 | 58 | 62 |
Password did not match
63 | 67 | 83 | 84 |
85 | 86 | 91 | 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /http/ajax/status.php: -------------------------------------------------------------------------------- 1 | 0) 22 | { 23 | $ret .= "$days day "; 24 | } 25 | 26 | /*** get the hours ***/ 27 | $hours = (intval($seconds) / 3600) % 24; 28 | if($hours > 0) 29 | { 30 | $ret .= "$hours hr "; 31 | } 32 | 33 | /*** get the minutes ***/ 34 | $minutes = (intval($seconds) / 60) % 60; 35 | if($minutes > 0) 36 | { 37 | $ret .= "$minutes min "; 38 | } 39 | 40 | /*** get the seconds ***/ 41 | $seconds = intval($seconds) % 60; 42 | if ($seconds > 0) { 43 | $ret .= "$seconds sec"; 44 | } 45 | 46 | return $ret; 47 | } 48 | ?> 49 |
50 |
51 |
52 |
53 |
°C | °F
54 |
55 |
[1 min]
56 |
[5 min]
57 |
[15 min]
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 | -------------------------------------------------------------------------------- /http/lang/en/lang.en.php: -------------------------------------------------------------------------------- 1 | 91 | -------------------------------------------------------------------------------- /http/about.php: -------------------------------------------------------------------------------- 1 | 8 |
9 |
10 | About 11 | 12 | Donate to 12Ui8w9q6eq6TxZmow8H9VHbZdfEnsLDsB 13 |
Peon's in feudal times were indentured vassals, often assigned dangerous, tedious and unpleasant work, like mining.MineForeman
14 |
15 | 16 |
17 |
18 | Contact 19 | 20 |
You can contact Neil directly at;-
21 |
22 |
23 |
Facebook
24 |
Twitter
25 |
LinkedIn
26 |
27 |
28 |
Neil Fincham
29 |
MineForeman
30 |
Phone: +64 21 545 583
31 |
C/O Integral LTD, 99 Sala St, Rotorua, New Zealand. 3010
32 | 33 |
34 |
35 |
36 | 37 |
38 |
39 |
40 | 41 | 42 |
43 | 51 |
52 |
53 | 54 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 |
PrGWAccRejDiscDiff1DAccDRejDLast
"; 41 | 42 | function poolsTable($pools) { 43 | 44 | // class="success" error warning info 45 | 46 | $poolID = 0; 47 | 48 | $table = ""; 49 | 50 | array_sort_by_column($pools, 'Priority'); 51 | 52 | foreach ($pools as $pool) { 53 | 54 | if ($pool['Status'] <> "Alive") { 55 | 56 | $rowclass = 'error'; 57 | 58 | } else { 59 | 60 | $rowclass = 'success'; 61 | 62 | } 63 | 64 | $poolURL = explode(":", str_replace("/", "", $pool['URL'])); 65 | 66 | $table = $table . " 67 | 68 | "; 69 | if($poolID != 0) { 70 | $table = $table . "
"; 71 | } 72 | $table = $table . " 73 | " . $poolURL[1] . " 74 | " . $pool['User'] . " 75 | " . $pool['Status'] . " 76 | " . $pool['Priority'] . " 77 | " . $pool['Getworks'] . " 78 | " . $pool['Accepted'] . " 79 | " . $pool['Rejected'] . " 80 | " . $pool['Discarded'] . " 81 | " . date('H:i:s', $pool['LastShareTime']) . " 82 | " . $pool['Diff1Shares'] . " 83 | " . round($pool['DifficultyAccepted']) . " [" . (!$pool['Diff1Shares'] == 0 ? round(($pool['DifficultyAccepted'] / $pool['Diff1Shares']) * 100) : 0) . "%] 84 | " . round($pool['DifficultyRejected']) . " [" . (!$pool['Diff1Shares'] == 0 ? round(($pool['DifficultyRejected'] / $pool['Diff1Shares']) * 100) : 0) . "%] 85 | " . round($pool['LastShareDifficulty'], 0) . " 86 | " . $pool['BestShare'] . " 87 | "; 88 | $poolID++; 89 | } 90 | 91 | return $table; 92 | 93 | } 94 | ?> 95 | -------------------------------------------------------------------------------- /http/login.php: -------------------------------------------------------------------------------- 1 | 30 | 31 | 76 | 77 | 78 | 79 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /include/libblkmaker-0.1/blktemplate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Luke Dashjr 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the standard MIT license. See COPYING for more details. 6 | */ 7 | 8 | #ifndef BLKTEMPLATE_H 9 | #define BLKTEMPLATE_H 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | typedef uint32_t blkheight_t; 16 | typedef uint32_t libblkmaker_hash_t[8]; 17 | typedef libblkmaker_hash_t blkhash_t; 18 | typedef libblkmaker_hash_t txnhash_t; 19 | typedef uint32_t blktime_t; 20 | typedef int16_t blktime_diff_t; 21 | typedef uint32_t blknonce_t; 22 | 23 | struct blktxn_t { 24 | unsigned char *data; 25 | size_t datasz; 26 | txnhash_t *hash; 27 | 28 | signed long dependcount; 29 | unsigned long *depends; 30 | 31 | uint64_t fee; 32 | bool required; 33 | int16_t sigops; 34 | }; 35 | 36 | // BIP 23: Long Polling 37 | struct blktmpl_longpoll_req { 38 | char *id; 39 | char *uri; 40 | }; 41 | 42 | 43 | typedef enum { 44 | GBT_CBTXN = 1 << 0, 45 | GBT_CBVALUE = 1 << 1, 46 | GBT_WORKID = 1 << 2, 47 | 48 | GBT_LONGPOLL = 1 << 3, // BIP 22: Long Polling 49 | GBT_PROPOSAL = 1 << 4, // BIP 23: Block Proposal 50 | GBT_SERVICE = 1 << 5, // BIP 23: Logical Services 51 | 52 | // BIP 23: Mutations 53 | BMM_CBAPPEND = 1 << 0x10, 54 | BMM_CBSET = 1 << 0x11, 55 | BMM_GENERATE = 1 << 0x12, 56 | BMM_TIMEINC = 1 << 0x13, 57 | BMM_TIMEDEC = 1 << 0x14, 58 | BMM_TXNADD = 1 << 0x15, 59 | BMM_PREVBLK = 1 << 0x16, 60 | BMM_VERFORCE = 1 << 0x17, 61 | BMM_VERDROP = 1 << 0x18, 62 | 63 | // BIP 23: Submission Abbreviation 64 | BMA_TXNHASH = 1 << 0x19, 65 | BMAb_COINBASE = 1 << 0x1a, 66 | BMAb_TRUNCATE = 1 << 0x1b, 67 | BMAs_COINBASE = 1 << 0x1c, 68 | BMAs_MERKLE = 1 << 0x1d, 69 | BMAs_TRUNCATE = 1 << 0x1e, 70 | } gbt_capabilities_t; 71 | #define GBT_CAPABILITY_COUNT (0x1f) 72 | 73 | extern const char *blktmpl_capabilityname(gbt_capabilities_t); 74 | #define BLKTMPL_LONGEST_CAPABILITY_NAME (16) 75 | extern gbt_capabilities_t blktmpl_getcapability(const char *); 76 | 77 | 78 | typedef gbt_capabilities_t blkmutations_t; 79 | 80 | typedef struct { 81 | uint32_t version; 82 | unsigned char diffbits[4]; 83 | blkheight_t height; 84 | blkhash_t prevblk; 85 | 86 | unsigned short sigoplimit; 87 | unsigned long sizelimit; 88 | 89 | unsigned long txncount; 90 | struct blktxn_t *txns; 91 | struct blktxn_t *cbtxn; 92 | uint64_t cbvalue; 93 | 94 | time_t _time_rcvd; 95 | blktime_t curtime; 96 | char auxcount; 97 | char **auxnames; 98 | unsigned char **auxdata; 99 | 100 | char *workid; 101 | 102 | // BIP 22: Long Polling 103 | struct blktmpl_longpoll_req lp; 104 | bool submitold; 105 | 106 | // BIP 23: Basic Pool Extensions 107 | int16_t expires; 108 | blkhash_t target; 109 | 110 | // BIP 23: Mutations 111 | blkmutations_t mutations; 112 | blktime_t maxtime; 113 | blktime_diff_t maxtimeoff; 114 | blktime_t mintime; 115 | blktime_diff_t mintimeoff; 116 | blknonce_t minnonce; 117 | blknonce_t maxnonce; 118 | 119 | // TEMPORARY HACK 120 | libblkmaker_hash_t _mrklroot; 121 | unsigned int next_dataid; 122 | } blktemplate_t; 123 | 124 | extern blktemplate_t *blktmpl_create(); 125 | extern gbt_capabilities_t blktmpl_addcaps(const blktemplate_t *); 126 | extern const struct blktmpl_longpoll_req *blktmpl_get_longpoll(blktemplate_t *); 127 | extern bool blktmpl_get_submitold(blktemplate_t *tmpl); 128 | extern void blktmpl_free(blktemplate_t *); 129 | 130 | #endif 131 | -------------------------------------------------------------------------------- /http/update.php: -------------------------------------------------------------------------------- 1 | 7 | 8 | 10 | 11 | 12 | Updating System 13 | 14 | 15 | 33 | 34 | 35 | 36 |
37 |
38 |
39 | 40 | 41 | 42 | 43 | 48 | document.getElementById("update").innerHTML="

Downloading...

"; 49 | document.getElementById("image").innerHTML=""; 50 | '; 51 | echo str_repeat(' ',1024*64); 52 | flush(); 53 | sleep(5); 54 | exec('git fetch origin ' . $settings['updatebranch'] . ' 2>&1', $outputa); 55 | foreach ($outputa as $outputb) { 56 | $output = $output . $outputb; 57 | } 58 | if(substr($output,0,3) == 'err') 59 | { 60 | $error = "yes"; 61 | echo ''; 68 | echo str_repeat(' ',1024*64); 69 | flush(); 70 | exec('git merge origin/' . $settings['updatebranch'] . ' 2>&1', $outputa2); 71 | foreach ($outputa2 as $outputb2) { 72 | $output2 = $output2 . $outputb2; 73 | } 74 | if(substr($output2,0,3) == 'err') 75 | { 76 | $error = "yes"; 77 | echo ''; 87 | }else{ 88 | echo ''; 92 | $settings['update'] = "false"; 93 | $settings['updatebranch'] = "null"; 94 | writeSettings($settings); 95 | exec('/usr/bin/sudo /usr/bin/reboot > /dev/null 2>&1 &'); 96 | } 97 | }else{ 98 | echo ''; 102 | } 103 | ?> 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /http/index.php: -------------------------------------------------------------------------------- 1 | Graph error: ".rrd_error()."\n"; 29 | } 30 | } 31 | 32 | 33 | 34 | if (isset($_POST['url'])) { 35 | 36 | $pools = miner('pools','')['POOLS']; 37 | $pool = 0; 38 | foreach ($pools as $key => $value) { 39 | if(isset($value['User']) && $value['URL']==$_POST['url']){ 40 | miner('switchpool',$pool); 41 | } 42 | $pool = $pool + 1; 43 | } 44 | 45 | } 46 | 47 | include('head.php'); 48 | ?> 49 | 51 | 60 | 63 | 64 |
65 |

Status

66 | 69 |

70 | mhsav.png 71 | mhsav.png
72 | Display extended charts 73 |

74 |

75 | mhsav.png 76 | mhsav.png 77 |

78 |

79 | mhsav.png 80 |

81 | 84 |

Graphs not ready yet

85 |

Please wait upto 5 minutes

86 | 89 | 90 |
91 | 92 |
93 | 94 | 95 | 96 |
97 |

98 | 99 |
100 | 101 | 102 |

103 |
104 | "; 108 | print_r($pools['POOLS']); 109 | print_r($devs); 110 | echo "
";
111 | 	
112 |   }
113 |   ?>
114 | 
115 | 
116 | 131 | No devices running"; 15 | }else{ 16 | 17 | $devices = 0; 18 | $MHSav = 0; 19 | $Accepted = 0; 20 | $Rejected = 0; 21 | $HardwareErrors = 0; 22 | $Utility = 0; 23 | 24 | $tableRow = ' 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | '; 39 | 40 | $hwErrorPercent = 0; 41 | $DeviceRejected = 0; 42 | 43 | foreach ($devs as $dev) { 44 | 45 | // Sort out valid deceives 46 | 47 | $validDevice = true; 48 | 49 | if(!isset($dev['MHS5s'])) { 50 | $dev['MHS5s'] = 0; 51 | } 52 | 53 | if(!isset($dev['MHS20s'])) { 54 | $dev['MHS20s'] = 0; 55 | } 56 | 57 | 58 | if (!$dev['MHS5s'] > 1 || !$dev['MHS20s'] > 1) { 59 | // not mining, not a valid device 60 | $validDevice = false; 61 | } 62 | 63 | //if ((time() - $dev['LastShareTime']) > 1000) { 64 | // // Only show devices that have returned a share in the past 5 minutes 65 | // $validDevice = false; 66 | //} 67 | 68 | if (isset($dev['Temperature'])) { 69 | $temperature = $dev['Temperature']; 70 | } else { 71 | $temperature = "N/A"; 72 | } 73 | 74 | if ($dev['MHSav'] > 999){ 75 | $hrate = $dev['MHSav'] / 1000; 76 | $hrate = number_format((float)$hrate, 2, '.', ''); 77 | $hrate = $hrate . " GH/s"; 78 | }else{ 79 | $hrate = $dev['MHSav'] . " MH/s"; 80 | } 81 | 82 | if ($validDevice) { 83 | 84 | if ($dev['DeviceHardware%'] >= 10 || $dev['DeviceRejected%'] > 5) { 85 | $tableRow = $tableRow . ""; 86 | } else { 87 | $tableRow = $tableRow . ""; 88 | } 89 | 90 | $tableRow = $tableRow . " 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | "; 100 | 101 | $devices++; 102 | $MHSav = $MHSav + $dev['MHSav']; 103 | $Accepted = $Accepted + $dev['Accepted']; 104 | $Rejected = $Rejected + $dev['Rejected']; 105 | $HardwareErrors = $HardwareErrors + $dev['HardwareErrors']; 106 | $DeviceRejected = $DeviceRejected + $dev['DeviceRejected%']; 107 | $hwErrorPercent = $hwErrorPercent + $dev['DeviceHardware%']; 108 | $Utility = $Utility + $dev['Utility']; 109 | 110 | 111 | 112 | } 113 | } 114 | 115 | if ($MHSav > 999){ 116 | $hrateT = $MHSav / 1000; 117 | $hrateT = number_format((float)$hrateT, 2, '.', ''); 118 | $hrateT = $hrateT . " GH/s"; 119 | }else{ 120 | $hrateT = $MHSav . " MH/s"; 121 | } 122 | $GLOBALS['G_MHSav'] = $hrateT . "|" . $devices . " DEV"; 123 | $totalShares = $Accepted + $Rejected + $HardwareErrors; 124 | $tableRow = $tableRow . " 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 |
NameIDTempHash RateAcceptRejectErrorUtilityLast Share
" . $dev['Name'] . "" . $dev['ID'] . "" . $temperature . "" . $hrate . "" . $dev['Accepted'] . "" . $dev['Rejected'] . " [" . round($dev['DeviceRejected%'], 2) . "%]" . $dev['HardwareErrors'] . " [" . round($dev['DeviceHardware%'], 2) . "%]" . $dev['Utility'] . "" . date('H:i:s', $dev['LastShareTime']) . "
Totals" . $devices . "" . $hrateT . "" . $Accepted . "" . $Rejected . " [" . round(($DeviceRejected / $devices), 2) . "%]" . $HardwareErrors . " [" . round(($hwErrorPercent / $devices), 2) . "%]" . $Utility . "
141 | "; 142 | echo $tableRow; 143 | } 144 | ?> 145 | -------------------------------------------------------------------------------- /http/pools.php: -------------------------------------------------------------------------------- 1 | 13 | 14 |
15 |

WARNING: There is very little validation on these settings at the moment so make sure your settings are correct!

16 |

Pools

17 |

MinePeon will use the following pools. Change it to your mining accounts or leave it to donate.

18 |
19 | 20 | 25 |
26 |
27 | 28 | 29 |
30 |
31 | 32 | 33 |
34 |
35 | 36 | 37 |
38 |
39 | 45 | 46 |
47 |
48 | 49 | 50 |
51 |
52 | 53 | 54 |
55 |
56 | 57 | 58 |
59 |
60 | 63 |

After saving, the miner will restart with the new configuration. This takes about 10 seconds.

64 |

65 |

66 |
67 |
68 | 71 | 72 | -------------------------------------------------------------------------------- /http/css/bootstrap-minepeon.css: -------------------------------------------------------------------------------- 1 | 2 | /* Structure */ 3 | body{ 4 | padding-bottom: 50px; 5 | } 6 | 7 | /* Navbar */ 8 | .navbar-nav > li > a:hover, .navbar-nav > li > a:focus{ 9 | background: #fff; 10 | } 11 | 12 | /* About / Nicer quote */ 13 | blockquote { 14 | font-family: Georgia, serif; 15 | font-size: 14px; 16 | font-style: italic; 17 | width: 500px; 18 | margin: 0.25em 0; 19 | padding: 0.25em 40px; 20 | line-height: 1.45; 21 | position: relative; 22 | color: #383838; 23 | } 24 | 25 | blockquote:before { 26 | display: block; 27 | content: "\201C"; 28 | font-size: 80px; 29 | position: absolute; 30 | left: -20px; 31 | top: -20px; 32 | color: #7a7a7a; 33 | } 34 | 35 | blockquote cite { 36 | color: #999999; 37 | font-size: 14px; 38 | display: block; 39 | margin-top: 5px; 40 | } 41 | 42 | blockquote cite:before { 43 | content: "\2014 \2009"; 44 | } 45 | 46 | /* Status tables */ 47 | td,th{ 48 | white-space: nowrap; 49 | } 50 | #stats td,#stats th,#pools td,#pools th{ 51 | text-align: center 52 | } 53 | .table-right td,.table-right tfoot th{ 54 | text-align: right 55 | } 56 | .table-right td.text-left,.table-right tfoot th.text-left{ 57 | text-align: left 58 | } 59 | .table>tbody>tr>td { 60 | border: 1px solid #ddd; 61 | } 62 | 63 | /* Advanced / Mute unselected filenames */ 64 | .muted { 65 | color: rgb(153, 153, 153); 66 | } 67 | 68 | /* Advanced / Statusbar */ 69 | .statusbar{ 70 | margin-top: -20px; 71 | background: #d5d5d5; 72 | padding: 5px; 73 | position: relative; 74 | z-index: 9 75 | } 76 | .statusbar span.btn { 77 | cursor: text; 78 | min-width: 100px; 79 | display: inline-block; 80 | -webkit-transition:background 2s,width 20s; 81 | transition:background 2s,width 20s; 82 | } 83 | .statusbar span.btn small { 84 | font-size: 75%; 85 | } 86 | .statusbar span.btn span { 87 | display: inline-block; 88 | font-weight: bold; 89 | } 90 | .statusbar form{ 91 | margin-top: 20px; 92 | } 93 | 94 | /* Advanced / Miner (is part of next bootstrap) */ 95 | .form-control-static { 96 | padding-top: 8px; 97 | margin-bottom: 0; 98 | } 99 | .minerform .form-group{ 100 | margin-bottom: 5px; 101 | } 102 | 103 | /* Advanced / Settings */ 104 | input:required:invalid{ 105 | border-color: rgb(233, 50, 45); 106 | box-shadow: 0px 0px 6px rgb(248, 185, 183); 107 | color: rgb(185, 74, 72); 108 | border-color: rgb(238, 95, 91); 109 | } 110 | 111 | /* Advanced / Settings component */ 112 | .peon-settings{ 113 | float:right; 114 | white-space: nowrap; 115 | } 116 | .peon-less,.peon-more{ 117 | display: inline-block; 118 | } 119 | .peon-more{ 120 | visibility: hidden; 121 | } 122 | .peon-trigger:hover .peon-more{ 123 | visibility: visible; 124 | } 125 | 126 | /* Advanced / Settings component / buttons */ 127 | .btn-peon { 128 | background: none; 129 | } 130 | .btn-peon:hover,.btn-peon:focus{ 131 | background: #bbb; 132 | color: inherit; 133 | } 134 | 135 | /* Advanced / Alerts */ 136 | .peon-alerts { 137 | position: relative; 138 | z-index: 2; 139 | background: #d5d5d5; 140 | border-radius: 0 0 4px 4px; 141 | padding-left: 50%; 142 | height:0; 143 | max-height:0; 144 | padding-top: 1px; 145 | margin-top: -1px; 146 | } 147 | .peon-alerts > div{ 148 | padding: 0 1em; 149 | line-height: 3em 150 | } 151 | .peon-alerts > div:last-child { 152 | border-radius: 0 0 4px 4px; 153 | } 154 | .peon-alerts .alert-top { 155 | position: relative; 156 | top:0; 157 | -webkit-transition: margin 1s,top 1s; 158 | -moz-transition: margin 1s,top 1s; 159 | -ms-transition: margin 1s,top 1s; 160 | -o-transition: margin 1s,top 1s; 161 | transition: margin 1s,top 1s; 162 | } 163 | .peon-alerts .alert-dismiss { 164 | top:-3em; 165 | margin-bottom: -3em!important 166 | } 167 | 168 | /* Index / Shorten wide values in tables and show them on hover */ 169 | .ellipsis{ 170 | overflow: hidden; 171 | text-overflow: ellipsis; 172 | -o-text-overflow: ellipsis; 173 | white-space: nowrap; 174 | max-width: 80px; 175 | } 176 | .ellipsis:hover{ 177 | overflow: visible; 178 | max-width:none; 179 | width:auto; 180 | background-color: #fff!important; 181 | } 182 | 183 | /* Tablesorter */ 184 | table.tablesorter thead th{ 185 | padding-right: 16px 186 | } 187 | table.tablesorter thead tr .header { 188 | background-image: url(bg.gif); 189 | background-repeat: no-repeat; 190 | background-position: center right; 191 | cursor: pointer; 192 | } 193 | table.tablesorter thead tr .headerSortUp { 194 | background-image: url(asc.gif); 195 | } 196 | table.tablesorter thead tr .headerSortDown { 197 | background-image: url(desc.gif); 198 | } 199 | 200 | .btn-file { 201 | position: relative; 202 | overflow: hidden; 203 | } 204 | .btn-file input[type=file] { 205 | position: absolute; 206 | top: 0; 207 | right: 0; 208 | min-width: 100%; 209 | min-height: 100%; 210 | font-size: 999px; 211 | text-align: right; 212 | filter: alpha(opacity=0); 213 | opacity: 0; 214 | background: red; 215 | cursor: inherit; 216 | display: block; 217 | } -------------------------------------------------------------------------------- /http/plugins.php: -------------------------------------------------------------------------------- 1 | run_sh_file !== "False"){ 13 | exec("/opt/minepeon/http/instal_temp/" . $plugin->run_sh_file); 14 | rrmdir('instal_temp'); 15 | if ($plugin->redirect_after != "False"){ 16 | header( 'Location: /plugins/' . $plugin->redirect_after ) ; 17 | } 18 | } 19 | } 20 | } 21 | 22 | if (isset($_POST["wget"])) { 23 | exec("wget -P /opt/minepeon/http/ -O Tmpfile.tar.gz " . $_POST["wget"]); 24 | exec("tar -xzf /opt/minepeon/http/Tmpfile.tar.gz -C /opt/minepeon/ "); 25 | unlink('Tmpfile.tar.gz'); 26 | if (is_dir("instal_temp")) { 27 | $plugin=simplexml_load_file("instal_temp/instal.xml"); 28 | if ($plugin->run_sh_file !== "False"){ 29 | exec("/opt/minepeon/http/instal_temp/" . $plugin->run_sh_file); 30 | rrmdir('instal_temp'); 31 | if ($plugin->redirect_after != "False"){ 32 | header( 'Location: /plugins/' . $plugin->redirect_after ) ; 33 | } 34 | } 35 | } 36 | } 37 | 38 | if (isset($_POST['delpl'])) { 39 | $delpl = $_POST['delpl']; 40 | list($delpl1,$delpl2) = explode('/', $delpl, 2); 41 | if (file_exists($delpl . "/uninstal.xml")){ 42 | $plugin=simplexml_load_file($delpl . "/uninstal.xml"); 43 | exec("/opt/minepeon/http/" . $delpl . "/" . $plugin->run_sh_file); 44 | } 45 | rrmdir($_POST['delpl']); 46 | 47 | 48 | 49 | unlink('plugins/api_menu/' . $delpl2 . '_apimenu.xml'); 50 | header('Location: /plugins.php'); 51 | } 52 | 53 | 54 | 55 | function rrmdir($dir) { 56 | if (is_dir($dir)) { 57 | $objects = scandir($dir); 58 | foreach ($objects as $object) { 59 | if ($object != "." && $object != "..") { 60 | if (filetype($dir."/".$object) == "dir") 61 | rrmdir($dir."/".$object); 62 | else unlink ($dir."/".$object); 63 | } 64 | } 65 | reset($objects); 66 | rmdir($dir); 67 | } 68 | } 69 | 70 | 71 | include('head.php'); 72 | include('menu.php'); 73 | 74 | ?> 75 |
76 | 77 | 78 |

Plugins

79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 105 | 106 | 107 | 108 | 109 | 110 | 117 | 118 | 119 | 120 | 121 | 128 | 129 | 130 |
NameMade byDescriptionSettingsDelete
name; ?>maker; ?>description; ?>settings . '">Settins'; ?> 111 |
112 | 113 | 114 |
115 | 116 |
131 | 132 |
133 |
134 | Install plugin 135 | 136 |
137 |
138 | 139 |
140 |
141 |
142 |
143 | 144 |
145 |
146 |
147 |
148 | 149 | 150 |
151 |
152 | Install plugin from web 153 | 154 |
155 | 156 |
157 | 158 |
159 |
160 |
161 |
162 | 163 |
164 |
165 |
166 |
167 | 168 | 169 | Click and install 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | pl as $pli) { 184 | 185 | ?> 186 | 187 | 188 | 189 | 190 | 197 | 198 | 199 | 202 | 203 |
NameMade byDescriptionInstall
name; ?>maker; ?>description; ?> 191 |
192 | 193 | 194 |
195 | 196 |
204 | 205 |
206 | 207 | 208 | $settings['alertSmtp'] 85 | ); 86 | 87 | if ($settings['alertSMTPAuth']) { 88 | $mailSettings['auth'] = true; 89 | $mailSettings['username'] = $settings['alertSmtpAuthUser']; 90 | $mailSettings['password'] = $settings['alertSmtpAuthPass']; 91 | $mailSettings['port'] = $settings['alertSmtpAuthPort']; 92 | } 93 | 94 | //$settings['alertDevice'] 95 | 96 | $mail = Mail::factory("smtp", $mailSettings ); 97 | 98 | $headers = array("From"=>$settings['alertEmail'], "Subject"=>$subject); 99 | $mail->send($settings['alertEmail'], $headers, $body); 100 | 101 | } 102 | 103 | function array_sort_by_column(&$arr, $col, $dir = SORT_ASC) { 104 | $sort_col = array(); 105 | foreach ($arr as $key=> $row) { 106 | $sort_col[$key] = $row[$col]; 107 | } 108 | 109 | array_multisort($sort_col, $dir, $arr); 110 | } 111 | 112 | // https://www.owasp.org/index.php/PHP_CSRF_Guard 113 | 114 | function store_in_session($key,$value) 115 | { 116 | if (isset($_SESSION)) 117 | { 118 | $_SESSION[$key]=$value; 119 | } 120 | } 121 | function unset_session($key) 122 | { 123 | $_SESSION[$key]=' '; 124 | unset($_SESSION[$key]); 125 | } 126 | function get_from_session($key) 127 | { 128 | if (isset($_SESSION)) 129 | { 130 | return $_SESSION[$key]; 131 | } 132 | else { return false; } //no session data, no CSRF risk 133 | } 134 | 135 | function csrfguard_generate_token($unique_form_name) 136 | { 137 | if (function_exists("hash_algos") and in_array("sha512",hash_algos())) 138 | { 139 | $token=hash("sha512",mt_rand(0,mt_getrandmax())); 140 | } 141 | else 142 | { 143 | $token=' '; 144 | for ($i=0;$i<128;++$i) 145 | { 146 | $r=mt_rand(0,35); 147 | if ($r<26) 148 | { 149 | $c=chr(ord('a')+$r); 150 | } 151 | else 152 | { 153 | $c=chr(ord('0')+$r-26); 154 | } 155 | $token.=$c; 156 | } 157 | } 158 | store_in_session($unique_form_name,$token); 159 | return $token; 160 | } 161 | function csrfguard_validate_token($unique_form_name,$token_value) 162 | { 163 | $token=get_from_session($unique_form_name); 164 | if ($token===false) 165 | { 166 | return true; 167 | } 168 | elseif ($token===$token_value) 169 | { 170 | $result=true; 171 | } 172 | else 173 | { 174 | $result=false; 175 | } 176 | unset_session($unique_form_name); 177 | return $result; 178 | } 179 | 180 | function csrfguard_replace_forms($form_data_html) 181 | { 182 | $count=preg_match_all("/(.*?)<\\/form>/is",$form_data_html,$matches,PREG_SET_ORDER); 183 | if (is_array($matches)) 184 | { 185 | foreach ($matches as $m) 186 | { 187 | if (strpos($m[1],"nocsrf")!==false) { continue; } 188 | $name="CSRFGuard_".mt_rand(0,mt_getrandmax()); 189 | $token=csrfguard_generate_token($name); 190 | $form_data_html=str_replace($m[0], 191 | " 192 | 193 | {$m[2]}",$form_data_html); 194 | } 195 | } 196 | return $form_data_html; 197 | } 198 | 199 | function csrfguard_inject() 200 | { 201 | $data=ob_get_clean(); 202 | $data=csrfguard_replace_forms($data); 203 | echo $data; 204 | } 205 | 206 | function csrfguard_start() 207 | { 208 | if (count($_POST)) 209 | { 210 | if ( !isset($_POST['CSRFName']) or !isset($_POST['CSRFToken']) ) 211 | { 212 | trigger_error("No CSRFName found, probable invalid request.",E_USER_ERROR); 213 | } 214 | $name =$_POST['CSRFName']; 215 | $token=$_POST['CSRFToken']; 216 | if (!csrfguard_validate_token($name, $token)) 217 | { 218 | trigger_error("Invalid CSRF token.",E_USER_ERROR); 219 | } 220 | } 221 | ob_start(); 222 | /* adding double quotes for "csrfguard_inject" to prevent: 223 | Notice: Use of undefined constant csrfguard_inject - assumed 'csrfguard_inject' */ 224 | register_shutdown_function("csrfguard_inject"); 225 | } 226 | -------------------------------------------------------------------------------- /share/doc/bfgminer/HACKING: -------------------------------------------------------------------------------- 1 | Driver API 2 | ========== 3 | 4 | NOTE: This API is subject to change. It is recommended that you submit your 5 | driver, even if obscure, to the mainline BFGMiner codebase so that it will be 6 | updated when the API changes. 7 | 8 | BFGMiner defines 3 different units that drivers can use: 9 | - "Device" is a logical unit used for mining. It is represented by its first 10 | processor's `struct cgpu_info`. Example: ButterFly Labs MiniRig SC. 11 | - "Processor" is a logical work processing unit. It is represented by a `struct 12 | cgpu_info` and one or more `struct thr_info`. Example: a single board within 13 | ButterFly Labs MiniRig SC. 14 | - "Thread" is a sequence of instructions and stack that manages hashing on one 15 | or more Processors within a single Device. It is represented by a `struct 16 | thr_info`. 17 | 18 | It should be noted that while every Processor has a `struct thr_info`, this may 19 | not represent the same Thread which is managing hashing on the Processor. 20 | Instead, this `struct thr_info` is only used to store status information needed 21 | for the Processor, and is maintained by the managing Thread in addition to its 22 | own `struct thr_info`. New drivers are encouraged to use an asynchronous model 23 | to manage as many Processors as possible within a single Thread. 24 | 25 | struct device_drv basics 26 | ------------------------ 27 | 28 | Every driver defines a `struct device_drv`. The `dname` field contains a 29 | short name of the driver. This should consist only of lowercase alphabetic 30 | characters, and be the same name used in the source file: driver-foobar.c 31 | defines `dname` "foobar". The `name` field contains a three-letter abbreviation 32 | for the device, used in the representation of devices. For example, `dname` 33 | "FOO" would result in devices represented as "FOO 0", "FOO 1", etc and 34 | processors represented as "FOO 0a", "FOO 0b", etc. 35 | 36 | Drivers must define a function `drv_detect`, which is run at startup to detect 37 | devices. For each device (note: NOT each processor), it should allocate a 38 | `struct cgpu_info`, set some basic parameters on it, and call the `add_cgpu` 39 | function with it as an argument. Various values you can initialize are: 40 | .drv This MUST be set to your driver's `struct device_drv`! 41 | .deven Should be set to DEV_ENABLED 42 | .procs Number of Processors for this device 43 | .threads Number of threads your device needs - should be either a 44 | multiple of .procs (threads will be allocated to each 45 | Processor), or one (a single thread will be allocated only to 46 | the Device, to manage all Processors) 47 | .name Null-terminated name of the device itself 48 | `drv_detect` should return the total number of devices created. It should leave 49 | the device in an unused state, as the user may opt to delete it outright. 50 | 51 | Threads 52 | ------- 53 | 54 | The first interaction BFGMiner will have with a device is by calling the 55 | driver's `thread_prepare` function for each Thread. This occurs while BFGMiner 56 | is still in a single-threaded state, before any Threads have actually started 57 | running independently. It should do only the minimal initialization necessary 58 | to proceed, and return true iff successful. 59 | 60 | Once all the Threads are setup, BFGMiner starts them off by calling the 61 | `thread_init` function. This should do all initialization that can occur in 62 | parallel with other Threads. 63 | 64 | The driver should specify a `minerloop` to use. For the purposes of this 65 | document, it is assumed you will be using `minerloop_async`. Please note that 66 | the default is currently `minerloop_scanhash`, and much of the documentation 67 | here will NOT work with this `minerloop`. 68 | 69 | Processors 70 | ---------- 71 | 72 | Processors work with `struct work` objects, which each represent a block header 73 | to find a solution for. Before your driver sees a `struct work`, it will be 74 | passed to the function `prepare_work` with pointers to the Processor `struct 75 | thr_info` and the `struct work` as arguments. Most drivers do not need to do 76 | anything at this stage, so feel free to omit the `prepare_work` function. 77 | 78 | For each job, the `job_prepare` function is called in advance, with three 79 | arguments: Processor `struct thr_info *`, `struct work *`, and a `uint64_t` 80 | limiting how many nonces to check (starting from `work->blk.nonce`). Unless you 81 | implement a `can_limit_work` function, you will always receive a full nonce 82 | range from 0 to 0xffffffff. `job_prepare` increments `work->blk.nonce` to the 83 | last nonce the processor will be attempting and returns true when successful. 84 | Please note this will be called while the previous job is still executing. 85 | 86 | When it is time to actually start the new job, the `job_start` function will be 87 | called. This is given the Processor `struct thr_info *` as its only argument, 88 | and should start the job most recently prepared with `job_prepare`. Note that 89 | it is possible for `job_prepare` to be called for a job that never starts 90 | (another `job_prepare` may be executed to override the previous one instead). 91 | `job_start` must call `mt_job_transition` as soon as the actual switchover to 92 | the new job takes place, and must call `job_start_complete` when successful; 93 | in case of a failure, it should call `job_start_abort` instead. `job_start` 94 | must set `thr->tv_morework` to the time the device expects to need its next 95 | work item. It is generally advisable to set this a bit early to ensure any 96 | delays do not make it late. `job_start` is expected to always succeed and does 97 | not have a return value. 98 | 99 | Immediately before `job_start` is called to change from one job to the next, 100 | `job_get_results` will be called to fetch any volatile results from the 101 | previous job. It is provided the Processor's `struct thr_info *` and the 102 | currently executing job's `struct work *`. It should ONLY fetch the raw data 103 | for the results, and not spend any time processing or submitting it. If 104 | `job_get_results` is defined for your driver, it must (directly or indirectly) 105 | ensure `job_results_fetched` is called when complete (including the case of 106 | failure). After the new job has been started, your driver's 107 | `job_process_results` function will be called to complete the submission of 108 | these results with the same arguments, plus a bool to tell you whether the 109 | processor is being stopped. If it is, your driver must call `mt_disable_start` 110 | when it has successfully stopped hashing. 111 | 112 | Drivers may define a `poll` function. If this is defined, `thr->tv_poll` must 113 | always be set to a valid time to next execute it, for each Processor. 114 | 115 | Whenever a solution is found (at any point), the function `submit_nonce` should 116 | be called, passing the Processor `struct thr_info *`, `struct work *`, and 117 | nonce as arguments. If the solution is invalid (any of the final 32 bits of the 118 | hash are nonzero), it will be recorded as a hardware error and your driver's 119 | `hw_error` function (if one is defined) will be called. 120 | 121 | As often as results are processed, your driver should call the `hashes_done` 122 | function with a number of arguments: Processor `struct thr_info *`, count of 123 | hashes completed (including calls to `submit_nonce`), a `struct timeval *` 124 | that tells how long it took to find these hashes (usually time since the last 125 | call to `hashes_done`, and a `uint32_t *` which should usually be NULL. 126 | -------------------------------------------------------------------------------- /share/doc/bfgminer/rpc-examples/api-example.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Kano 3 | * Copyright 2013 Luke Dashjr 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License as published by the Free 7 | * Software Foundation; either version 3 of the License, or (at your option) 8 | * any later version. See COPYING for more details. 9 | */ 10 | 11 | #include "config.h" 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "compat.h" 24 | 25 | #ifndef WIN32 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #define SOCKETTYPE int 33 | #define SOCKETFAIL(a) ((a) < 0) 34 | #define INVSOCK -1 35 | #define CLOSESOCKET close 36 | 37 | #define SOCKETINIT do{}while(0) 38 | 39 | #define SOCKERRMSG strerror(errno) 40 | #else 41 | #include 42 | 43 | #define SOCKETTYPE SOCKET 44 | #define SOCKETFAIL(a) ((a) == SOCKET_ERROR) 45 | #define INVSOCK INVALID_SOCKET 46 | #define CLOSESOCKET closesocket 47 | 48 | static char WSAbuf[1024]; 49 | 50 | struct WSAERRORS { 51 | int id; 52 | char *code; 53 | } WSAErrors[] = { 54 | { 0, "No error" }, 55 | { WSAEINTR, "Interrupted system call" }, 56 | { WSAEBADF, "Bad file number" }, 57 | { WSAEACCES, "Permission denied" }, 58 | { WSAEFAULT, "Bad address" }, 59 | { WSAEINVAL, "Invalid argument" }, 60 | { WSAEMFILE, "Too many open sockets" }, 61 | { WSAEWOULDBLOCK, "Operation would block" }, 62 | { WSAEINPROGRESS, "Operation now in progress" }, 63 | { WSAEALREADY, "Operation already in progress" }, 64 | { WSAENOTSOCK, "Socket operation on non-socket" }, 65 | { WSAEDESTADDRREQ, "Destination address required" }, 66 | { WSAEMSGSIZE, "Message too long" }, 67 | { WSAEPROTOTYPE, "Protocol wrong type for socket" }, 68 | { WSAENOPROTOOPT, "Bad protocol option" }, 69 | { WSAEPROTONOSUPPORT, "Protocol not supported" }, 70 | { WSAESOCKTNOSUPPORT, "Socket type not supported" }, 71 | { WSAEOPNOTSUPP, "Operation not supported on socket" }, 72 | { WSAEPFNOSUPPORT, "Protocol family not supported" }, 73 | { WSAEAFNOSUPPORT, "Address family not supported" }, 74 | { WSAEADDRINUSE, "Address already in use" }, 75 | { WSAEADDRNOTAVAIL, "Can't assign requested address" }, 76 | { WSAENETDOWN, "Network is down" }, 77 | { WSAENETUNREACH, "Network is unreachable" }, 78 | { WSAENETRESET, "Net connection reset" }, 79 | { WSAECONNABORTED, "Software caused connection abort" }, 80 | { WSAECONNRESET, "Connection reset by peer" }, 81 | { WSAENOBUFS, "No buffer space available" }, 82 | { WSAEISCONN, "Socket is already connected" }, 83 | { WSAENOTCONN, "Socket is not connected" }, 84 | { WSAESHUTDOWN, "Can't send after socket shutdown" }, 85 | { WSAETOOMANYREFS, "Too many references, can't splice" }, 86 | { WSAETIMEDOUT, "Connection timed out" }, 87 | { WSAECONNREFUSED, "Connection refused" }, 88 | { WSAELOOP, "Too many levels of symbolic links" }, 89 | { WSAENAMETOOLONG, "File name too long" }, 90 | { WSAEHOSTDOWN, "Host is down" }, 91 | { WSAEHOSTUNREACH, "No route to host" }, 92 | { WSAENOTEMPTY, "Directory not empty" }, 93 | { WSAEPROCLIM, "Too many processes" }, 94 | { WSAEUSERS, "Too many users" }, 95 | { WSAEDQUOT, "Disc quota exceeded" }, 96 | { WSAESTALE, "Stale NFS file handle" }, 97 | { WSAEREMOTE, "Too many levels of remote in path" }, 98 | { WSASYSNOTREADY, "Network system is unavailable" }, 99 | { WSAVERNOTSUPPORTED, "Winsock version out of range" }, 100 | { WSANOTINITIALISED, "WSAStartup not yet called" }, 101 | { WSAEDISCON, "Graceful shutdown in progress" }, 102 | { WSAHOST_NOT_FOUND, "Host not found" }, 103 | { WSANO_DATA, "No host data of that type was found" }, 104 | { -1, "Unknown error code" } 105 | }; 106 | 107 | static char *WSAErrorMsg() 108 | { 109 | int i; 110 | int id = WSAGetLastError(); 111 | 112 | /* Assume none of them are actually -1 */ 113 | for (i = 0; WSAErrors[i].id != -1; i++) 114 | if (WSAErrors[i].id == id) 115 | break; 116 | 117 | sprintf(WSAbuf, "Socket Error: (%d) %s", id, WSAErrors[i].code); 118 | 119 | return &(WSAbuf[0]); 120 | } 121 | 122 | #define SOCKERRMSG WSAErrorMsg() 123 | 124 | static WSADATA WSA_Data; 125 | 126 | #define SOCKETINIT do { \ 127 | int wsa; \ 128 | if ( (wsa = WSAStartup(0x0202, &WSA_Data)) ) { \ 129 | printf("Socket startup failed: %d\n", wsa); \ 130 | return 1; \ 131 | } \ 132 | } while (0) 133 | 134 | #ifndef SHUT_RDWR 135 | #define SHUT_RDWR SD_BOTH 136 | #endif 137 | #endif 138 | 139 | #define RECVSIZE 65500 140 | 141 | static const char SEPARATOR = '|'; 142 | static const char COMMA = ','; 143 | static const char EQ = '='; 144 | static int ONLY; 145 | 146 | void display(char *buf) 147 | { 148 | char *nextobj, *item, *nextitem, *eq; 149 | int itemcount; 150 | 151 | while (buf != NULL) { 152 | nextobj = strchr(buf, SEPARATOR); 153 | if (nextobj != NULL) 154 | *(nextobj++) = '\0'; 155 | 156 | if (*buf) { 157 | item = buf; 158 | itemcount = 0; 159 | while (item != NULL) { 160 | nextitem = strchr(item, COMMA); 161 | if (nextitem != NULL) 162 | *(nextitem++) = '\0'; 163 | 164 | if (*item) { 165 | eq = strchr(item, EQ); 166 | if (eq != NULL) 167 | *(eq++) = '\0'; 168 | 169 | if (itemcount == 0) 170 | printf("[%s%s] =>\n(\n", item, (eq != NULL && isdigit(*eq)) ? eq : ""); 171 | 172 | if (eq != NULL) 173 | printf(" [%s] => %s\n", item, eq); 174 | else 175 | printf(" [%d] => %s\n", itemcount, item); 176 | } 177 | 178 | item = nextitem; 179 | itemcount++; 180 | } 181 | if (itemcount > 0) 182 | puts(")"); 183 | } 184 | 185 | buf = nextobj; 186 | } 187 | } 188 | 189 | int callapi(char *command, char *host, short int port) 190 | { 191 | size_t bufsz = RECVSIZE; 192 | char *buf = malloc(bufsz+1); 193 | struct hostent *ip; 194 | struct sockaddr_in serv; 195 | SOCKETTYPE sock; 196 | int ret = 0; 197 | int n, p; 198 | 199 | assert(buf); 200 | SOCKETINIT; 201 | 202 | ip = gethostbyname(host); 203 | if (!ip) 204 | { 205 | printf("Failed to resolve host %s\n", host); 206 | return 1; 207 | } 208 | 209 | sock = socket(AF_INET, SOCK_STREAM, 0); 210 | if (sock == INVSOCK) { 211 | printf("Socket initialisation failed: %s\n", SOCKERRMSG); 212 | return 1; 213 | } 214 | 215 | memset(&serv, 0, sizeof(serv)); 216 | serv.sin_family = AF_INET; 217 | serv.sin_addr = *((struct in_addr *)ip->h_addr); 218 | serv.sin_port = htons(port); 219 | 220 | if (SOCKETFAIL(connect(sock, (struct sockaddr *)&serv, sizeof(struct sockaddr)))) { 221 | printf("Socket connect failed: %s\n", SOCKERRMSG); 222 | return 1; 223 | } 224 | 225 | n = send(sock, command, strlen(command), 0); 226 | if (SOCKETFAIL(n)) { 227 | printf("Send failed: %s\n", SOCKERRMSG); 228 | ret = 1; 229 | } 230 | else { 231 | p = 0; 232 | buf[0] = '\0'; 233 | while (true) 234 | { 235 | if (bufsz < RECVSIZE + p) 236 | { 237 | bufsz *= 2; 238 | buf = realloc(buf, bufsz); 239 | assert(buf); 240 | } 241 | 242 | n = recv(sock, &buf[p], RECVSIZE, 0); 243 | 244 | if (SOCKETFAIL(n)) { 245 | printf("Recv failed: %s\n", SOCKERRMSG); 246 | ret = 1; 247 | break; 248 | } 249 | 250 | if (n == 0) 251 | break; 252 | 253 | p += n; 254 | buf[p] = '\0'; 255 | } 256 | 257 | if (!ONLY) 258 | printf("Reply was '%s'\n", buf); 259 | else 260 | printf("%s\n", buf); 261 | 262 | if (!ONLY) 263 | display(buf); 264 | } 265 | 266 | CLOSESOCKET(sock); 267 | 268 | return ret; 269 | } 270 | 271 | static char *trim(char *str) 272 | { 273 | char *ptr; 274 | 275 | while (isspace(*str)) 276 | str++; 277 | 278 | ptr = strchr(str, '\0'); 279 | while (ptr-- > str) { 280 | if (isspace(*ptr)) 281 | *ptr = '\0'; 282 | } 283 | 284 | return str; 285 | } 286 | 287 | int main(int argc, char *argv[]) 288 | { 289 | char *command = "summary"; 290 | char *host = "127.0.0.1"; 291 | short int port = 4028; 292 | char *ptr; 293 | int i = 1; 294 | 295 | if (argc > 1) 296 | if (strcmp(argv[1], "-?") == 0 297 | || strcmp(argv[1], "-h") == 0 298 | || strcmp(argv[1], "--help") == 0) { 299 | fprintf(stderr, "Usage: %s [command [ip/host [port]]]\n", argv[0]); 300 | return 1; 301 | } 302 | 303 | if (argc > 1) 304 | if (strcmp(argv[1], "-o") == 0) { 305 | ONLY = 1; 306 | i = 2; 307 | } 308 | 309 | if (argc > i) { 310 | ptr = trim(argv[i++]); 311 | if (strlen(ptr) > 0) 312 | command = ptr; 313 | } 314 | 315 | if (argc > i) { 316 | ptr = trim(argv[i++]); 317 | if (strlen(ptr) > 0) 318 | host = ptr; 319 | } 320 | 321 | if (argc > i) { 322 | ptr = trim(argv[i]); 323 | if (strlen(ptr) > 0) 324 | port = atoi(ptr); 325 | } 326 | 327 | return callapi(command, host, port); 328 | } 329 | -------------------------------------------------------------------------------- /include/jansson.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2013 Petri Lehtinen 3 | * 4 | * Jansson is free software; you can redistribute it and/or modify 5 | * it under the terms of the MIT license. See LICENSE for details. 6 | */ 7 | 8 | #ifndef JANSSON_H 9 | #define JANSSON_H 10 | 11 | #include 12 | #include /* for size_t */ 13 | #include 14 | 15 | #include 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* version */ 22 | 23 | #define JANSSON_MAJOR_VERSION 2 24 | #define JANSSON_MINOR_VERSION 5 25 | #define JANSSON_MICRO_VERSION 0 26 | 27 | /* Micro version is omitted if it's 0 */ 28 | #define JANSSON_VERSION "2.5" 29 | 30 | /* Version as a 3-byte hex number, e.g. 0x010201 == 1.2.1. Use this 31 | for numeric comparisons, e.g. #if JANSSON_VERSION_HEX >= ... */ 32 | #define JANSSON_VERSION_HEX ((JANSSON_MAJOR_VERSION << 16) | \ 33 | (JANSSON_MINOR_VERSION << 8) | \ 34 | (JANSSON_MICRO_VERSION << 0)) 35 | 36 | 37 | /* types */ 38 | 39 | typedef enum { 40 | JSON_OBJECT, 41 | JSON_ARRAY, 42 | JSON_STRING, 43 | JSON_INTEGER, 44 | JSON_REAL, 45 | JSON_TRUE, 46 | JSON_FALSE, 47 | JSON_NULL 48 | } json_type; 49 | 50 | typedef struct json_t { 51 | json_type type; 52 | size_t refcount; 53 | } json_t; 54 | 55 | #ifndef JANSSON_USING_CMAKE /* disabled if using cmake */ 56 | #if JSON_INTEGER_IS_LONG_LONG 57 | #ifdef _WIN32 58 | #define JSON_INTEGER_FORMAT "I64d" 59 | #else 60 | #define JSON_INTEGER_FORMAT "lld" 61 | #endif 62 | typedef long long json_int_t; 63 | #else 64 | #define JSON_INTEGER_FORMAT "ld" 65 | typedef long json_int_t; 66 | #endif /* JSON_INTEGER_IS_LONG_LONG */ 67 | #endif 68 | 69 | #define json_typeof(json) ((json)->type) 70 | #define json_is_object(json) (json && json_typeof(json) == JSON_OBJECT) 71 | #define json_is_array(json) (json && json_typeof(json) == JSON_ARRAY) 72 | #define json_is_string(json) (json && json_typeof(json) == JSON_STRING) 73 | #define json_is_integer(json) (json && json_typeof(json) == JSON_INTEGER) 74 | #define json_is_real(json) (json && json_typeof(json) == JSON_REAL) 75 | #define json_is_number(json) (json_is_integer(json) || json_is_real(json)) 76 | #define json_is_true(json) (json && json_typeof(json) == JSON_TRUE) 77 | #define json_is_false(json) (json && json_typeof(json) == JSON_FALSE) 78 | #define json_is_boolean(json) (json_is_true(json) || json_is_false(json)) 79 | #define json_is_null(json) (json && json_typeof(json) == JSON_NULL) 80 | 81 | /* construction, destruction, reference counting */ 82 | 83 | json_t *json_object(void); 84 | json_t *json_array(void); 85 | json_t *json_string(const char *value); 86 | json_t *json_string_nocheck(const char *value); 87 | json_t *json_integer(json_int_t value); 88 | json_t *json_real(double value); 89 | json_t *json_true(void); 90 | json_t *json_false(void); 91 | #define json_boolean(val) ((val) ? json_true() : json_false()) 92 | json_t *json_null(void); 93 | 94 | static JSON_INLINE 95 | json_t *json_incref(json_t *json) 96 | { 97 | if(json && json->refcount != (size_t)-1) 98 | ++json->refcount; 99 | return json; 100 | } 101 | 102 | /* do not call json_delete directly */ 103 | void json_delete(json_t *json); 104 | 105 | static JSON_INLINE 106 | void json_decref(json_t *json) 107 | { 108 | if(json && json->refcount != (size_t)-1 && --json->refcount == 0) 109 | json_delete(json); 110 | } 111 | 112 | 113 | /* error reporting */ 114 | 115 | #define JSON_ERROR_TEXT_LENGTH 160 116 | #define JSON_ERROR_SOURCE_LENGTH 80 117 | 118 | typedef struct { 119 | int line; 120 | int column; 121 | int position; 122 | char source[JSON_ERROR_SOURCE_LENGTH]; 123 | char text[JSON_ERROR_TEXT_LENGTH]; 124 | } json_error_t; 125 | 126 | 127 | /* getters, setters, manipulation */ 128 | 129 | size_t json_object_size(const json_t *object); 130 | json_t *json_object_get(const json_t *object, const char *key); 131 | int json_object_set_new(json_t *object, const char *key, json_t *value); 132 | int json_object_set_new_nocheck(json_t *object, const char *key, json_t *value); 133 | int json_object_del(json_t *object, const char *key); 134 | int json_object_clear(json_t *object); 135 | int json_object_update(json_t *object, json_t *other); 136 | int json_object_update_existing(json_t *object, json_t *other); 137 | int json_object_update_missing(json_t *object, json_t *other); 138 | void *json_object_iter(json_t *object); 139 | void *json_object_iter_at(json_t *object, const char *key); 140 | void *json_object_key_to_iter(const char *key); 141 | void *json_object_iter_next(json_t *object, void *iter); 142 | const char *json_object_iter_key(void *iter); 143 | json_t *json_object_iter_value(void *iter); 144 | int json_object_iter_set_new(json_t *object, void *iter, json_t *value); 145 | 146 | #define json_object_foreach(object, key, value) \ 147 | for(key = json_object_iter_key(json_object_iter(object)); \ 148 | key && (value = json_object_iter_value(json_object_key_to_iter(key))); \ 149 | key = json_object_iter_key(json_object_iter_next(object, json_object_key_to_iter(key)))) 150 | 151 | #define json_array_foreach(array, index, value) \ 152 | for(index = 0; \ 153 | index < json_array_size(array) && (value = json_array_get(array, index)); \ 154 | index++) 155 | 156 | static JSON_INLINE 157 | int json_object_set(json_t *object, const char *key, json_t *value) 158 | { 159 | return json_object_set_new(object, key, json_incref(value)); 160 | } 161 | 162 | static JSON_INLINE 163 | int json_object_set_nocheck(json_t *object, const char *key, json_t *value) 164 | { 165 | return json_object_set_new_nocheck(object, key, json_incref(value)); 166 | } 167 | 168 | static JSON_INLINE 169 | int json_object_iter_set(json_t *object, void *iter, json_t *value) 170 | { 171 | return json_object_iter_set_new(object, iter, json_incref(value)); 172 | } 173 | 174 | size_t json_array_size(const json_t *array); 175 | json_t *json_array_get(const json_t *array, size_t index); 176 | int json_array_set_new(json_t *array, size_t index, json_t *value); 177 | int json_array_append_new(json_t *array, json_t *value); 178 | int json_array_insert_new(json_t *array, size_t index, json_t *value); 179 | int json_array_remove(json_t *array, size_t index); 180 | int json_array_clear(json_t *array); 181 | int json_array_extend(json_t *array, json_t *other); 182 | 183 | static JSON_INLINE 184 | int json_array_set(json_t *array, size_t ind, json_t *value) 185 | { 186 | return json_array_set_new(array, ind, json_incref(value)); 187 | } 188 | 189 | static JSON_INLINE 190 | int json_array_append(json_t *array, json_t *value) 191 | { 192 | return json_array_append_new(array, json_incref(value)); 193 | } 194 | 195 | static JSON_INLINE 196 | int json_array_insert(json_t *array, size_t ind, json_t *value) 197 | { 198 | return json_array_insert_new(array, ind, json_incref(value)); 199 | } 200 | 201 | const char *json_string_value(const json_t *string); 202 | json_int_t json_integer_value(const json_t *integer); 203 | double json_real_value(const json_t *real); 204 | double json_number_value(const json_t *json); 205 | 206 | int json_string_set(json_t *string, const char *value); 207 | int json_string_set_nocheck(json_t *string, const char *value); 208 | int json_integer_set(json_t *integer, json_int_t value); 209 | int json_real_set(json_t *real, double value); 210 | 211 | 212 | /* pack, unpack */ 213 | 214 | json_t *json_pack(const char *fmt, ...); 215 | json_t *json_pack_ex(json_error_t *error, size_t flags, const char *fmt, ...); 216 | json_t *json_vpack_ex(json_error_t *error, size_t flags, const char *fmt, va_list ap); 217 | 218 | #define JSON_VALIDATE_ONLY 0x1 219 | #define JSON_STRICT 0x2 220 | 221 | int json_unpack(json_t *root, const char *fmt, ...); 222 | int json_unpack_ex(json_t *root, json_error_t *error, size_t flags, const char *fmt, ...); 223 | int json_vunpack_ex(json_t *root, json_error_t *error, size_t flags, const char *fmt, va_list ap); 224 | 225 | 226 | /* equality */ 227 | 228 | int json_equal(json_t *value1, json_t *value2); 229 | 230 | 231 | /* copying */ 232 | 233 | json_t *json_copy(json_t *value); 234 | json_t *json_deep_copy(const json_t *value); 235 | 236 | 237 | /* decoding */ 238 | 239 | #define JSON_REJECT_DUPLICATES 0x1 240 | #define JSON_DISABLE_EOF_CHECK 0x2 241 | #define JSON_DECODE_ANY 0x4 242 | #define JSON_DECODE_INT_AS_REAL 0x8 243 | 244 | typedef size_t (*json_load_callback_t)(void *buffer, size_t buflen, void *data); 245 | 246 | json_t *json_loads(const char *input, size_t flags, json_error_t *error); 247 | json_t *json_loadb(const char *buffer, size_t buflen, size_t flags, json_error_t *error); 248 | json_t *json_loadf(FILE *input, size_t flags, json_error_t *error); 249 | json_t *json_load_file(const char *path, size_t flags, json_error_t *error); 250 | json_t *json_load_callback(json_load_callback_t callback, void *data, size_t flags, json_error_t *error); 251 | 252 | 253 | /* encoding */ 254 | 255 | #define JSON_INDENT(n) (n & 0x1F) 256 | #define JSON_COMPACT 0x20 257 | #define JSON_ENSURE_ASCII 0x40 258 | #define JSON_SORT_KEYS 0x80 259 | #define JSON_PRESERVE_ORDER 0x100 260 | #define JSON_ENCODE_ANY 0x200 261 | #define JSON_ESCAPE_SLASH 0x400 262 | 263 | typedef int (*json_dump_callback_t)(const char *buffer, size_t size, void *data); 264 | 265 | char *json_dumps(const json_t *json, size_t flags); 266 | int json_dumpf(const json_t *json, FILE *output, size_t flags); 267 | int json_dump_file(const json_t *json, const char *path, size_t flags); 268 | int json_dump_callback(const json_t *json, json_dump_callback_t callback, void *data, size_t flags); 269 | 270 | /* custom memory allocation */ 271 | 272 | typedef void *(*json_malloc_t)(size_t); 273 | typedef void (*json_free_t)(void *); 274 | 275 | void json_set_alloc_funcs(json_malloc_t malloc_fn, json_free_t free_fn); 276 | 277 | #ifdef __cplusplus 278 | } 279 | #endif 280 | 281 | #endif 282 | -------------------------------------------------------------------------------- /share/doc/bfgminer/README.ASIC: -------------------------------------------------------------------------------- 1 | SUPPORTED DEVICES 2 | 3 | Currently supported ASIC devices include Avalon, Bitfountain's Block Erupter 4 | series (both USB and blades), a large variety of Bitfury-based miners, 5 | Butterfly Labs' SC range of devices, HashBuster boards, Klondike modules, and 6 | KnCminer's Mercury, Jupiter and Saturn. 7 | 8 | 9 | AVALON 10 | ------ 11 | 12 | Currently, Avalon boards are best supported by connecting them directly (or via 13 | a hub) to a regular PC running BFGMiner. It is also possible to install the 14 | OpenWrt packages of BFGMiner to the Avalon's embedded controller, but this is 15 | not a simple task due to its lack of available flash space. 16 | 17 | To use the Avalon from a regular PC, you will need to specify two options: 18 | First, add the -S option specifying the avalon driver specifically. For example, 19 | 20 | -S avalon:\\.\COM9 21 | 22 | Next, use the --set-device option to provide the device configuration. 23 | If you are translating options from --avalon-options (cgminer and older versions 24 | of BFGMiner), note the values are baud:miner_count:asic_count:timeout:clock. 25 | 26 | baud=N The device is essentially hard coded to emulate 115200 baud, 27 | so you shouldn't change this. 28 | miner_count=N Most Avalons are 3 module devices, which come to 24 miners. 29 | 4 module devices would use 32 here. 30 | asic_count=N Virtually all have 10, so don't change this. 31 | timeout=N This defines how long the device will work on a work item 32 | before accepting new work to replace it. It should be changed 33 | according to the frequency (last setting). It is possible to 34 | set this a little lower if you are trying to tune for short 35 | block mining (eg p2pool) but much lower and the device will 36 | start creating duplicate shares. 37 | clock=N This is the clock speed of the devices. Only specific values 38 | work: 256, 270, 282 (default), 300, 325, 350 and 375. 39 | 40 | Sample settings for valid different frequencies (last 2 values): 41 | 34:375 42 | 36:350 43 | 39:325 44 | 43:300 45 | 45:282 46 | 47:270 47 | 50:256 48 | 49 | 50 | BFSB, MEGABIGPOWER, AND METABANK BITFURY BOARDS 51 | ----------------------------------------------- 52 | 53 | Both BFSB and MegaBigPower (V2 only at this time) boards are supported with the 54 | "bfsb" driver. Metabank boards are supported with the "metabank" driver. These 55 | drivers are not enabled by default, since they must be run on a Raspberry Pi in 56 | a specific hardware configuration with the boards. To enable them, you must 57 | build with --enable-bfsb or --enable-metabank. Do not try to use these drivers 58 | without the manufacturer-supported hardware configuration! Also note that these 59 | drivers do not properly support thermal shutdown at this time, and without 60 | sufficient cooling you may destroy your board or chips! 61 | 62 | To start BFGMiner, ensure your Raspberry Pi's SPI is enabled (you can run the 63 | raspi-config utility for this). For Metabank boards, you must also load the I2C 64 | drivers (do not try to modprobe both with a single command; it won't work): 65 | modprobe i2c-bcm2708 66 | modprobe i2c-dev 67 | Then you must run BFGMiner as root, with the proper driver selected. 68 | For example: 69 | sudo bfgminer -S bfsb:auto 70 | 71 | 72 | BI*FURY 73 | ------- 74 | 75 | Bi*Fury should just work; you may need to use -S bifury: 76 | 77 | On Windows, you will need to install the standard USB CDC driver for it. 78 | http://store.bitcoin.org.pl/support 79 | 80 | If you want to upgrade the firmware, unplug your device. You will need to 81 | temporarily short a circuit. With the USB connector pointing forward, and the 82 | heatsink down, look to the forward-right; you will see two tiny lights, a set of 83 | 2 terminals, and a set of 3 terminals. The ones you need to short are the set of 84 | 2. With them shorted, plug the device back into your computer. It will then 85 | pretend to be a mass storage disk drive. If you use Windows, you can play along 86 | and just overwrite the firmware.bin file. If you use Linux, you must use mcopy: 87 | mcopy -i /dev/disk/by-id/usb-NXP_LPC1XXX_IFLASH_ISP-0:0 firmware.bin \ 88 | ::/firmware.bin 89 | After this is complete, unplug the device again and un-short the 2 terminals. 90 | This completes the upgrade and you can now plug it back in and start mining. 91 | 92 | 93 | BIG PICTURE MINING BITFURY USB 94 | ------------------------------ 95 | 96 | These miners are sensitive to unexpected data. Usually you can re-plug them to 97 | reset to a known-good initialisation state. To ensure they are properly detected 98 | and used with BFGMiner, you must specify -S bigpic:all (or equivalent) options 99 | prior to any other -S options (which might probe the device and confuse it). 100 | 101 | 102 | BLOCK ERUPTER BLADE 103 | ------------------- 104 | 105 | Blades communicate over Ethernet using the old but simple getwork mining 106 | protocol. If you build BFGMiner with libmicrohttpd, you can have it work with 107 | one or more blades. First, start BFGMiner with the --http-port option. For 108 | example: 109 | bfgminer --http-port 8330 110 | Then configure your blade to connect to your BFGMiner instance on the same port, 111 | with a unique username per blade. It will then show up as a PXY device and 112 | should work more or less like any other miner. 113 | 114 | 115 | BLOCK ERUPTER USB 116 | ----------------- 117 | 118 | These will autodetect if supported by the device; otherwise, you need to use 119 | the '--scan-serial erupter:' option to tell BFGMiner what device to 120 | probe; if you know you have no other serial devices, or only ones that can 121 | tolerate garbage, you can use '--scan-serial erupter:all' to probe all serial 122 | ports. They communicate with the Icarus protocol, which has some additional 123 | options in README.FPGA 124 | 125 | 126 | KLONDIKE 127 | -------- 128 | 129 | --klondike-options Set klondike options clock:temptarget 130 | 131 | 132 | KNCMINER 133 | -------- 134 | 135 | The KnC miner uses a BeagleBoneBlack(BBB) as the host, this is pluged into a 136 | cape that holds the FPGA and connections for 4-6 ASICS depending on the cape 137 | version. The BBB runs the Angstrom linux distribution, the following is a step 138 | by step install for BFGMiner on this distro; 139 | 140 | -----------------Start------------ 141 | cat >/etc/opkg/feeds.conf <<\EOF 142 | src/gz noarch http://feeds.angstrom-distribution.org/feeds/v2013.06/ipk/eglibc/all/ 143 | src/gz base http://feeds.angstrom-distribution.org/feeds/v2013.06/ipk/eglibc/cortexa8hf-vfp-neon/base/ 144 | src/gz beaglebone http://feeds.angstrom-distribution.org/feeds/v2013.06/ipk/eglibc/cortexa8hf-vfp-neon/machine/beaglebone/ 145 | EOF 146 | 147 | opkg update 148 | opkg install angstrom-feed-configs 149 | rm /etc/opkg/feeds.conf 150 | opkg update 151 | 152 | opkg install update-alternatives 153 | opkg install automake autoconf make gcc cpp binutils git less pkgconfig-dev ncurses-dev libtool nano bash i2c-tools-dev 154 | while ! opkg install libcurl-dev; do true; done 155 | ln -s aclocal-1.12 /usr/share/aclocal 156 | 157 | curl http://www.digip.org/jansson/releases/jansson-2.0.1.tar.bz2 | tar -xjvp 158 | cd jansson-2.0.1 159 | ./configure --prefix=/usr CC=arm-angstrom-linux-gnueabi-gcc --disable-static NM=arm-angstrom-linux-gnueabi-nm 160 | make install && ldconfig 161 | cd .. 162 | 163 | git clone git://github.com/luke-jr/bfgminer 164 | cd bfgminer 165 | ./autogen.sh 166 | git clone git://github.com/troydhanson/uthash 167 | ./configure --host=arm-angstrom-linux-gnueabi --enable-knc CFLAGS="-I$PWD/uthash/src -O0 -ggdb" 168 | make AR=arm-angstrom-linux-gnueabi-ar 169 | 170 | /etc/init.d/cgminer.sh stop 171 | ./bfgminer -S knc:auto -c /config/cgminer.conf 172 | 173 | ---------------END------------- 174 | 175 | BFGMiner has also been incorporated into an unofficial firmware by uski01 called Bertmod this can be found on the kncminer forum. 176 | 177 | 178 | MONARCH 179 | ------- 180 | 181 | The Butterfly Labs Monarch devices can be used as either USB devices, or in a 182 | PCI-Express slot. As USB devices, they are essentially plug-and-play. If you 183 | wish to use them via PCI-Express, however, you must first load the proper 184 | driver. BFGMiner can work with either Linux uio (2.6.23+, requires root access) 185 | or Linux vfio (3.6+, requires IOMMU support). 186 | 187 | To enable uio on your cards, you may need to do: 188 | sudo modprobe uio_pci_generic 189 | echo 1cf9 0001 | sudo tee /sys/bus/pci/drivers/uio_pci_generic/new_id 190 | 191 | Enabling vfio is similar, but more complicated, but allows you to run BFGMiner 192 | without root privileges. First, load the kernel module and tell it to accept the 193 | Monarch: 194 | sudo modprobe vfio-pci 195 | echo 1cf9 0001 | sudo tee /sys/bus/pci/drivers/vfio-pci/new_id 196 | Next, identify what the device ids are for your card(s): 197 | lspci -D | grep 1cf9 # the first number of each line is the device id 198 | From that, you can identify its IOMMU group, and list all devices sharing that 199 | group: 200 | readlink /sys/bus/pci/devices//iommu_group 201 | ls /sys/kernel/iommu_groups//devices/ 202 | All of the devices listed (other than the Monarch), if any, will need to be 203 | disabled and unbound! To do that, use: 204 | echo | sudo tee /sys/bus/pci/devices//driver/unbind 205 | If you want to run BFGMiner as a normal user: 206 | chown /dev/vfio/ 207 | Depending on your system, you may also need to do: 208 | echo 1 | sudo tee /sys/module/vfio_iommu_type1/parameters/allow_unsafe_interrupts 209 | 210 | 211 | --- 212 | 213 | This code is provided entirely free of charge by the programmer in his spare 214 | time so donations would be greatly appreciated. Please consider donating to the 215 | address below. 216 | 217 | Luke-Jr 218 | 1QATWksNFGeUJCWBrN4g6hGM178Lovm7Wh 219 | -------------------------------------------------------------------------------- /share/doc/hidapi/README.txt: -------------------------------------------------------------------------------- 1 | HIDAPI library for Windows, Linux, FreeBSD and Mac OS X 2 | ========================================================= 3 | 4 | About 5 | ====== 6 | 7 | HIDAPI is a multi-platform library which allows an application to interface 8 | with USB and Bluetooth HID-Class devices on Windows, Linux, FreeBSD, and Mac 9 | OS X. HIDAPI can be either built as a shared library (.so or .dll) or 10 | can be embedded directly into a target application by adding a single source 11 | file (per platform) and a single header. 12 | 13 | HIDAPI has four back-ends: 14 | * Windows (using hid.dll) 15 | * Linux/hidraw (using the Kernel's hidraw driver) 16 | * Linux/libusb (using libusb-1.0) 17 | * FreeBSD (using libusb-1.0) 18 | * Mac (using IOHidManager) 19 | 20 | On Linux, either the hidraw or the libusb back-end can be used. There are 21 | tradeoffs, and the functionality supported is slightly different. 22 | 23 | Linux/hidraw (linux/hid.c): 24 | This back-end uses the hidraw interface in the Linux kernel. While this 25 | back-end will support both USB and Bluetooth, it has some limitations on 26 | kernels prior to 2.6.39, including the inability to send or receive feature 27 | reports. In addition, it will only communicate with devices which have 28 | hidraw nodes associated with them. Keyboards, mice, and some other devices 29 | which are blacklisted from having hidraw nodes will not work. Fortunately, 30 | for nearly all the uses of hidraw, this is not a problem. 31 | 32 | Linux/FreeBSD/libusb (libusb/hid-libusb.c): 33 | This back-end uses libusb-1.0 to communicate directly to a USB device. This 34 | back-end will of course not work with Bluetooth devices. 35 | 36 | HIDAPI also comes with a Test GUI. The Test GUI is cross-platform and uses 37 | Fox Toolkit (http://www.fox-toolkit.org). It will build on every platform 38 | which HIDAPI supports. Since it relies on a 3rd party library, building it 39 | is optional but recommended because it is so useful when debugging hardware. 40 | 41 | What Does the API Look Like? 42 | ============================= 43 | The API provides the the most commonly used HID functions including sending 44 | and receiving of input, output, and feature reports. The sample program, 45 | which communicates with a heavily hacked up version of the Microchip USB 46 | Generic HID sample looks like this (with error checking removed for 47 | simplicity): 48 | 49 | #ifdef WIN32 50 | #include 51 | #endif 52 | #include 53 | #include 54 | #include "hidapi.h" 55 | 56 | #define MAX_STR 255 57 | 58 | int main(int argc, char* argv[]) 59 | { 60 | int res; 61 | unsigned char buf[65]; 62 | wchar_t wstr[MAX_STR]; 63 | hid_device *handle; 64 | int i; 65 | 66 | // Initialize the hidapi library 67 | res = hid_init(); 68 | 69 | // Open the device using the VID, PID, 70 | // and optionally the Serial number. 71 | handle = hid_open(0x4d8, 0x3f, NULL); 72 | 73 | // Read the Manufacturer String 74 | res = hid_get_manufacturer_string(handle, wstr, MAX_STR); 75 | wprintf(L"Manufacturer String: %s\n", wstr); 76 | 77 | // Read the Product String 78 | res = hid_get_product_string(handle, wstr, MAX_STR); 79 | wprintf(L"Product String: %s\n", wstr); 80 | 81 | // Read the Serial Number String 82 | res = hid_get_serial_number_string(handle, wstr, MAX_STR); 83 | wprintf(L"Serial Number String: (%d) %s\n", wstr[0], wstr); 84 | 85 | // Read Indexed String 1 86 | res = hid_get_indexed_string(handle, 1, wstr, MAX_STR); 87 | wprintf(L"Indexed String 1: %s\n", wstr); 88 | 89 | // Toggle LED (cmd 0x80). The first byte is the report number (0x0). 90 | buf[0] = 0x0; 91 | buf[1] = 0x80; 92 | res = hid_write(handle, buf, 65); 93 | 94 | // Request state (cmd 0x81). The first byte is the report number (0x0). 95 | buf[0] = 0x0; 96 | buf[1] = 0x81; 97 | res = hid_write(handle, buf, 65); 98 | 99 | // Read requested state 100 | res = hid_read(handle, buf, 65); 101 | 102 | // Print out the returned buffer. 103 | for (i = 0; i < 4; i++) 104 | printf("buf[%d]: %d\n", i, buf[i]); 105 | 106 | // Finalize the hidapi library 107 | res = hid_exit(); 108 | 109 | return 0; 110 | } 111 | 112 | If you have your own simple test programs which communicate with standard 113 | hardware development boards (such as those from Microchip, TI, Atmel, 114 | FreeScale and others), please consider sending me something like the above 115 | for inclusion into the HIDAPI source. This will help others who have the 116 | same hardware as you do. 117 | 118 | License 119 | ======== 120 | HIDAPI may be used by one of three licenses as outlined in LICENSE.txt. 121 | 122 | Download 123 | ========= 124 | HIDAPI can be downloaded from github 125 | git clone git://github.com/signal11/hidapi.git 126 | 127 | Build Instructions 128 | =================== 129 | 130 | This section is long. Don't be put off by this. It's not long because it's 131 | complicated to build HIDAPI; it's quite the opposite. This section is long 132 | because of the flexibility of HIDAPI and the large number of ways in which 133 | it can be built and used. You will likely pick a single build method. 134 | 135 | HIDAPI can be built in several different ways. If you elect to build a 136 | shared library, you will need to build it from the HIDAPI source 137 | distribution. If you choose instead to embed HIDAPI directly into your 138 | application, you can skip the building and look at the provided platform 139 | Makefiles for guidance. These platform Makefiles are located in linux/ 140 | libusb/ mac/ and windows/ and are called Makefile-manual. In addition, 141 | Visual Studio projects are provided. Even if you're going to embed HIDAPI 142 | into your project, it is still beneficial to build the example programs. 143 | 144 | 145 | Prerequisites: 146 | --------------- 147 | 148 | Linux: 149 | ------- 150 | On Linux, you will need to install development packages for libudev, 151 | libusb and optionally Fox-toolkit (for the test GUI). On 152 | Debian/Ubuntu systems these can be installed by running: 153 | sudo apt-get install libudev-dev libusb-1.0-0-dev libfox-1.6-dev 154 | 155 | If you downloaded the source directly from the git repository (using 156 | git clone), you'll need Autotools: 157 | sudo apt-get install autotools-dev autoconf automake libtool 158 | 159 | FreeBSD: 160 | --------- 161 | On FreeBSD you will need to install GNU make, libiconv, and 162 | optionally Fox-Toolkit (for the test GUI). This is done by running 163 | the following: 164 | pkg_add -r gmake libiconv fox16 165 | 166 | If you downloaded the source directly from the git repository (using 167 | git clone), you'll need Autotools: 168 | pkg_add -r autotools 169 | 170 | Mac: 171 | ----- 172 | On Mac, you will need to install Fox-Toolkit if you wish to build 173 | the Test GUI. There are two ways to do this, and each has a slight 174 | complication. Which method you use depends on your use case. 175 | 176 | If you wish to build the Test GUI just for your own testing on your 177 | own computer, then the easiest method is to install Fox-Toolkit 178 | using ports: 179 | sudo port install fox 180 | 181 | If you wish to build the TestGUI app bundle to redistribute to 182 | others, you will need to install Fox-toolkit from source. This is 183 | because the version of fox that gets installed using ports uses the 184 | ports X11 libraries which are not compatible with the Apple X11 185 | libraries. If you install Fox with ports and then try to distribute 186 | your built app bundle, it will simply fail to run on other systems. 187 | To install Fox-Toolkit manually, download the source package from 188 | http://www.fox-toolkit.org, extract it, and run the following from 189 | within the extracted source: 190 | ./configure && make && make install 191 | 192 | Windows: 193 | --------- 194 | On Windows, if you want to build the test GUI, you will need to get 195 | the hidapi-externals.zip package from the download site. This 196 | contains pre-built binaries for Fox-toolkit. Extract 197 | hidapi-externals.zip just outside of hidapi, so that 198 | hidapi-externals and hidapi are on the same level, as shown: 199 | 200 | Parent_Folder 201 | | 202 | +hidapi 203 | +hidapi-externals 204 | 205 | Again, this step is not required if you do not wish to build the 206 | test GUI. 207 | 208 | 209 | Building HIDAPI into a shared library on Unix Platforms: 210 | --------------------------------------------------------- 211 | 212 | On Unix-like systems such as Linux, FreeBSD, Mac, and even Windows, using 213 | Mingw or Cygwin, the easiest way to build a standard system-installed shared 214 | library is to use the GNU Autotools build system. If you checked out the 215 | source from the git repository, run the following: 216 | 217 | ./bootstrap 218 | ./configure 219 | make 220 | make install <----- as root, or using sudo 221 | 222 | If you downloaded a source package (ie: if you did not run git clone), you 223 | can skip the ./bootstrap step. 224 | 225 | ./configure can take several arguments which control the build. The two most 226 | likely to be used are: 227 | --enable-testgui 228 | Enable build of the Test GUI. This requires Fox toolkit to 229 | be installed. Instructions for installing Fox-Toolkit on 230 | each platform are in the Prerequisites section above. 231 | 232 | --prefix=/usr 233 | Specify where you want the output headers and libraries to 234 | be installed. The example above will put the headers in 235 | /usr/include and the binaries in /usr/lib. The default is to 236 | install into /usr/local which is fine on most systems. 237 | 238 | Building the manual way on Unix platforms: 239 | ------------------------------------------- 240 | 241 | Manual Makefiles are provided mostly to give the user and idea what it takes 242 | to build a program which embeds HIDAPI directly inside of it. These should 243 | really be used as examples only. If you want to build a system-wide shared 244 | library, use the Autotools method described above. 245 | 246 | To build HIDAPI using the manual makefiles, change to the directory 247 | of your platform and run make. For example, on Linux run: 248 | cd linux/ 249 | make -f Makefile-manual 250 | 251 | To build the Test GUI using the manual makefiles: 252 | cd testgui/ 253 | make -f Makefile-manual 254 | 255 | Building on Windows: 256 | --------------------- 257 | 258 | To build the HIDAPI DLL on Windows using Visual Studio, build the .sln file 259 | in the windows/ directory. 260 | 261 | To build the Test GUI on windows using Visual Studio, build the .sln file in 262 | the testgui/ directory. 263 | 264 | To build HIDAPI using MinGW or Cygwin using Autotools, use the instructions 265 | in the section titled "Building HIDAPI into a shared library on Unix 266 | Platforms" above. Note that building the Test GUI with MinGW or Cygwin will 267 | require the Windows procedure in the Prerequisites section above (ie: 268 | hidapi-externals.zip). 269 | 270 | To build HIDAPI using MinGW using the Manual Makefiles, see the section 271 | "Building the manual way on Unix platforms" above. 272 | 273 | HIDAPI can also be built using the Windows DDK (now also called the Windows 274 | Driver Kit or WDK). This method was originally required for the HIDAPI build 275 | but not anymore. However, some users still prefer this method. It is not as 276 | well supported anymore but should still work. Patches are welcome if it does 277 | not. To build using the DDK: 278 | 279 | 1. Install the Windows Driver Kit (WDK) from Microsoft. 280 | 2. From the Start menu, in the Windows Driver Kits folder, select Build 281 | Environments, then your operating system, then the x86 Free Build 282 | Environment (or one that is appropriate for your system). 283 | 3. From the console, change directory to the windows/ddk_build/ directory, 284 | which is part of the HIDAPI distribution. 285 | 4. Type build. 286 | 5. You can find the output files (DLL and LIB) in a subdirectory created 287 | by the build system which is appropriate for your environment. On 288 | Windows XP, this directory is objfre_wxp_x86/i386. 289 | 290 | Cross Compiling 291 | ================ 292 | 293 | This section talks about cross compiling HIDAPI for Linux using autotools. 294 | This is useful for using HIDAPI on embedded Linux targets. These 295 | instructions assume the most raw kind of embedded Linux build, where all 296 | prerequisites will need to be built first. This process will of course vary 297 | based on your embedded Linux build system if you are using one, such as 298 | OpenEmbedded or Buildroot. 299 | 300 | For the purpose of this section, it will be assumed that the following 301 | environment variables are exported. 302 | 303 | $ export STAGING=$HOME/out 304 | $ export HOST=arm-linux 305 | 306 | STAGING and HOST can be modified to suit your setup. 307 | 308 | Prerequisites 309 | -------------- 310 | 311 | Note that the build of libudev is the very basic configuration. 312 | 313 | Build Libusb. From the libusb source directory, run: 314 | ./configure --host=$HOST --prefix=$STAGING 315 | make 316 | make install 317 | 318 | Build libudev. From the libudev source directory, run: 319 | ./configure --disable-gudev --disable-introspection --disable-hwdb \ 320 | --host=$HOST --prefix=$STAGING 321 | make 322 | make install 323 | 324 | Building HIDAPI 325 | ---------------- 326 | 327 | Build HIDAPI: 328 | 329 | PKG_CONFIG_DIR= \ 330 | PKG_CONFIG_LIBDIR=$STAGING/lib/pkgconfig:$STAGING/share/pkgconfig \ 331 | PKG_CONFIG_SYSROOT_DIR=$STAGING \ 332 | ./configure --host=$HOST --prefix=$STAGING 333 | 334 | 335 | Signal 11 Software - 2010-04-11 336 | 2010-07-28 337 | 2011-09-10 338 | 2012-05-01 339 | 2012-07-03 340 | -------------------------------------------------------------------------------- /share/doc/bfgminer/README.FPGA: -------------------------------------------------------------------------------- 1 | 2 | This README contains extended details about FPGA mining with BFGMiner 3 | 4 | 5 | ModMiner (MMQ) 6 | -------------- 7 | 8 | ModMiner does not have any persistent storage for bitstreams, so BFGMiner must 9 | upload it after power on. For this to work, you must first download the 10 | necessary bitstream file to BFGMiner's "bitstreams" directory, and give it the 11 | name "fpgaminer_x6500-overclocker-0402.bit". You can download this bitstream 12 | from FPGA Mining LLC's website: 13 | http://www.fpgamining.com/documentation/firmware 14 | 15 | - 16 | 17 | If the MMQ doesn't respond to BFGMiner at all, or the red LED isn't flashing 18 | then you will need to reset the MMQ. 19 | 20 | The red LED should always be flashing when it is mining or ready to mine. 21 | 22 | To reset the MMQ, you are best to press the left "RESET" button on the 23 | backplane, then unplug and replug the USB cable. 24 | 25 | If your MMQ doesn't have a button on the "RESET" pad, you need to join the two 26 | left pads of the "RESET" pad with conductive wire to reset it. Cutting a small 27 | (metal) paper-clip in half works well for this. 28 | 29 | Then unplug the USB cable, wait for 5 seconds, then plug it back in. 30 | 31 | After you press reset, the red LED near the USB port should blink continuously. 32 | 33 | If it still wont work, power off, wait for 5 seconds, then power on the MMQ 34 | This of course means it will upload the bitstream again when you start BFGMiner. 35 | 36 | - 37 | 38 | Device 0 is on the power end of the board. 39 | 40 | - 41 | 42 | You must make sure you have an appropriate firmware in your MMQ 43 | Read here for official details of changing the firmware: 44 | http://wiki.btcfpga.com/index.php?title=Firmware 45 | 46 | The basics of changing the firmware are: 47 | You need two short pieces of conductive wire if your MMQ doesn't have buttons 48 | on the "RESET" and "ISP" pads on the backplane board. 49 | Cutting a small (metal) paper-clip in half works well for this. 50 | 51 | Join the 2 left pads of the "RESET" pad with wire and the led will dim. 52 | Without disconnecting the "RESET", join the 2 left pads of the "ISP" pad with 53 | a wire and it will stay dim. 54 | Release "RESET" then release "ISP" and is should still be dim. 55 | Unplug the USB and when you plug it back in it will show up as a mass storage 56 | device. 57 | Linux: (as one single line): 58 | mcopy -i /dev/disk/by-id/usb-NXP_LPC134X_IFLASH_ISP000000000-0:0 59 | modminer091012.bin ::/firmware.bin 60 | Windows: delete the MSD device file firmware.bin and copy in the new one 61 | rename the new file and put it under the same name 'firmware.bin' 62 | Disconnect the USB correctly (so writes are flushed first) 63 | Join and then disconnect "RESET" and then plug the USB back in and it's done. 64 | 65 | Best to update to one of the latest 2 listed below if you don't already 66 | have one of them in your MMQ. 67 | 68 | The current latest different firmware are: 69 | 70 | Latest for support of normal or TLM bitstream: 71 | http://btcfpga.com/files/firmware/modminer092612-TLM.bin 72 | 73 | Latest with only normal bitstream support (Temps/HW Fix): 74 | http://btcfpga.com/files/firmware/modminer091012.bin 75 | 76 | The code is currently tested on the modminer091012.bin firmware. 77 | This comment will be updated when others have been tested. 78 | 79 | - 80 | 81 | On many Linux distributions there is an app called modem-manager that may cause 82 | problems when it is enabled, due to opening the MMQ device and writing to it. 83 | 84 | The problem will typically present itself by the flashing led on the backplane 85 | going out (no longer flashing) and it takes a power cycle to re-enable the MMQ 86 | firmware - which then can lead to the problem reoccurring. 87 | 88 | You can either disable/uninstall modem-manager if you don't need it or: 89 | a (hack) solution to this is to blacklist the MMQ USB device in 90 | /lib/udev/rules.d/77-mm-usb-device-blacklist.rules 91 | 92 | Adding 2 lines like this (just above APC) should help. 93 | # MMQ 94 | ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="0003", ENV{ID_MM_DEVICE_IGNORE}="1" 95 | 96 | The change will be lost and need to be re-done, next time you update the 97 | modem-manager software. 98 | 99 | 100 | BitForce (BFL) 101 | -------------- 102 | 103 | --bfl-range Use nonce range on BitForce devices if supported 104 | 105 | This option is only for BitForce devices. Earlier devices such as the single 106 | did not have any way of doing small amounts of work which meant that a lot of 107 | work could be lost across block changes. Some of the Mini Rigs have support 108 | for doing this, so less work is lost across a longpoll. However, it comes at 109 | a cost of 1% in overall hashrate so this feature is disabled by default. It 110 | is only recommended you enable this if you are mining with a Mini Rig on 111 | P2Pool. 112 | 113 | BFGMiner also bundles a bitforce-firmware-flash utility on Linux. Using this, 114 | you can change the bitstream firmware on BitForce Singles. It is untested with 115 | other devices. Use at your own risk! Windows users may use Butterfly Labs 116 | EasyMiner to change firmware. 117 | 118 | To compile: 119 | make bitforce-firmware-flash 120 | To flash your BFL, specify the BFL port and the flash file e.g.: 121 | sudo ./bitforce-firmware-flash /dev/ttyUSB0 alphaminer_832.bfl 122 | It takes a bit under 3 minutes to flash a BFL and shows a progress % counter 123 | Once it completes, you may also need to wait about 15 seconds, then power the 124 | BFL off and on again. 125 | 126 | If you get an error at the end of the BFL flash process stating: 127 | "Error reading response from ZBX" 128 | it may have worked successfully anyway. 129 | Test mining on it to be sure if it worked or not. 130 | 131 | You need to give BFGMiner about 10 minutes mining with the BFL to be sure of 132 | the Mh/s value reported with the changed firmware - and the MH/s reported will 133 | be less than the firmware speed since you lose work on every block change. 134 | 135 | 136 | Icarus (ICA) 137 | ------------ 138 | 139 | There are a number of options for Icarus-compatible devices which can be used 140 | with --set-devices (or the RPC pgaset method): 141 | 142 | baud=N The serial baud rate (default 115200) 143 | work_division=N The fraction of work divided up for each processor: 1, 2, 144 | 4, or 8. e.g. 2 means each does half the nonce range 145 | (default 2) 146 | fpga_count=N The actual number of processors working; this would 147 | normally be the same as work_division. Range is from 1 up 148 | to . It defaults to the value of 149 | work_division, or 2 if you don't specify work_division. 150 | reopen=MODE Controls how often the driver reopens the device to 151 | workaround issues. Choices are 'never', on 'timeout' only 152 | (default), or every 'cycle'. 153 | timing=MODE Set how the timing is calculated: 154 | default[=N] Use the default hash time 155 | short[=N] Calculate the hash time and stop 156 | adjusting it at ~315 difficulty 1 shares 157 | (~1hr) 158 | long=[N] Re-calculate the hash time continuously 159 | value[=N] Specify the hash time in nanoseconds 160 | (e.g. 2.6316) and abort time (e.g. 161 | 2.6316=80). 162 | 163 | An example would be: --set-device ECM:baud=57600 --set-device 164 | ECM:work_division=2 --set-device DCM:fpga_count=1 --set-device ECM:reopen=never 165 | This would mean: use 57600 baud, the FPGA board divides the work in half however 166 | only 1 FPGA actually runs on the board, and don't reopen the device (e.g. like 167 | an early CM1 Icarus copy bitstream). 168 | 169 | Icarus timing is used to determine the number of hashes that have been checked 170 | when it aborts a nonce range (including on a longpoll). 171 | It is also used to determine the elapsed time when it should abort a nonce 172 | range to avoid letting the Icarus go idle, but also to safely maximise that 173 | time. 174 | 175 | 'short' or 'long' mode should only be used on a computer that has enough CPU 176 | available to run BFGMiner without any CPU delays. 177 | Any CPU delays while calculating the hash time will affect the result 178 | 'short' mode only requires the computer to be stable until it has completed 179 | ~315 difficulty 1 shares, 'long' mode requires it to always be stable to ensure 180 | accuracy, however, over time it continually corrects itself. 181 | The optional additional =N for 'short' or 'long' specifies the limit to set the 182 | timeout to in deciseconds; thus if the timing code calculation is higher while 183 | running, it will instead use the limit. 184 | This can be set to the appropriate value to ensure the device never goes idle 185 | even if the calculation is negatively affected by system performance. 186 | 187 | When in 'short' or 'long' mode, it will report the hash time value each time it 188 | is re-calculated. 189 | In 'short' or 'long' mode, the scan abort time starts at 5 seconds and uses the 190 | default 2.6316ns scan hash time, for the first 5 nonces or one minute 191 | (whichever is longer). 192 | 193 | In 'default' or 'value' mode the 'constants' are calculated once at the start, 194 | based on the default value or the value specified. 195 | The optional additional =N specifies to set the default abort at N 1/10ths of a 196 | second, not the calculated value, which is 112 for 2.6316ns 197 | 198 | To determine the hash time value for a non Icarus Rev3 device or an Icarus Rev3 199 | with a different bitstream to the default one, use 'long' mode and give it at 200 | least a few hundred shares, or use 'short' mode and take note of the final hash 201 | time value (Hs) calculated. 202 | You can also use the RPC API 'stats' command to see the current hash time (Hs) 203 | at any time. 204 | 205 | The Icarus code currently only works with devices that support the same commands 206 | as Icarus Rev3 requires and also is less than ~840Mh/s and greater than 2Mh/s. 207 | If your device does hash faster than ~840Mh/s it should work correctly if you 208 | supply the correct hash time nanoseconds value. 209 | 210 | The timing code itself will affect the Icarus performance since it increases 211 | the delay after work is completed or aborted until it starts again. 212 | The increase is, however, extremely small and the actual increase is reported 213 | with the RPC API 'stats' command (a very slow CPU will make it more noticeable). 214 | Using the 'short' mode will remove this delay after 'short' mode completes. 215 | The delay doesn't affect the calculation of the correct hash time. 216 | 217 | 218 | X6500 219 | ----- 220 | 221 | Since X6500 FPGAs do not use serial ports for communication, the --scan-serial 222 | option instead works with product serial numbers. By default, any devices with 223 | the X6500 USB product id will be used, but some X6500s may have shipped without 224 | this product id being configured. If you have any of these, you will need to 225 | specify their serial numbers explicitly, and also add -S x6500:auto if you 226 | still want to use the autodetection for other properly-configured FPGAs. 227 | The serial number of X6500s is usually found on a label applied to the ATX 228 | power connector slot. If yours is missing, devices seen by the system can be 229 | displayed by starting bfgminer in debug mode. To get a simple list of devices, 230 | with the debug output shown, you can use: bfgminer -D -d? -T 231 | 232 | X6500 does not have any persistent storage for bitstreams, so BFGMiner must 233 | upload it after power on. For this to work, you must first download the 234 | necessary bitstream file to BFGMiner's "bitstreams" directory, and give it the 235 | name "fpgaminer_x6500-overclocker-0402.bit". You can download this bitstream 236 | from FPGA Mining LLC's website: 237 | http://www.fpgamining.com/documentation/firmware 238 | 239 | 240 | ZTEX FPGA Boards 241 | ---------------- 242 | 243 | http://www.ztex.de sells two boards suitable for mining: the 1.15x with 1 FPGA 244 | and the 1.15y with 4 FPGAs. ZTEX distributes their own mining software and 245 | drivers. BFGMiner has full support for these boards, as long as they have at 246 | least the "dummy" mining bitstreams installed on them. 247 | 248 | If your boards do not have a mining bitstream yet, you must first, install 249 | ZTEX's BTCMiner (requires Java JDK version 6 or later) and install one. 250 | 251 | === WINDOWS NOTE === 252 | Upon first powering up and connecting the board via USB, windows will attempt 253 | and fail to find the appropriate drivers. To load the initial firmware on the 254 | board, you'll need the EZ-USB FX2 SDK from here: 255 | http://www.ztex.de/downloads/#firmware_kit 256 | Extract the firmware kit and use the driver within libusb-win32/ztex.inf. 257 | Windows should now recognize the board and you're ready to program it. 258 | === END OF WINDOWS === 259 | 260 | Grab the latest miner jar from http://www.ztex.de/btcminer/#download and program 261 | the appropriate dummy firmware for your board. The command should look 262 | something like (for a single FPGA board): 263 | java -cp ZtexBTCMiner-120417.jar BTCMiner -m p -f **FILENAME** -s 01-02-01 264 | For ZTEX 1.15x boards, the dummy bitstream filename is ztex_ufm1_15d.ihx 265 | For ZTEX 1.15y boards, the dummy bitstream filename is ztex_ufm1_15y.ihx 266 | 267 | === WINDOWS NOTE === 268 | To mine using BFGMiner, you'll have to swap the USB drivers. The BFGMiner- 269 | compatible WinUSB drivers for the board can be generated with this tool: 270 | http://sourceforge.net/projects/libwdi/files/zadig/ 271 | Basic usage instructions for Zadig can be found here: 272 | https://github.com/pbatard/libwdi/wiki/Zadig 273 | Once Zadig generates and installs a WinUSB driver, ensure everything is working 274 | by running: 275 | bfgminer -D -d? -T 276 | You should see something like this in the output: 277 | [2013-01-22 20:19:11] Found 1 ztex board 278 | [2013-01-22 20:19:11] ZTX 0: Found Ztex (ZTEX 0001-02-01-1) 279 | === END OF WINDOWS === 280 | 281 | If you have installed a dummy bitstream, you will now need to copy the main 282 | mining bitstream where BFGMiner can find it. This are usually the same as the 283 | dummy bitstream filename, but with a number added to the end. Extract the 284 | ZtexBTCMiner-120417.jar file using any unzip utility, and look for the proper 285 | *.ihx and *.bit files (the latter will be inside the 'fpga' directory of the 286 | jar). Copy them to BFGMiner's "bitstreams" directory, and you're ready to start 287 | mining. 288 | -------------------------------------------------------------------------------- /bin/phatk121016.cl: -------------------------------------------------------------------------------- 1 | // This file is taken and modified from the public-domain poclbm project, and 2 | // I have therefore decided to keep it public-domain. 3 | // Modified version copyright 2011-2012 Con Kolivas 4 | 5 | #ifdef VECTORS4 6 | typedef uint4 u; 7 | #elif defined VECTORS2 8 | typedef uint2 u; 9 | #else 10 | typedef uint u; 11 | #endif 12 | 13 | __constant uint K[64] = { 14 | 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 15 | 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 16 | 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 17 | 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 18 | 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 19 | 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 20 | 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 21 | 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 22 | }; 23 | 24 | __constant uint ConstW[128] = { 25 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x80000000U, 0x00000000, 0x00000000, 0x00000000, 26 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000280U, 27 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 28 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 29 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 30 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 31 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 32 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 33 | 34 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 35 | 0x80000000U, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100U, 36 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 37 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 38 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 39 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 40 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 41 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 42 | }; 43 | 44 | __constant uint H[8] = { 45 | 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 46 | }; 47 | 48 | 49 | #ifdef BITALIGN 50 | #pragma OPENCL EXTENSION cl_amd_media_ops : enable 51 | #define rot(x, y) amd_bitalign(x, x, (uint)(32 - y)) 52 | 53 | // This part is not from the stock poclbm kernel. It's part of an optimization 54 | // added in the Phoenix Miner. 55 | 56 | // Some AMD devices have Vals[0] BFI_INT opcode, which behaves exactly like the 57 | // SHA-256 Ch function, but provides it in exactly one instruction. If 58 | // detected, use it for Ch. Otherwise, construct Ch out of simpler logical 59 | // primitives. 60 | 61 | #ifdef BFI_INT 62 | // Well, slight problem... It turns out BFI_INT isn't actually exposed to 63 | // OpenCL (or CAL IL for that matter) in any way. However, there is 64 | // a similar instruction, BYTE_ALIGN_INT, which is exposed to OpenCL via 65 | // amd_bytealign, takes the same inputs, and provides the same output. 66 | // We can use that as a placeholder for BFI_INT and have the application 67 | // patch it after compilation. 68 | 69 | // This is the BFI_INT function 70 | #define Ch(x, y, z) amd_bytealign(x,y,z) 71 | // Ma can also be implemented in terms of BFI_INT... 72 | #define Ma(z, x, y) amd_bytealign(z^x,y,x) 73 | #else // BFI_INT 74 | // Later SDKs optimise this to BFI INT without patching and GCN 75 | // actually fails if manually patched with BFI_INT 76 | 77 | #define Ch(x, y, z) bitselect((u)z, (u)y, (u)x) 78 | #define Ma(x, y, z) bitselect((u)x, (u)y, (u)z ^ (u)x) 79 | #define rotr(x, y) amd_bitalign((u)x, (u)x, (u)y) 80 | #endif 81 | #else // BITALIGN 82 | #define Ch(x, y, z) (z ^ (x & (y ^ z))) 83 | #define Ma(x, y, z) ((x & z) | (y & (x | z))) 84 | #define rot(x, y) rotate((u)x, (u)y) 85 | #define rotr(x, y) rotate((u)x, (u)(32-y)) 86 | #endif 87 | 88 | 89 | 90 | //Various intermediate calculations for each SHA round 91 | #define s0(n) (S0(Vals[(0 + 128 - (n)) % 8])) 92 | #define S0(n) (rot(n, 30u)^rot(n, 19u)^rot(n,10u)) 93 | 94 | #define s1(n) (S1(Vals[(4 + 128 - (n)) % 8])) 95 | #define S1(n) (rot(n, 26u)^rot(n, 21u)^rot(n, 7u)) 96 | 97 | #define ch(n) Ch(Vals[(4 + 128 - (n)) % 8],Vals[(5 + 128 - (n)) % 8],Vals[(6 + 128 - (n)) % 8]) 98 | #define maj(n) Ma(Vals[(1 + 128 - (n)) % 8],Vals[(2 + 128 - (n)) % 8],Vals[(0 + 128 - (n)) % 8]) 99 | 100 | //t1 calc when W is already calculated 101 | #define t1(n) K[(n) % 64] + Vals[(7 + 128 - (n)) % 8] + W[(n)] + s1(n) + ch(n) 102 | 103 | //t1 calc which calculates W 104 | #define t1W(n) K[(n) % 64] + Vals[(7 + 128 - (n)) % 8] + W(n) + s1(n) + ch(n) 105 | 106 | //Used for constant W Values (the compiler optimizes out zeros) 107 | #define t1C(n) (K[(n) % 64]+ ConstW[(n)]) + Vals[(7 + 128 - (n)) % 8] + s1(n) + ch(n) 108 | 109 | //t2 Calc 110 | #define t2(n) maj(n) + s0(n) 111 | 112 | #define rotC(x,n) (x<> (32-n)) 113 | 114 | //W calculation used for SHA round 115 | #define W(n) (W[n] = P4(n) + P3(n) + P2(n) + P1(n)) 116 | 117 | 118 | 119 | //Partial W calculations (used for the begining where only some values are nonzero) 120 | #define P1(n) ((rot(W[(n)-2],15u)^rot(W[(n)-2],13u)^((W[(n)-2])>>10U))) 121 | #define P2(n) ((rot(W[(n)-15],25u)^rot(W[(n)-15],14u)^((W[(n)-15])>>3U))) 122 | 123 | 124 | #define p1(x) ((rot(x,15u)^rot(x,13u)^((x)>>10U))) 125 | #define p2(x) ((rot(x,25u)^rot(x,14u)^((x)>>3U))) 126 | 127 | 128 | #define P3(n) W[n-7] 129 | #define P4(n) W[n-16] 130 | 131 | 132 | //Partial Calcs for constant W values 133 | #define P1C(n) ((rotC(ConstW[(n)-2],15)^rotC(ConstW[(n)-2],13)^((ConstW[(n)-2])>>10U))) 134 | #define P2C(n) ((rotC(ConstW[(n)-15],25)^rotC(ConstW[(n)-15],14)^((ConstW[(n)-15])>>3U))) 135 | #define P3C(x) ConstW[x-7] 136 | #define P4C(x) ConstW[x-16] 137 | 138 | //SHA round with built in W calc 139 | #define sharoundW(n) Barrier1(n); Vals[(3 + 128 - (n)) % 8] += t1W(n); Vals[(7 + 128 - (n)) % 8] = t1W(n) + t2(n); 140 | 141 | //SHA round without W calc 142 | #define sharound(n) Barrier2(n); Vals[(3 + 128 - (n)) % 8] += t1(n); Vals[(7 + 128 - (n)) % 8] = t1(n) + t2(n); 143 | 144 | //SHA round for constant W values 145 | #define sharoundC(n) Barrier3(n); Vals[(3 + 128 - (n)) % 8] += t1C(n); Vals[(7 + 128 - (n)) % 8] = t1C(n) + t2(n); 146 | 147 | //The compiler is stupid... I put this in there only to stop the compiler from (de)optimizing the order 148 | #define Barrier1(n) t1 = t1C((n+1)) 149 | #define Barrier2(n) t1 = t1C((n)) 150 | #define Barrier3(n) t1 = t1C((n)) 151 | 152 | //#define WORKSIZE 256 153 | #define MAXBUFFERS (4095) 154 | 155 | __kernel 156 | __attribute__((reqd_work_group_size(WORKSIZE, 1, 1))) 157 | void search( const uint state0, const uint state1, const uint state2, const uint state3, 158 | const uint state4, const uint state5, const uint state6, const uint state7, 159 | const uint B1, const uint C1, const uint D1, 160 | const uint F1, const uint G1, const uint H1, 161 | const u base, 162 | const uint W16, const uint W17, 163 | const uint PreVal4, const uint PreVal0, 164 | const uint PreW18, const uint PreW19, 165 | const uint PreW31, const uint PreW32, 166 | 167 | volatile __global uint * output) 168 | { 169 | 170 | 171 | u W[124]; 172 | u Vals[8]; 173 | 174 | //Dummy Variable to prevent compiler from reordering between rounds 175 | u t1; 176 | 177 | //Vals[0]=state0; 178 | Vals[1]=B1; 179 | Vals[2]=C1; 180 | Vals[3]=D1; 181 | //Vals[4]=PreVal4; 182 | Vals[5]=F1; 183 | Vals[6]=G1; 184 | Vals[7]=H1; 185 | 186 | W[16] = W16; 187 | W[17] = W17; 188 | 189 | #ifdef VECTORS4 190 | //Less dependencies to get both the local id and group id and then add them 191 | W[3] = base + (uint)(get_local_id(0)) * 4u + (uint)(get_group_id(0)) * (WORKSIZE * 4u); 192 | uint r = rot(W[3].x,25u)^rot(W[3].x,14u)^((W[3].x)>>3U); 193 | //Since only the 2 LSB is opposite between the nonces, we can save an instruction by flipping the 4 bits in W18 rather than the 1 bit in W3 194 | W[18] = PreW18 + (u){r, r ^ 0x2004000U, r ^ 0x4008000U, r ^ 0x600C000U}; 195 | #elif defined VECTORS2 196 | W[3] = base + (uint)(get_local_id(0)) * 2u + (uint)(get_group_id(0)) * (WORKSIZE * 2u); 197 | uint r = rot(W[3].x,25u)^rot(W[3].x,14u)^((W[3].x)>>3U); 198 | W[18] = PreW18 + (u){r, r ^ 0x2004000U}; 199 | #else 200 | W[3] = base + get_local_id(0) + get_group_id(0) * (WORKSIZE); 201 | u r = rot(W[3],25u)^rot(W[3],14u)^((W[3])>>3U); 202 | W[18] = PreW18 + r; 203 | #endif 204 | //the order of the W calcs and Rounds is like this because the compiler needs help finding how to order the instructions 205 | 206 | 207 | 208 | Vals[4] = PreVal4 + W[3]; 209 | Vals[0] = PreVal0 + W[3]; 210 | 211 | sharoundC(4); 212 | W[19] = PreW19 + W[3]; 213 | sharoundC(5); 214 | W[20] = P4C(20) + P1(20); 215 | sharoundC(6); 216 | W[21] = P1(21); 217 | sharoundC(7); 218 | W[22] = P3C(22) + P1(22); 219 | sharoundC(8); 220 | W[23] = W[16] + P1(23); 221 | sharoundC(9); 222 | W[24] = W[17] + P1(24); 223 | sharoundC(10); 224 | W[25] = P1(25) + P3(25); 225 | W[26] = P1(26) + P3(26); 226 | sharoundC(11); 227 | W[27] = P1(27) + P3(27); 228 | W[28] = P1(28) + P3(28); 229 | sharoundC(12); 230 | W[29] = P1(29) + P3(29); 231 | sharoundC(13); 232 | W[30] = P1(30) + P2C(30) + P3(30); 233 | W[31] = PreW31 + (P1(31) + P3(31)); 234 | sharoundC(14); 235 | W[32] = PreW32 + (P1(32) + P3(32)); 236 | sharoundC(15); 237 | sharound(16); 238 | sharound(17); 239 | sharound(18); 240 | sharound(19); 241 | sharound(20); 242 | sharound(21); 243 | sharound(22); 244 | sharound(23); 245 | sharound(24); 246 | sharound(25); 247 | sharound(26); 248 | sharound(27); 249 | sharound(28); 250 | sharound(29); 251 | sharound(30); 252 | sharound(31); 253 | sharound(32); 254 | sharoundW(33); 255 | sharoundW(34); 256 | sharoundW(35); 257 | sharoundW(36); 258 | sharoundW(37); 259 | sharoundW(38); 260 | sharoundW(39); 261 | sharoundW(40); 262 | sharoundW(41); 263 | sharoundW(42); 264 | sharoundW(43); 265 | sharoundW(44); 266 | sharoundW(45); 267 | sharoundW(46); 268 | sharoundW(47); 269 | sharoundW(48); 270 | sharoundW(49); 271 | sharoundW(50); 272 | sharoundW(51); 273 | sharoundW(52); 274 | sharoundW(53); 275 | sharoundW(54); 276 | sharoundW(55); 277 | sharoundW(56); 278 | sharoundW(57); 279 | sharoundW(58); 280 | sharoundW(59); 281 | sharoundW(60); 282 | sharoundW(61); 283 | sharoundW(62); 284 | sharoundW(63); 285 | 286 | W[64]=state0+Vals[0]; 287 | W[65]=state1+Vals[1]; 288 | W[66]=state2+Vals[2]; 289 | W[67]=state3+Vals[3]; 290 | W[68]=state4+Vals[4]; 291 | W[69]=state5+Vals[5]; 292 | W[70]=state6+Vals[6]; 293 | W[71]=state7+Vals[7]; 294 | 295 | Vals[0]=H[0]; 296 | Vals[1]=H[1]; 297 | Vals[2]=H[2]; 298 | Vals[3]=H[3]; 299 | Vals[4]=H[4]; 300 | Vals[5]=H[5]; 301 | Vals[6]=H[6]; 302 | Vals[7]=H[7]; 303 | 304 | //sharound(64 + 0); 305 | const u Temp = (0xb0edbdd0U + K[0]) + W[64]; 306 | Vals[7] = Temp + 0x08909ae5U; 307 | Vals[3] = 0xa54ff53aU + Temp; 308 | 309 | #define P124(n) P2(n) + P1(n) + P4(n) 310 | 311 | 312 | W[64 + 16] = + P2(64 + 16) + P4(64 + 16); 313 | sharound(64 + 1); 314 | W[64 + 17] = P1C(64 + 17) + P2(64 + 17) + P4(64 + 17); 315 | sharound(64 + 2); 316 | W[64 + 18] = P124(64 + 18); 317 | sharound(64 + 3); 318 | W[64 + 19] = P124(64 + 19); 319 | sharound(64 + 4); 320 | W[64 + 20] = P124(64 + 20); 321 | sharound(64 + 5); 322 | W[64 + 21] = P124(64 + 21); 323 | sharound(64 + 6); 324 | W[64 + 22] = P4(64 + 22) + P3C(64 + 22) + P2(64 + 22) + P1(64 + 22); 325 | sharound(64 + 7); 326 | W[64 + 23] = P4(64 + 23) + P3(64 + 23) + P2C(64 + 23) + P1(64 + 23); 327 | sharoundC(64 + 8); 328 | W[64 + 24] = P1(64 + 24) + P4C(64 + 24) + P3(64 + 24); 329 | sharoundC(64 + 9); 330 | W[64 + 25] = P3(64 + 25) + P1(64 + 25); 331 | sharoundC(64 + 10); 332 | W[64 + 26] = P3(64 + 26) + P1(64 + 26); 333 | sharoundC(64 + 11); 334 | W[64 + 27] = P3(64 + 27) + P1(64 + 27); 335 | sharoundC(64 + 12); 336 | W[64 + 28] = P3(64 + 28) + P1(64 + 28); 337 | sharoundC(64 + 13); 338 | W[64 + 29] = P1(64 + 29) + P3(64 + 29); 339 | W[64 + 30] = P3(64 + 30) + P2C(64 + 30) + P1(64 + 30); 340 | sharoundC(64 + 14); 341 | W[64 + 31] = P4C(64 + 31) + P3(64 + 31) + P2(64 + 31) + P1(64 + 31); 342 | sharoundC(64 + 15); 343 | sharound(64 + 16); 344 | sharound(64 + 17); 345 | sharound(64 + 18); 346 | sharound(64 + 19); 347 | sharound(64 + 20); 348 | sharound(64 + 21); 349 | sharound(64 + 22); 350 | sharound(64 + 23); 351 | sharound(64 + 24); 352 | sharound(64 + 25); 353 | sharound(64 + 26); 354 | sharound(64 + 27); 355 | sharound(64 + 28); 356 | sharound(64 + 29); 357 | sharound(64 + 30); 358 | sharound(64 + 31); 359 | sharoundW(64 + 32); 360 | sharoundW(64 + 33); 361 | sharoundW(64 + 34); 362 | sharoundW(64 + 35); 363 | sharoundW(64 + 36); 364 | sharoundW(64 + 37); 365 | sharoundW(64 + 38); 366 | sharoundW(64 + 39); 367 | sharoundW(64 + 40); 368 | sharoundW(64 + 41); 369 | sharoundW(64 + 42); 370 | sharoundW(64 + 43); 371 | sharoundW(64 + 44); 372 | sharoundW(64 + 45); 373 | sharoundW(64 + 46); 374 | sharoundW(64 + 47); 375 | sharoundW(64 + 48); 376 | sharoundW(64 + 49); 377 | sharoundW(64 + 50); 378 | sharoundW(64 + 51); 379 | sharoundW(64 + 52); 380 | sharoundW(64 + 53); 381 | sharoundW(64 + 54); 382 | sharoundW(64 + 55); 383 | sharoundW(64 + 56); 384 | sharoundW(64 + 57); 385 | sharoundW(64 + 58); 386 | 387 | W[117] += W[108] + Vals[3] + Vals[7] + P2(124) + P1(124) + Ch((Vals[0] + Vals[4]) + (K[59] + W(59+64)) + s1(64+59)+ ch(59+64),Vals[1],Vals[2]) - 388 | (-(K[60] + H[7]) - S1((Vals[0] + Vals[4]) + (K[59] + W(59+64)) + s1(64+59)+ ch(59+64))); 389 | 390 | #define FOUND (0x0F) 391 | #define SETFOUND(Xnonce) output[output[FOUND]++] = Xnonce 392 | 393 | #ifdef VECTORS4 394 | bool result = W[117].x & W[117].y & W[117].z & W[117].w; 395 | if (!result) { 396 | if (!W[117].x) 397 | SETFOUND(W[3].x); 398 | if (!W[117].y) 399 | SETFOUND(W[3].y); 400 | if (!W[117].z) 401 | SETFOUND(W[3].z); 402 | if (!W[117].w) 403 | SETFOUND(W[3].w); 404 | } 405 | #elif defined VECTORS2 406 | bool result = W[117].x & W[117].y; 407 | if (!result) { 408 | if (!W[117].x) 409 | SETFOUND(W[3].x); 410 | if (!W[117].y) 411 | SETFOUND(W[3].y); 412 | } 413 | #else 414 | if (!W[117]) 415 | SETFOUND(W[3]); 416 | #endif 417 | } 418 | --------------------------------------------------------------------------------