Merge pull request #7 from TheSerapher/sharecounter-cron
Sharecounter cron
This commit is contained in:
commit
a995ab640d
58
cronjobs/sharecounter.php
Normal file
58
cronjobs/sharecounter.php
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
Copyright:: 2013, Sebastian Grewe
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Include all settings and classes
|
||||||
|
require_once('shared.inc.php');
|
||||||
|
|
||||||
|
// Fetch our last block found from the DB as a starting point
|
||||||
|
$aAllBlocks = $block->getAll('ASC');
|
||||||
|
foreach ($aAllBlocks as $iIndex => $aBlock) {
|
||||||
|
if (!$aBlock['accounted']) {
|
||||||
|
$iPrevBlockTime = @$aAllBlocks[$iIndex - 1]['time'];
|
||||||
|
if (!$iPrevBlockTime) {
|
||||||
|
$iPrevBlockTime = 0;
|
||||||
|
}
|
||||||
|
$aAccountShares = $share->getSharesForAccountsByTimeframe($aBlock['time'], $iPrevBlockTime);
|
||||||
|
$iRoundShares = $share->getRoundSharesByTimeframe($aBlock['time'], $iPrevBlockTime);
|
||||||
|
$strFinder = $share->getFinderByTimeframe($aBlock['time'], $iPrevBlockTime);
|
||||||
|
echo "ID\tHeight\tTime\t\tShares\tFinder\n";
|
||||||
|
echo $aBlock['id'] . "\t" . $aBlock['height'] . "\t" . $aBlock['time'] . "\t" . $iRoundShares . "\t" . $strFinder . "\n\n";
|
||||||
|
echo "ID\tUsername\tValid\tInvalid\tPercentage\tPayout\t\tStatus\n";
|
||||||
|
foreach ($aAccountShares as $key => $aData) {
|
||||||
|
$aData['percentage'] = number_format(round(( 100 / $iRoundShares ) * $aData['valid'], 10),10);
|
||||||
|
$aData['payout'] = number_format(round(( $aData['percentage'] / 100 ) * $config['reward'], 10), 10);
|
||||||
|
echo $aData['id'] . "\t" .
|
||||||
|
$aData['username'] . "\t" .
|
||||||
|
$aData['valid'] . "\t" .
|
||||||
|
$aData['invalid'] . "\t" .
|
||||||
|
$aData['percentage'] . "\t" .
|
||||||
|
$aData['payout'] . "\t";
|
||||||
|
if (!$statistics->updateShareStatistics($aData, $aBlock['id'])) {
|
||||||
|
echo "Stats Failed" . "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo "------------------------------------------------------------------------\n\n";
|
||||||
|
|
||||||
|
// Now that we have all shares counted internally let's update the tables
|
||||||
|
// Set shares as counted and mark block as accounted for
|
||||||
|
// $share->setCountedByTimeframe($aBlock['time'], $iPrevBlockTime);
|
||||||
|
// $block->setAccounted($aBlock['blockhash']);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -7,4 +7,6 @@ require_once(INCLUDE_DIR . '/smarty.inc.php');
|
|||||||
// Load classes that need the above as dependencies
|
// Load classes that need the above as dependencies
|
||||||
require_once(CLASS_DIR . '/user.class.php');
|
require_once(CLASS_DIR . '/user.class.php');
|
||||||
require_once(CLASS_DIR . '/block.class.php');
|
require_once(CLASS_DIR . '/block.class.php');
|
||||||
|
require_once(CLASS_DIR . '/share.class.php');
|
||||||
|
require_once(CLASS_DIR . '/statistics.class.php');
|
||||||
require_once(CLASS_DIR . '/settings.class.php');
|
require_once(CLASS_DIR . '/settings.class.php');
|
||||||
|
|||||||
@ -62,6 +62,22 @@ class Block {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setAccounted($blockhash='') {
|
||||||
|
if ($blockhash == '') return false;
|
||||||
|
$stmt = $this->mysqli->prepare("UPDATE $this->table SET accounted = 1 WHERE blockhash = ?");
|
||||||
|
if ($this->checkStmt($stmt)) {
|
||||||
|
$stmt->bind_param('s', $blockhash);
|
||||||
|
if (!$stmt->execute()) {
|
||||||
|
$this->debug->append("Failed to execute statement: " . $stmt->error);
|
||||||
|
$stmt->close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$stmt->close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private function checkStmt($bState) {
|
private function checkStmt($bState) {
|
||||||
if ($bState ===! true) {
|
if ($bState ===! true) {
|
||||||
$this->debug->append("Failed to prepare statement: " . $this->mysqli->error);
|
$this->debug->append("Failed to prepare statement: " . $this->mysqli->error);
|
||||||
|
|||||||
137
public/include/classes/share.class.php
Normal file
137
public/include/classes/share.class.php
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// Make sure we are called from index.php
|
||||||
|
if (!defined('SECURITY'))
|
||||||
|
die('Hacking attempt');
|
||||||
|
|
||||||
|
class Share {
|
||||||
|
private $sError = '';
|
||||||
|
private $table = 'shares';
|
||||||
|
// This defines each share
|
||||||
|
public $rem_host, $username, $our_result, $upstream_result, $reason, $solution, $time;
|
||||||
|
|
||||||
|
public function __construct($debug, $mysqli, $salt) {
|
||||||
|
$this->debug = $debug;
|
||||||
|
$this->mysqli = $mysqli;
|
||||||
|
$this->debug->append("Instantiated Share class", 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// get and set methods
|
||||||
|
private function setErrorMessage($msg) {
|
||||||
|
$this->sError = $msg;
|
||||||
|
}
|
||||||
|
public function getError() {
|
||||||
|
return $this->sError;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSharesForAccountsByTimeframe($current='', $old='') {
|
||||||
|
$stmt = $this->mysqli->prepare("SELECT
|
||||||
|
a.id,
|
||||||
|
validT.account AS username,
|
||||||
|
sum(validT.valid) as valid,
|
||||||
|
IFNULL(sum(invalidT.invalid),0) as invalid
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT DISTINCT
|
||||||
|
SUBSTRING_INDEX( `username` , '.', 1 ) as account,
|
||||||
|
COUNT(id) AS valid
|
||||||
|
FROM $this->table
|
||||||
|
WHERE
|
||||||
|
UNIX_TIMESTAMP(time) BETWEEN ? AND ?
|
||||||
|
AND
|
||||||
|
our_result = 'Y'
|
||||||
|
AND
|
||||||
|
counted = 0
|
||||||
|
GROUP BY account
|
||||||
|
) validT
|
||||||
|
LEFT JOIN
|
||||||
|
(
|
||||||
|
SELECT DISTINCT
|
||||||
|
SUBSTRING_INDEX( `username` , '.', 1 ) as account,
|
||||||
|
COUNT(id) AS invalid
|
||||||
|
FROM $this->table
|
||||||
|
WHERE
|
||||||
|
UNIX_TIMESTAMP(time) BETWEEN ? AND ?
|
||||||
|
AND
|
||||||
|
our_result = 'N'
|
||||||
|
AND
|
||||||
|
counted = 0
|
||||||
|
GROUP BY account
|
||||||
|
) invalidT
|
||||||
|
ON validT.account = invalidT.account
|
||||||
|
INNER JOIN accounts a ON a.username = validT.account
|
||||||
|
GROUP BY a.username DESC");
|
||||||
|
if ($this->checkStmt($stmt)) {
|
||||||
|
$stmt->bind_param('iiii', $old, $current, $old, $current);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
|
return $result->fetch_all(MYSQLI_ASSOC);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRoundSharesByTimeframe($current='', $old='') {
|
||||||
|
$stmt = $this->mysqli->prepare("SELECT
|
||||||
|
count(id) as total
|
||||||
|
FROM $this->table
|
||||||
|
WHERE our_result = 'Y'
|
||||||
|
AND UNIX_TIMESTAMP(time) BETWEEN ? AND ?
|
||||||
|
AND counted = 0
|
||||||
|
");
|
||||||
|
if ($this->checkStmt($stmt)) {
|
||||||
|
$stmt->bind_param('ii', $old, $current);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
|
return $result->fetch_object()->total;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCountedByTimeframe($current='', $old='') {
|
||||||
|
$stmt = $this->mysqli->prepare("UPDATE $this->table
|
||||||
|
SET
|
||||||
|
counted = 1
|
||||||
|
WHERE
|
||||||
|
UNIX_TIMESTAMP(time) BETWEEN ? AND ?
|
||||||
|
AND counted = 0
|
||||||
|
");
|
||||||
|
if ($this->checkStmt($stmt)) {
|
||||||
|
$stmt->bind_param('ii', $old, $current);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFinderByTimeframe($current='', $old='') {
|
||||||
|
$stmt = $this->mysqli->prepare("SELECT
|
||||||
|
SUBSTRING_INDEX( `username` , '.', 1 ) AS account
|
||||||
|
FROM $this->table
|
||||||
|
WHERE upstream_result = 'Y'
|
||||||
|
AND UNIX_TIMESTAMP(time) BETWEEN ? AND ?
|
||||||
|
ORDER BY id DESC");
|
||||||
|
if ($this->checkStmt($stmt)) {
|
||||||
|
$stmt->bind_param('ii', $old, $current);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
|
return @$result->fetch_object()->account;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkStmt($bState) {
|
||||||
|
if ($bState ===! true) {
|
||||||
|
$this->debug->append("Failed to prepare statement: " . $this->mysqli->error);
|
||||||
|
$this->setErrorMessage('Internal application Error');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$share = new Share($debug, $mysqli, SALT);
|
||||||
48
public/include/classes/statistics.class.php
Normal file
48
public/include/classes/statistics.class.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// Make sure we are called from index.php
|
||||||
|
if (!defined('SECURITY'))
|
||||||
|
die('Hacking attempt');
|
||||||
|
|
||||||
|
class Statistics {
|
||||||
|
private $sError = '';
|
||||||
|
private $table = 'statistics_shares';
|
||||||
|
// This defines each statistic
|
||||||
|
public $valid, $invalid, $block, $user;
|
||||||
|
|
||||||
|
public function __construct($debug, $mysqli, $salt) {
|
||||||
|
$this->debug = $debug;
|
||||||
|
$this->mysqli = $mysqli;
|
||||||
|
$this->debug->append("Instantiated Share class", 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// get and set methods
|
||||||
|
private function setErrorMessage($msg) {
|
||||||
|
$this->sError = $msg;
|
||||||
|
}
|
||||||
|
public function getError() {
|
||||||
|
return $this->sError;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateShareStatistics($aStats, $iBlockId) {
|
||||||
|
$stmt = $this->mysqli->prepare("INSERT INTO $this->table (account_id, valid, invalid, block_id) VALUES (?, ?, ?, ?, ?)");
|
||||||
|
if ($this->checkStmt($stmt)) {
|
||||||
|
$stmt->bind_param('iiiddi', $aStats['id'], $aStats['valid'], $aStats['invalid'], $iBlockId);
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkStmt($bState) {
|
||||||
|
if ($bState ===! true) {
|
||||||
|
$this->debug->append("Failed to prepare statement: " . $this->mysqli->error);
|
||||||
|
$this->setErrorMessage('Failed to prepare statement');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$statistics = new Statistics($debug, $mysqli, SALT);
|
||||||
@ -7,7 +7,7 @@ if (!defined('SECURITY'))
|
|||||||
class User {
|
class User {
|
||||||
private $sError = '';
|
private $sError = '';
|
||||||
private $userID = false;
|
private $userID = false;
|
||||||
private $table = 'webUsers';
|
private $table = 'accounts';
|
||||||
private $user = array();
|
private $user = array();
|
||||||
private $tableAccountBalance = 'accountBalance';
|
private $tableAccountBalance = 'accountBalance';
|
||||||
private $tablePoolWorker = 'pool_worker';
|
private $tablePoolWorker = 'pool_worker';
|
||||||
|
|||||||
@ -14,16 +14,16 @@ if ($bitcoin->can_connect() === true){
|
|||||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Unable to connect to pushpool service: ' . $bitcoin->can_connect(), 'TYPE' => 'errormsg');
|
$_SESSION['POPUP'][] = array('CONTENT' => 'Unable to connect to pushpool service: ' . $bitcoin->can_connect(), 'TYPE' => 'errormsg');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Disabled Stats
|
||||||
// Top 15 hashrate list
|
// Top 15 hashrate list
|
||||||
$stmt = $mysqli->prepare("SELECT username, id, hashrate FROM webUsers WHERE hashrate != '0' ORDER BY hashrate DESC LIMIT 15");
|
$stmt = $mysqli->prepare("SELECT username, id, hashrate FROM accounts WHERE hashrate != '0' ORDER BY hashrate DESC LIMIT 15");
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$hashrates= $stmt->get_result();
|
$hashrates= $stmt->get_result();
|
||||||
$aHashData = $hashrates->fetch_all(MYSQLI_ASSOC);
|
$aHashData = $hashrates->fetch_all(MYSQLI_ASSOC);
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
|
|
||||||
// Top 15 Contributors
|
// Top 15 Contributors
|
||||||
# SELECT id, shares_this_round AS shares FROM webUsers WHERE shares_this_round > 0 ORDER BY shares DESC LIMIT
|
$stmt = $mysqli->prepare("SELECT id, shares_this_round AS shares, username FROM accounts WHERE shares_this_round > 0 ORDER BY shares DESC LIMIT 15");
|
||||||
$stmt = $mysqli->prepare("SELECT id, shares_this_round AS shares, username FROM webUsers WHERE shares_this_round > 0 ORDER BY shares DESC LIMIT 15");
|
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$contributors = $stmt->get_result();
|
$contributors = $stmt->get_result();
|
||||||
$aContributorData = $contributors->fetch_all(MYSQLI_ASSOC);
|
$aContributorData = $contributors->fetch_all(MYSQLI_ASSOC);
|
||||||
@ -36,8 +36,9 @@ $blocks = $stmt->get_result();
|
|||||||
$aBlockData = $blocks->fetch_array();
|
$aBlockData = $blocks->fetch_array();
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
|
|
||||||
|
*/
|
||||||
// Grab the last 10 blocks found
|
// Grab the last 10 blocks found
|
||||||
$stmt = $mysqli->prepare("SELECT DISTINCT w.shareCount AS shares, w.username, n.blockNumber, n.confirms, n.timestamp FROM winning_shares w, networkBlocks n WHERE w.blockNumber = n.blockNumber ORDER BY w.blockNumber DESC LIMIT 10");
|
$stmt = $mysqli->prepare("SELECT DISTINCT * FROM blocks ORDER BY height DESC LIMIT 10");
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$blocksfound = $stmt->get_result();
|
$blocksfound = $stmt->get_result();
|
||||||
$aBlocksFoundData = $blocksfound->fetch_all(MYSQLI_ASSOC);
|
$aBlocksFoundData = $blocksfound->fetch_all(MYSQLI_ASSOC);
|
||||||
|
|||||||
@ -15,11 +15,11 @@
|
|||||||
{section block $BLOCKSFOUND}
|
{section block $BLOCKSFOUND}
|
||||||
{assign var=user value="."|explode:$BLOCKSFOUND[block].username}
|
{assign var=user value="."|explode:$BLOCKSFOUND[block].username}
|
||||||
<tr class="{cycle values="odd,even"}">
|
<tr class="{cycle values="odd,even"}">
|
||||||
<td>{$BLOCKSFOUND[block].blockNumber}</td>
|
<td>{$BLOCKSFOUND[block].height}</td>
|
||||||
<td>{if $BLOCKSFOUND[block].confirms >= 120}<font color="green">Confirmed</font>{else}<font color="orange">{$BLOCKSFOUND[block].confirms - 120} left</font>{/if}</td>
|
<td>{if $BLOCKSFOUND[block].confirmations >= 120}<font color="green">Confirmed</font>{else}<font color="orange">{$BLOCKSFOUND[block].confirms - 120} left</font>{/if}</td>
|
||||||
<td>{$user.0}</td>
|
<td>{$user.0|default:"unknown"}</td>
|
||||||
<td>{$BLOCKSFOUND[block].timestamp|date_format:"%d/%m/%Y %H:%M:%S"}</td>
|
<td>{$BLOCKSFOUND[block].time|date_format:"%d/%m/%Y %H:%M:%S"}</td>
|
||||||
<td>{$BLOCKSFOUND[block].shares|number_format}</td>
|
<td>{$BLOCKSFOUND[block].difficulty|number_format}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/section}
|
{/section}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@ -1,28 +1,32 @@
|
|||||||
-- MySQL dump 10.13 Distrib 5.5.31, for Linux (x86_64)
|
-- phpMyAdmin SQL Dump
|
||||||
|
-- version 3.5.8.1deb1
|
||||||
|
-- http://www.phpmyadmin.net
|
||||||
--
|
--
|
||||||
-- Host: localhost Database: litecoin
|
-- Host: localhost
|
||||||
-- ------------------------------------------------------
|
-- Erstellungszeit: 10. Mai 2013 um 22:41
|
||||||
-- Server version 5.5.31-log
|
-- Server Version: 5.5.31-0ubuntu0.13.04.1
|
||||||
|
-- PHP-Version: 5.4.9-4ubuntu2
|
||||||
|
|
||||||
|
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
|
||||||
|
SET time_zone = "+00:00";
|
||||||
|
|
||||||
|
|
||||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||||
/*!40101 SET NAMES utf8 */;
|
/*!40101 SET NAMES utf8 */;
|
||||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
|
||||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
|
||||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
|
||||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
|
||||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
|
||||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table structure for table `accountBalance`
|
-- Datenbank: `mmcfe_ng`
|
||||||
--
|
--
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `accountBalance`;
|
-- --------------------------------------------------------
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
--
|
||||||
CREATE TABLE `accountBalance` (
|
-- Tabellenstruktur für Tabelle `accountBalance`
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `accountBalance` (
|
||||||
`id` int(255) NOT NULL AUTO_INCREMENT,
|
`id` int(255) NOT NULL AUTO_INCREMENT,
|
||||||
`userId` int(255) NOT NULL,
|
`userId` int(255) NOT NULL,
|
||||||
`balance` varchar(40) DEFAULT NULL,
|
`balance` varchar(40) DEFAULT NULL,
|
||||||
@ -32,17 +36,53 @@ CREATE TABLE `accountBalance` (
|
|||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `userId` (`userId`),
|
UNIQUE KEY `userId` (`userId`),
|
||||||
KEY `b_userId` (`userId`)
|
KEY `b_userId` (`userId`)
|
||||||
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table structure for table `ledger`
|
-- Tabellenstruktur für Tabelle `accounts`
|
||||||
--
|
--
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `ledger`;
|
CREATE TABLE IF NOT EXISTS `accounts` (
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
`id` int(255) NOT NULL AUTO_INCREMENT,
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
`admin` int(1) NOT NULL,
|
||||||
CREATE TABLE `ledger` (
|
`username` varchar(40) CHARACTER SET latin1 NOT NULL,
|
||||||
|
`pass` varchar(255) CHARACTER SET latin1 NOT NULL,
|
||||||
|
`email` varchar(255) CHARACTER SET latin1 NOT NULL COMMENT 'Assocaited email: used for validating users, and re-setting passwords',
|
||||||
|
`loggedIp` varchar(255) CHARACTER SET latin1 NOT NULL,
|
||||||
|
`sessionTimeoutStamp` int(255) NOT NULL,
|
||||||
|
`pin` varchar(255) CHARACTER SET latin1 NOT NULL COMMENT 'four digit pin to allow account changes',
|
||||||
|
`donate_percent` varchar(11) CHARACTER SET latin1 DEFAULT '0',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;
|
||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Tabellenstruktur für Tabelle `blocks`
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `blocks` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`height` int(10) unsigned NOT NULL,
|
||||||
|
`blockhash` char(64) CHARACTER SET utf8 NOT NULL,
|
||||||
|
`confirmations` int(10) unsigned NOT NULL,
|
||||||
|
`amount` float NOT NULL,
|
||||||
|
`time` int(11) NOT NULL,
|
||||||
|
`accounted` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `height` (`height`,`blockhash`),
|
||||||
|
KEY `timestamp` (`time`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Discovered blocks persisted from Litecoin Service' AUTO_INCREMENT=25 ;
|
||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Tabellenstruktur für Tabelle `ledger`
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `ledger` (
|
||||||
`id` int(255) NOT NULL AUTO_INCREMENT,
|
`id` int(255) NOT NULL AUTO_INCREMENT,
|
||||||
`userId` int(255) NOT NULL,
|
`userId` int(255) NOT NULL,
|
||||||
`transType` varchar(40) DEFAULT NULL,
|
`transType` varchar(40) DEFAULT NULL,
|
||||||
@ -52,35 +92,15 @@ CREATE TABLE `ledger` (
|
|||||||
`assocBlock` int(255) DEFAULT '0',
|
`assocBlock` int(255) DEFAULT '0',
|
||||||
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=latin1;
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=16 ;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table structure for table `networkBlocks`
|
-- Tabellenstruktur für Tabelle `pool_worker`
|
||||||
--
|
--
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `networkBlocks`;
|
CREATE TABLE IF NOT EXISTS `pool_worker` (
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
|
||||||
CREATE TABLE `networkBlocks` (
|
|
||||||
`id` int(255) NOT NULL AUTO_INCREMENT,
|
|
||||||
`blockNumber` int(255) NOT NULL,
|
|
||||||
`timestamp` int(255) NOT NULL,
|
|
||||||
`accountAddress` varchar(255) NOT NULL,
|
|
||||||
`confirms` int(255) NOT NULL,
|
|
||||||
`difficulty` varchar(240) NOT NULL,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=MyISAM AUTO_INCREMENT=14158 DEFAULT CHARSET=latin1;
|
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `pool_worker`
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `pool_worker`;
|
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
|
||||||
CREATE TABLE `pool_worker` (
|
|
||||||
`id` int(255) NOT NULL AUTO_INCREMENT,
|
`id` int(255) NOT NULL AUTO_INCREMENT,
|
||||||
`associatedUserId` int(255) NOT NULL,
|
`associatedUserId` int(255) NOT NULL,
|
||||||
`username` char(50) DEFAULT NULL,
|
`username` char(50) DEFAULT NULL,
|
||||||
@ -89,31 +109,27 @@ CREATE TABLE `pool_worker` (
|
|||||||
`hashrate` int(11) DEFAULT NULL,
|
`hashrate` int(11) DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `p_username` (`username`)
|
KEY `p_username` (`username`)
|
||||||
) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=21 ;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table structure for table `settings`
|
-- Tabellenstruktur für Tabelle `settings`
|
||||||
--
|
--
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `settings`;
|
CREATE TABLE IF NOT EXISTS `settings` (
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
|
||||||
CREATE TABLE `settings` (
|
|
||||||
`setting` varchar(255) NOT NULL,
|
`setting` varchar(255) NOT NULL,
|
||||||
`value` varchar(255) DEFAULT NULL,
|
`value` varchar(255) DEFAULT NULL,
|
||||||
PRIMARY KEY (`setting`)
|
PRIMARY KEY (`setting`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table structure for table `shares`
|
-- Tabellenstruktur für Tabelle `shares`
|
||||||
--
|
--
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `shares`;
|
CREATE TABLE IF NOT EXISTS `shares` (
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
|
||||||
CREATE TABLE `shares` (
|
|
||||||
`id` bigint(30) NOT NULL AUTO_INCREMENT,
|
`id` bigint(30) NOT NULL AUTO_INCREMENT,
|
||||||
`rem_host` varchar(255) NOT NULL,
|
`rem_host` varchar(255) NOT NULL,
|
||||||
`username` varchar(120) NOT NULL,
|
`username` varchar(120) NOT NULL,
|
||||||
@ -123,147 +139,8 @@ CREATE TABLE `shares` (
|
|||||||
`solution` varchar(257) NOT NULL,
|
`solution` varchar(257) NOT NULL,
|
||||||
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=1506135 DEFAULT CHARSET=latin1;
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1507278 ;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `shares_counted`
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `shares_counted`;
|
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
|
||||||
CREATE TABLE `shares_counted` (
|
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`blockNumber` int(11) NOT NULL,
|
|
||||||
`userId` int(11) NOT NULL,
|
|
||||||
`count` int(11) NOT NULL,
|
|
||||||
`invalid` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`counted` int(1) NOT NULL DEFAULT '1',
|
|
||||||
`score` double(23,2) DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=MyISAM AUTO_INCREMENT=27107 DEFAULT CHARSET=utf8;
|
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `shares_history`
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `shares_history`;
|
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
|
||||||
CREATE TABLE `shares_history` (
|
|
||||||
`id` bigint(30) NOT NULL AUTO_INCREMENT,
|
|
||||||
`counted` int(1) NOT NULL COMMENT 'BOOLEAN) Tells server if it used these shares for counting',
|
|
||||||
`blockNumber` int(255) NOT NULL,
|
|
||||||
`rem_host` varchar(255) NOT NULL,
|
|
||||||
`username` varchar(120) NOT NULL,
|
|
||||||
`our_result` enum('Y','N') NOT NULL,
|
|
||||||
`upstream_result` enum('Y','N') DEFAULT NULL,
|
|
||||||
`reason` varchar(50) DEFAULT NULL,
|
|
||||||
`solution` varchar(257) NOT NULL,
|
|
||||||
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
`score` double(23,2) DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
KEY `sh_blocknumber` (`blockNumber`),
|
|
||||||
KEY `sh_counted` (`counted`)
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=1519630 DEFAULT CHARSET=latin1;
|
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `shares_uncounted`
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `shares_uncounted`;
|
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
|
||||||
CREATE TABLE `shares_uncounted` (
|
|
||||||
`id` bigint(30) NOT NULL AUTO_INCREMENT,
|
|
||||||
`blockNumber` int(11) NOT NULL,
|
|
||||||
`userId` int(11) NOT NULL,
|
|
||||||
`count` int(11) NOT NULL,
|
|
||||||
`invalid` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`counted` int(1) NOT NULL DEFAULT '0',
|
|
||||||
`score` double(23,2) DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=MyISAM AUTO_INCREMENT=27856 DEFAULT CHARSET=utf8;
|
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `userHashrates`
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `userHashrates`;
|
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
|
||||||
CREATE TABLE `userHashrates` (
|
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
||||||
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
`userId` int(255) NOT NULL,
|
|
||||||
`hashrate` int(11) NOT NULL DEFAULT '0',
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
KEY `timestamp` (`timestamp`),
|
|
||||||
KEY `userHashrates_id1` (`userId`),
|
|
||||||
KEY `userId_timestamp` (`userId`,`timestamp`)
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=133959 DEFAULT CHARSET=latin1;
|
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `webUsers`
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `webUsers`;
|
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
|
||||||
CREATE TABLE `webUsers` (
|
|
||||||
`id` int(255) NOT NULL AUTO_INCREMENT,
|
|
||||||
`admin` int(1) NOT NULL,
|
|
||||||
`username` varchar(40) NOT NULL,
|
|
||||||
`pass` varchar(255) NOT NULL,
|
|
||||||
`email` varchar(255) NOT NULL COMMENT 'Assocaited email: used for validating users, and re-setting passwords',
|
|
||||||
`emailAuthPin` varchar(10) NOT NULL COMMENT 'The pin required to authorize that email address',
|
|
||||||
`secret` varchar(10) NOT NULL,
|
|
||||||
`loggedIp` varchar(255) NOT NULL,
|
|
||||||
`sessionTimeoutStamp` int(255) NOT NULL,
|
|
||||||
`accountLocked` int(255) NOT NULL COMMENT 'This is the timestamp when the account will be unlocked(usually used to lock accounts that are trying to be bruteforced)',
|
|
||||||
`accountFailedAttempts` int(2) NOT NULL COMMENT 'This counts the number of failed attempts for web login',
|
|
||||||
`pin` varchar(255) NOT NULL COMMENT 'four digit pin to allow account changes',
|
|
||||||
`share_count` int(11) DEFAULT NULL,
|
|
||||||
`stale_share_count` int(11) DEFAULT NULL,
|
|
||||||
`shares_this_round` int(11) DEFAULT NULL,
|
|
||||||
`api_key` varchar(255) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL,
|
|
||||||
`activeEmail` int(1) DEFAULT NULL,
|
|
||||||
`hashrate` int(11) DEFAULT NULL,
|
|
||||||
`donate_percent` varchar(11) DEFAULT '0',
|
|
||||||
`round_estimate` varchar(40) DEFAULT '0',
|
|
||||||
`account_type` int(1) NOT NULL DEFAULT '0' COMMENT '0 = normal account, 9 = early-adopter no-fee',
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
|
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `winning_shares`
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `winning_shares`;
|
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
|
||||||
CREATE TABLE `winning_shares` (
|
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`blockNumber` int(11) NOT NULL,
|
|
||||||
`username` varchar(50) NOT NULL,
|
|
||||||
`shareCount` int(11) NOT NULL DEFAULT '0',
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
|
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
||||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
|
||||||
|
|
||||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
|
||||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
|
||||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
|
||||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
|
||||||
|
|
||||||
-- Dump completed on 2013-05-06 14:05:24
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user