Skip to content

Commit d3473c8

Browse files
committed
WIP add proxy annex
1 parent 02b0963 commit d3473c8

5 files changed

+274
-0
lines changed

11-Annex-Proxy.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
## 11 Proxies
2+
3+
Proxies are entities that aggregate hashrate from multiple Mining Devices into a single Connection.
4+
5+
The following protocol primitives are based on the assumption that proxies are part of the infrastructure:
6+
- Extended Extranonces: allowing for efficient hashing space distribution.
7+
- Future Jobs: allowing for in-site caching of Future Jobs (therefore avoiding empty Jobs).
8+
9+
Proxies can be nested into multiple layers, depending on different needs for miner infrastructure.
10+
The infrastructure complexity may vary according to operational requirements, but a single proxy layer should suffice for most simple setups.
11+
12+
Proxies can be split in two main categories:
13+
14+
### 11.1 Mining Proxy
15+
16+
TODO: review correctness of this
17+
18+
A Mining Proxy covers the full scope of the Mining Protocol. It supports all types of channels, both for Upstream and Downstream Connections.
19+
20+
| | **Standard Channels** | **Group Channels** | **Extended Channels** |
21+
|----------------|-----------------------|--------------------|-----------------------|
22+
| **Upstream** | yes | yes | yes |
23+
| **Downstream** | yes | yes | yes |
24+
25+
A Mining Proxy is responsible for delivering Jobs to Downstream Channels and is a crucial piece of infrastructure for optimizing the hash space distribution across multiple SV2 Mining Devices (plus SV1 Mining Devices, in case a Translator Proxy is available Downstream).
26+
27+
A Mining Proxy can forward multiple Standard Channels to the Upstream, ideally one representing each SV2 Mining Device Downstream.
28+
The Upstream (Pool, JDC or another Mining Proxy) is expected to send a `SetGroupChannel` message aggregating different Standard Channels.
29+
The Upstream sends jobs via `NewExtendedMiningJob` to Group Channels, and if some Downstream is a Mining Device (i.e.: the `SetupConnection` had the `REQUIRES_STANDARD_JOBS` flag) the Mining Proxy converts that message into different `NewMiningJob` messages after calculating the correct Merkle Root based on each Standard Channel's `extranonce_prefix`.
30+
31+
Alternatively, a Mining Proxy could aggregate multiple Donwstream Standard Channels into a single Extended Channel. The Upstream sends Jobs via `NewExtendedMiningJob`, and for each Downstream SV2 Mining Device, the Mining Proxy sends different `NewMiningJob` message, where the Merkle Root is based on the Standard Channel's `extranonce_prefix`.
32+
33+
![](./img/mining_proxy_standard.png)
34+
35+
### 11.2 Translator Proxy
36+
37+
A Translator Proxy has a much more limited scope of functionality, when compared to a Mining Proxy.
38+
It can only open Extended Channels with its Upstream, and all its Downstream Connections are SV1.
39+
40+
Its main purpose is to allow legacy SV1 Mining Devices to be deployed within SV2 infrastructures.
41+
42+
| | **Standard Channels** | **Group Channels** | **Extended Channels** |
43+
|----------------|-----------------------|--------------------|-----------------------|
44+
| **Upstream** | no | no | yes |
45+
| **Downstream** | no (SV1) | no (SV1) | no (SV1) |
46+
47+
A Translator Proxy establishes SV1 connections with its Downstream SV1 Mining Devices, and establishes `extranonce_size` and a unique `extranonce_prefix` for each one of them via the `mining.set_extranonce` SV1 message.
48+
49+
It receives Extended Jobs from the Upstream via `NewExtendedMiningJob` messages. For each Downstream SV1 Mining Device, a `mining.notify` SV1 message is sent, and the SV1 Mining Devices are expected to calculate their own Merkle Roots while rolling over their assigned Extranonce space.
50+
51+
![](./img/translator_proxy.png)
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36" version="24.8.2">
3+
<diagram id="N4VejNDs0hO81L9vthc3" name="Mining Proxy Standard">
4+
<mxGraphModel dx="1434" dy="1987" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
5+
<root>
6+
<mxCell id="0" />
7+
<mxCell id="1" parent="0" />
8+
<mxCell id="DT3knt80q17mCQlJXY2i-1" value="Mining Proxy" style="rounded=0;whiteSpace=wrap;html=1;fillOpacity=100;" parent="1" vertex="1">
9+
<mxGeometry x="290" y="150" width="160" height="80" as="geometry" />
10+
</mxCell>
11+
<mxCell id="V2UcTeTZU-o2jDbRS0ZS-9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;shape=link;" parent="1" target="yj93N_Tji8AnoezUfCwW-3" edge="1">
12+
<mxGeometry relative="1" as="geometry">
13+
<mxPoint x="370" y="160.00000000000045" as="sourcePoint" />
14+
</mxGeometry>
15+
</mxCell>
16+
<mxCell id="V2UcTeTZU-o2jDbRS0ZS-6" value="&lt;font color=&quot;#ff99cc&quot;&gt;&lt;b&gt;Standard&lt;/b&gt; Channel&lt;/font&gt;&lt;div&gt;&lt;font color=&quot;#ff99cc&quot;&gt;channel_id=A&lt;br&gt;extranonce_prefix=A&lt;/font&gt;&lt;/div&gt;" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0;entryY=1;entryDx=0;entryDy=0;shape=link;strokeColor=#FF99CC;" parent="1" source="V2UcTeTZU-o2jDbRS0ZS-3" edge="1">
17+
<mxGeometry x="-0.0434" y="-30" relative="1" as="geometry">
18+
<mxPoint as="offset" />
19+
<mxPoint x="327.5735931287986" y="228.2842712474676" as="targetPoint" />
20+
</mxGeometry>
21+
</mxCell>
22+
<mxCell id="V2UcTeTZU-o2jDbRS0ZS-3" value="SV2 Mining&lt;div&gt;Device A&lt;/div&gt;" style="rhombus;whiteSpace=wrap;html=1;strokeColor=#FF99CC;" parent="1" vertex="1">
23+
<mxGeometry x="70" y="350" width="110" height="110" as="geometry" />
24+
</mxCell>
25+
<mxCell id="V2UcTeTZU-o2jDbRS0ZS-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;shape=link;strokeColor=#CC99FF;" parent="1" target="DT3knt80q17mCQlJXY2i-1" edge="1">
26+
<mxGeometry relative="1" as="geometry">
27+
<mxPoint x="370" y="240.00000000000045" as="targetPoint" />
28+
<mxPoint x="370" y="230" as="sourcePoint" />
29+
</mxGeometry>
30+
</mxCell>
31+
<mxCell id="V2UcTeTZU-o2jDbRS0ZS-8" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=1;entryY=1;entryDx=0;entryDy=0;shape=link;strokeColor=#B266FF;" parent="1" source="V2UcTeTZU-o2jDbRS0ZS-5" edge="1">
32+
<mxGeometry relative="1" as="geometry">
33+
<mxPoint x="412.4264068712014" y="228.2842712474676" as="targetPoint" />
34+
</mxGeometry>
35+
</mxCell>
36+
<mxCell id="V2UcTeTZU-o2jDbRS0ZS-5" value="SV2 Mining&lt;div&gt;Device B&lt;/div&gt;" style="rhombus;whiteSpace=wrap;html=1;strokeColor=#B266FF;" parent="1" vertex="1">
37+
<mxGeometry x="555" y="350" width="110" height="110" as="geometry" />
38+
</mxCell>
39+
<mxCell id="V2UcTeTZU-o2jDbRS0ZS-14" value="&lt;font color=&quot;#9933ff&quot;&gt;&lt;b style=&quot;&quot;&gt;Standard&lt;/b&gt; Channel&lt;/font&gt;&lt;div&gt;&lt;font color=&quot;#9933ff&quot;&gt;channel_id=B&lt;br&gt;extranonce_prefix=B&lt;/font&gt;&lt;/div&gt;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="1" connectable="0" vertex="1">
40+
<mxGeometry x="500.00365134908645" y="229.99820592225535" as="geometry">
41+
<mxPoint x="15" y="99" as="offset" />
42+
</mxGeometry>
43+
</mxCell>
44+
<mxCell id="yj93N_Tji8AnoezUfCwW-6" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.75;exitY=0;exitDx=0;exitDy=0;entryX=0.75;entryY=1;entryDx=0;entryDy=0;shape=link;strokeColor=#9933FF;" parent="1" source="yj93N_Tji8AnoezUfCwW-3" target="V2UcTeTZU-o2jDbRS0ZS-1" edge="1">
45+
<mxGeometry relative="1" as="geometry" />
46+
</mxCell>
47+
<mxCell id="yj93N_Tji8AnoezUfCwW-8" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.25;exitY=0;exitDx=0;exitDy=0;entryX=0.25;entryY=1;entryDx=0;entryDy=0;shape=link;strokeColor=#FF99CC;" parent="1" source="yj93N_Tji8AnoezUfCwW-3" target="V2UcTeTZU-o2jDbRS0ZS-1" edge="1">
48+
<mxGeometry relative="1" as="geometry" />
49+
</mxCell>
50+
<mxCell id="yj93N_Tji8AnoezUfCwW-18" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;textShadow=1;shadow=1;shadowColor=#FFFFFF;shadowOpacity=100;shadowOffsetX=1;shadowOffsetY=1;shadowBlur=1;" parent="1" source="yj93N_Tji8AnoezUfCwW-17" target="DT3knt80q17mCQlJXY2i-1" edge="1">
51+
<mxGeometry relative="1" as="geometry">
52+
<mxPoint x="309.9999999999941" y="200.00000000000045" as="targetPoint" />
53+
</mxGeometry>
54+
</mxCell>
55+
<mxCell id="yj93N_Tji8AnoezUfCwW-17" value="&lt;b&gt;NewExtendedMiningJob&lt;/b&gt;&lt;br&gt;channel_id=G&lt;br&gt;merkle_path=G&lt;br&gt;coinbase_prefix=G&lt;br&gt;coinbase_suffix=G" style="shape=parallelogram;perimeter=parallelogramPerimeter;whiteSpace=wrap;html=1;fixedSize=1;" parent="1" vertex="1">
56+
<mxGeometry x="120" y="-20" width="190" height="80" as="geometry" />
57+
</mxCell>
58+
<mxCell id="yj93N_Tji8AnoezUfCwW-22" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.25;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0;entryDx=0;entryDy=0;textShadow=1;shadow=1;shadowColor=#FFFFFF;shadowOpacity=100;shadowOffsetX=1;shadowOffsetY=1;shadowBlur=1;" parent="1" source="yj93N_Tji8AnoezUfCwW-19" target="V2UcTeTZU-o2jDbRS0ZS-3" edge="1">
59+
<mxGeometry relative="1" as="geometry" />
60+
</mxCell>
61+
<mxCell id="yj93N_Tji8AnoezUfCwW-19" value="&lt;b&gt;NewMiningJob&lt;/b&gt;&lt;div&gt;&lt;font color=&quot;#ff99cc&quot;&gt;channel_id=A&lt;br&gt;merkle_root=A&lt;/font&gt;&lt;/div&gt;" style="shape=parallelogram;perimeter=parallelogramPerimeter;whiteSpace=wrap;html=1;fixedSize=1;" parent="1" vertex="1">
62+
<mxGeometry x="50" y="220" width="120" height="60" as="geometry" />
63+
</mxCell>
64+
<mxCell id="yj93N_Tji8AnoezUfCwW-24" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.75;exitY=1;exitDx=0;exitDy=0;entryX=1;entryY=0;entryDx=0;entryDy=0;textShadow=1;shadow=1;shadowColor=#FFFFFF;shadowOpacity=100;shadowOffsetX=1;shadowOffsetY=1;shadowBlur=1;" parent="1" source="yj93N_Tji8AnoezUfCwW-20" target="V2UcTeTZU-o2jDbRS0ZS-5" edge="1">
65+
<mxGeometry relative="1" as="geometry" />
66+
</mxCell>
67+
<mxCell id="yj93N_Tji8AnoezUfCwW-20" value="&lt;b&gt;NewMiningJob&lt;/b&gt;&lt;div&gt;&lt;font color=&quot;#9933ff&quot;&gt;channel_id=B&lt;br&gt;merkle_root=B&lt;/font&gt;&lt;/div&gt;" style="shape=parallelogram;perimeter=parallelogramPerimeter;whiteSpace=wrap;html=1;fixedSize=1;" parent="1" vertex="1">
68+
<mxGeometry x="580" y="220" width="120" height="60" as="geometry" />
69+
</mxCell>
70+
<mxCell id="yj93N_Tji8AnoezUfCwW-27" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;textShadow=1;shadow=1;shadowColor=#FFFFFF;shadowOpacity=100;shadowOffsetX=1;shadowOffsetY=1;shadowBlur=1;" parent="1" source="yj93N_Tji8AnoezUfCwW-26" target="DT3knt80q17mCQlJXY2i-1" edge="1">
71+
<mxGeometry relative="1" as="geometry">
72+
<mxPoint x="430.00000000000614" y="200.00000000000045" as="targetPoint" />
73+
</mxGeometry>
74+
</mxCell>
75+
<mxCell id="yj93N_Tji8AnoezUfCwW-26" value="&lt;b&gt;SetGroupChannel&lt;/b&gt;&lt;div&gt;group_channel_id=G&lt;/div&gt;&lt;div&gt;channel_ids=[A,B]&lt;/div&gt;" style="shape=parallelogram;perimeter=parallelogramPerimeter;whiteSpace=wrap;html=1;fixedSize=1;" parent="1" vertex="1">
76+
<mxGeometry x="425" y="30" width="170" height="60" as="geometry" />
77+
</mxCell>
78+
<mxCell id="V2UcTeTZU-o2jDbRS0ZS-1" value="Connection" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
79+
<mxGeometry x="310" y="-90" width="120" height="20" as="geometry" />
80+
</mxCell>
81+
<mxCell id="DT3knt80q17mCQlJXY2i-3" value="Conn" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
82+
<mxGeometry x="310" y="230" width="40" height="20" as="geometry" />
83+
</mxCell>
84+
<mxCell id="DT3knt80q17mCQlJXY2i-8" value="Conn" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
85+
<mxGeometry x="390" y="230" width="40" height="20" as="geometry" />
86+
</mxCell>
87+
<mxCell id="RgBkzOm2UzhGMEhQhQTZ-1" value="Upstream&lt;br&gt;&lt;br&gt;&lt;div&gt;(Pool, JDC, or another Mining Proxy)&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
88+
<mxGeometry x="185" y="-270" width="370" height="180" as="geometry" />
89+
</mxCell>
90+
<mxCell id="yj93N_Tji8AnoezUfCwW-3" value="Group Channel&lt;div&gt;id=G&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#B3B3B3;fontColor=#333333;strokeColor=#666666;fillOpacity=100;" parent="1" vertex="1">
91+
<mxGeometry x="310" y="100" width="120" height="60" as="geometry" />
92+
</mxCell>
93+
</root>
94+
</mxGraphModel>
95+
</diagram>
96+
</mxfile>

0 commit comments

Comments
 (0)