consensus/cmd/web/views/index.qtpl

137 lines
6.4 KiB
Plaintext

{% import "git.gammaspectra.live/P2Pool/p2pool-observer/index" %}
{% import cmdutils "git.gammaspectra.live/P2Pool/p2pool-observer/cmd/utils" %}
{% code
type IndexPage struct {
// inherit from base page, so its' title is used in error page.
BasePage
Refresh int
Positions struct {
BlocksFound *cmdutils.PositionChart
}
Shares []*index.SideBlock
FoundBlocks []*index.FoundBlock
}
%}
{% func (p *IndexPage) Content() %}
<div style="text-align: center; font-weight: bold;">
{% if p.Refresh > 0 %}
<a href="/">Autorefresh is ON ({%d p.Refresh %} s)</a>
{% else %}
<a href="/?refresh">Autorefresh is OFF</a>
{% endif %}
</div>
<div style="text-align: center">
<h2>P2Pool statistics</h2>
<table class="center" style="max-width: calc(15em + 15em + 15em + 15em)">
<tr>
<th style="width: 15em">P2Pool Height</th>
<th style="width: 15em">P2Pool Hashrate</th>
<th style="width: 15em">Monero Height</th>
<th style="width: 15em">Monero Hashrate</th>
</tr>
<tr>
<td title="{%= hex(p.Context().Pool.SideChain.Id) %}"><a href="/share/{%= hex(p.Context().Pool.SideChain.Id) %}">{%dul p.Context().Pool.SideChain.Height %}</a></td>
<td>{%s si_units(diff_hashrate(p.Context().Pool.SideChain.Difficulty, p.Context().Consensus.TargetBlockTime), 2) %}H/s</td>
<td title="{%= hex(p.Context().Pool.MainChain.Id) %}"><a href="/b/{%s benc(p.Context().Pool.MainChain.Height) %}">{%dul p.Context().Pool.MainChain.Height %}</a></td>
<td>{%s si_units(diff_hashrate(p.Context().Pool.MainChain.Difficulty, uint64(p.Context().Pool.MainChain.BlockTime)), 2) %}H/s</td>
</tr>
<tr><th colspan="4">&nbsp;</th></tr>
<tr>
<th>P2Pool Difficulty</th>
<th title="Percentage of Monero hashrate P2Pool has">P2Pool Monero %</th>
<th>Monero Difficulty</th>
<th title="This includes blocks the site knows about since it started observing. There might be more orphaned or produced by other sidechain not included here.">Blocks Found</th>
</tr>
<tr>
<td>{%s si_units(p.Context().Pool.SideChain.Difficulty.Lo, 2) %}</td>
<td>{%f.2 (float64(diff_hashrate(p.Context().Pool.SideChain.Difficulty, p.Context().Consensus.TargetBlockTime)) / float64(diff_hashrate(p.Context().Pool.MainChain.Difficulty, uint64(p.Context().Pool.MainChain.BlockTime))))*100 %}%</td>
<td>{%s si_units(p.Context().Pool.MainChain.Difficulty.Lo, 2) %}</td>
<td>{%dul p.Context().Pool.SideChain.Found %}</td>
</tr>
<tr><th colspan="4">&nbsp;</th></tr>
<tr>
<th title="Miners that have ever mined a share on P2Pool">Miners Known</th>
<th>Average Effort</th>
<th title="Mean frequency between P2Pool finds Monero Blocks">Block Found Frequency</th>
<th>Last Found Block</th>
</tr>
<tr>
<td>{%dul p.Context().Pool.SideChain.Miners %}</td>
<td >
<span class="small" style="color: {%s effort_color(p.Context().Pool.SideChain.Effort.Average10) %};" title="Last 10 found blocks">{%f.2 p.Context().Pool.SideChain.Effort.Average10 %}%</span>
/
<span style="font-weight:bolder; color: {%s effort_color(p.Context().Pool.SideChain.Effort.Average50) %};" title="Last 50 found blocks">{%f.2 p.Context().Pool.SideChain.Effort.Average50 %}%</span>
/
<span class="small" style="color: {%s effort_color(p.Context().Pool.SideChain.Effort.Average200) %};" title="Last 200 found blocks">{%f.2 p.Context().Pool.SideChain.Effort.Average200 %}%</span>
</td>
<td>{%s time_duration_long(float64(p.Context().Pool.MainChain.Difficulty.Lo) / float64(diff_hashrate(p.Context().Pool.SideChain.Difficulty, p.Context().Consensus.TargetBlockTime))) %}</td>
{% if len(p.FoundBlocks) > 0 %}
<td title="{%s utc_date(p.FoundBlocks[0].MainBlock.Timestamp) %}">{%s time_elapsed_short(p.FoundBlocks[0].MainBlock.Timestamp) %}</td>
{% else %}
<td>-</td>
{% endif %}
</tr>
<tr><th colspan="4">&nbsp;</th></tr>
<tr>
<th title="Current miners on P2Pool PPLNS window"><a href="/miners">Window Miners</a></th>
<th>Current Effort</th>
<th>Window Blocks</th>
<th>Last Share</th>
</tr>
<tr>
<td><a href="/miners">{%d p.Context().Pool.SideChain.Window.Miners %}</a></td>
<td style="font-weight:bolder; color: {%s effort_color(p.Context().Pool.SideChain.Effort.Current) %};">
{%f.2 p.Context().Pool.SideChain.Effort.Current %}%
</td>
<td>{%d p.Context().Pool.SideChain.Window.Blocks %} blocks (+{%d p.Context().Pool.SideChain.Window.Uncles %} uncles)</td>
<td title="{%s utc_date(p.Context().Pool.SideChain.Timestamp) %}">{%s time_elapsed_short(p.Context().Pool.SideChain.Timestamp) %}</td>
</tr>
</table>
</div>
<div style="text-align: center">
<form action="/miner" method="get">
<h2>Lookup miner statistics</h2>
<div>
<label for="miner-address">Payout Monero address or Miner Alias</label><br/>
<input type="text" name="address" id="miner-address" placeholder="{%s p.Context().DonationAddress %}" size="96" class="mono"/>
</div>
<div style="margin-top: 10px">
<input type="submit" value="Lookup" style="width: 20em;"/>
</div>
</form>
<p>
<a href="/calculate-share-time">[Average share time calculator]</a> :: <a href="/connectivity-check">[Connectivity Check]</a>
</p>
<p>
<a href="/miners">[Current Window Miners]</a> :: <a href="/miners?weekly">[Weekly Miners]</a>
</p>
<p>
<a href="/transaction-lookup">[Sweep Transaction Lookup]</a> :: <a href="/sweeps">[Recent Likely Sweep Transactions]</a>
</p>
</div>
<hr/>
<div style="text-align: center">
<h2>Recent Monero blocks found by P2Pool miners</h2>
{%= TemplateFoundBlocks(p.Context(), p.FoundBlocks, false) %}
<div class="center"><a href="/blocks">[show more found blocks]</a></div>
<h3>Blocks found during last day</h3>
<code class="mono">{%s p.Positions.BlocksFound.String() %}</code>
</div>
<hr/>
<div style="text-align: center">
<h2>Recent P2Pool shares found</h2>
{%= TemplateShares(p.Context(), p.Shares, false, nil) %}
</div>
{% endfunc %}