コード例 #1
0
ファイル: mining.php プロジェクト: Karasur/dashpay.org.ru
<? 
require_once($_SERVER['DOCUMENT_ROOT'].'/private/config.php');
require_once($_SERVER['DOCUMENT_ROOT'].'/private/init/mysql.php');
require_once($_SERVER['DOCUMENT_ROOT'].'/private/func.php');

$hashrate = 10*1000000;
$power = 0.25;
$price = 2;
$fee = 1;
$decode_diff = get_json_param('block');
$decode = get_json_param('rur');
$difficulty = $decode_diff['diff'];
$blockreward = blockreward($decode_diff['num'], $difficulty);

$dash = $decode['rur']*$decode['dash_usd'];
$seconds_per_day = 24*60*60; // 86400
$coins_per_day = ($seconds_per_day * $blockreward * $hashrate) / ($difficulty * (pow(2, 48) / hexdec('0x00000000ffff')));
$cost_per_day = round($power*$price*24, 2);

$coins_per_hour = round($coins_per_day/24, 4);
$coins_per_week = round($coins_per_day*7, 3);
$coins_per_month = round($coins_per_day*30, 2);
$coins_per_year = round($coins_per_day*365, 2);

$cost_per_hour = round($cost_per_day/24, 2);
$cost_per_week = round($cost_per_day*7);
$cost_per_month = round($cost_per_day*30);
$cost_per_year = round($cost_per_day*365);

$fee_hour = round(($coins_per_hour*1/100)*$dash, 4);
$fee_day = round(($coins_per_day*1/100)*$dash, 2);
コード例 #2
0
ファイル: stats.php プロジェクト: Karasur/dashpay.org.ru
<?
require_once($_SERVER['DOCUMENT_ROOT'].'/private/config.php');
require_once($_SERVER['DOCUMENT_ROOT'].'/private/init/mysql.php');
require_once($_SERVER['DOCUMENT_ROOT'].'/private/func.php');

$table = $table_market = $data_market = $transaction_table = $tx_rate = $block_table = $mn_count = $mntable = $hash_rate = $price_usd = $mtable = $diff_stat = $ghash_rate = $tpools = '';
$all_reward = $k = $other_reward = $pools_all_blocks = $pools_all_reward = $pools_all_hashrate = $step = $all_sum = $all_price = 0;
$pools_stats = array();
$rur = get_json_param('rur');
$markets = get_json_param('markets');

$query = $db->prepare("SELECT * FROM `mn_data`");
$query->execute();
while($row=$query->fetch()){
	$mntable = $mntable."<tr><td>{$row['ip']}</td><td>{$row['port']}</td><td>{$row['status']}</td><td><img src=\"https://dash.org.ru/img/16/".mb_strtolower(geoip_country_code_by_name($row['ip'])).".png\"> ".geoip_country_name_by_name($row['ip'])."</td><td>{$row['version']}</td><td><a href=\"https://chainz.cryptoid.info/dash/address.dws?{$row['address']}.htm\" target=\"_blank\">{$row['address']}</a></td></tr>";
}

//$query = $db->prepare("select sum(tx_sum), sum(txs), time from `data` group by month(from_unixtime(`time`)) order by `time` desc");
$query = $db->prepare("select sum(tx_sum), sum(txs), time from `data` group by concat(month(from_unixtime(`time`)),year(from_unixtime(`time`))) order by `time` desc");
$query->execute();
while($row=$query->fetch()){
	$transaction_table = $transaction_table."<tr><td>".date("Y, F" ,$row['time'])."</td><td>".round($row['sum(tx_sum)'])."</td><td>{$row['sum(txs)']}</td></tr>";
}

//$query = $db->prepare("select sum(tx_sum), time from `data` group by day(from_unixtime(`time`)) order by `time` asc");
$query = $db->prepare("select sum(tx_sum), date(from_unixtime(`time`)) as dateNum from `data` group by dateNum");
$query->execute();
while($row=$query->fetch()){
	if(empty($row["sum(tx_sum)"])) continue;
	//$tx_rate = "$tx_rate [{$row['time']}000, ".round($row["sum(tx_sum)"])."],";
	$tx_rate = "$tx_rate [".strtotime($row['dateNum'])."000, ".round($row["sum(tx_sum)"])."],";