Add payouts per share

This commit is contained in:
DataHoarder 2022-10-18 11:58:09 +02:00
parent beefaea3b7
commit c3ef42d2c0
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk
3 changed files with 37 additions and 2 deletions

View file

@ -354,8 +354,9 @@ curl --silent https://{{ getenv('NET_SERVICE_ADDRESS') }}/api/shares?limit=2
<hr/>
<div>
<h3 class="mono">/api/block_by_id/&lt;blockId&gt;[/raw]</h3>
<h3 class="mono">/api/block_by_id/&lt;blockId&gt;[/raw|/payouts]</h3>
<p>Response contains a block/share record on P2Pool by Id. You can select the JSON version or the binary hex format (various format versions exist, decoding is documented by source code). <em>coinbase</em> parameter can also be used here to decode coinbase outputs</p>
<p>Using <em>/payouts</em> you can query all payouts that include weights by this share.</p>
<pre class="smaller">
curl --silent https://{{ getenv('NET_SERVICE_ADDRESS') }}/api/block_by_id/bc827aeecb5a5254cec6c2fc9a07f49c1d3c03b92dea39c5d9b3fbb19affe0ef
{
@ -391,8 +392,9 @@ curl --silent https://{{ getenv('NET_SERVICE_ADDRESS') }}/api/block_by_id/bc827a
<hr/>
<div>
<h3 class="mono">/api/block_by_height/&lt;blockHeight&gt;[/raw]</h3>
<h3 class="mono">/api/block_by_height/&lt;blockHeight&gt;[/raw|/payouts]</h3>
<p>Response contains a block/share record on P2Pool by height. You can select the JSON version or the binary hex format (various format versions exist, decoding is documented by source code). <em>coinbase</em> parameter can also be used here to decode coinbase outputs</p>
<p>Using <em>/payouts</em> you can query all payouts that include weights by this share.</p>
<pre class="smaller">
curl --silent https://{{ getenv('NET_SERVICE_ADDRESS') }}/api/block_by_height/158450
{

View file

@ -126,6 +126,36 @@
</ul>
{% endif %}
<h2>Payouts share was weighted into</h2>
<table class="center datatable" style="max-width: calc(8em + 8em + 8em + 7em + 12em + 12em)">
<tr>
<th style="width: 8em;">Monero Height</th>
<th style="width: 8em;">P2Pool Height</th>
<th style="width: 8em;">Age <small>[h:m:s]</small></th>
<th style="width: 12em;">Coinbase Transaction</th>
<th style="width: 12em;" title="You can use this Private Key to verify payouts sent by P2Pool on each block through the Coinbase Transaction">Coinbase Tx Private Key</th>
</tr>
{% for p in payouts %}
<tr>
<th title="{{ p.main.id }}"><a href="/b/{{ p.main.height|benc }}">{{ p.main.height }}</a></th>
<th title="{{ p.id }}"><a href="/share/{{ p.id }}">{{ p.height }}</a></th>
<td title="{{ utc_date(p.timestamp) }}">{{ date_diff_short(p.timestamp) }}</td>
<td title="{{ p.coinbase.id }}" class="mono small"><a href="/t/{{ p.coinbase.id|henc }}">{{ p.coinbase.id|shorten(10) }}</a></td>
<td class="mono smaller" title="{{ p.coinbase.private_key }}">{{ p.coinbase.private_key|shorten(10) }} <a href="/p/{{ p.height|benc }}/{{ miner.id|benc }}" title="Prove you have a matching output for your address on this transaction">[[prove]]</a></td>
</tr>
{% endfor %}
{% if block.height > (pool.sidechain.height - pool.sidechain.window_size) %}
<tr>
<th colspan="5"><h3>Share is inside the PPLNS window. Any Monero blocks found during this period by any P2Pool miner will provide a direct payout.</h3></th>
</tr>
{% else %}
<tr>
<th colspan="5">Share is outside of the PPLNS window. No more payouts for this share will be provided by other P2Pool miners.</th>
</tr>
{% endif %}
</table>
<h2>Coinbase Transaction</h2>
{% if block.main.found %}

View file

@ -655,12 +655,15 @@ func main() {
}
}
payouts := getFromAPI(fmt.Sprintf("block_by_id/%s/payouts", block.(map[string]any)["id"].(string)))
poolInfo := getFromAPI("pool_info", 5)
ctx := make(map[string]stick.Value)
ctx["block"] = block
ctx["raw"] = raw
ctx["pool"] = poolInfo
ctx["payouts"] = payouts
render(writer, "share.html", ctx)
})