Skip to content

Commit

Permalink
apply @plebhash review
Browse files Browse the repository at this point in the history
  • Loading branch information
lorbax committed Sep 9, 2024
1 parent 5e3e766 commit 22c62a9
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 43 deletions.
6 changes: 4 additions & 2 deletions pplns-with-job-declaration.aux
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@
\citation{ocean}
\citation{extension}
\@writefile{toc}{\contentsline {section}{\numberline {1}Introduction}{1}{section.1}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {2}Slices and windows}{1}{section.2}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {2}Slices}{1}{section.2}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {3}Scores}{2}{section.3}\protected@file@percent }
\citation{ocean}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.1}Difficulty-based score}{3}{subsection.3.1}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {3.2}Fee-based score}{3}{subsection.3.2}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {3.3}Payout for each share}{4}{subsection.3.3}\protected@file@percent }
\newlabel{properties-diff-based-score}{{3.2.1}{4}{Fee-based score}{remark.3.2.1}{}}
\newlabel{addstoone}{{5}{4}{Fee-based score}{Item.7}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {3.3}Payout for each share}{5}{subsection.3.3}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {4}Shares' accountability}{5}{section.4}\protected@file@percent }
\citation{demand}
\citation{sv2}
Expand Down
66 changes: 34 additions & 32 deletions pplns-with-job-declaration.log
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022/Debian) (preloaded format=pdflatex 2024.8.8) 29 AUG 2024 10:09
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022/Debian) (preloaded format=pdflatex 2024.8.8) 9 SEP 2024 13:27
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
Expand Down Expand Up @@ -295,33 +295,35 @@ Package caption Info: hyperref package is loaded.
\sf@top=\skip57
\sf@bottom=\skip58
)
\c@remark=\count294

(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def
File: l3backend-pdftex.def 2023-01-16 L3 backend support: PDF output (pdfTeX)
\l__color_backend_stack_int=\count294
\l__color_backend_stack_int=\count295
\l__pdf_internal_box=\box53
)
(./pplns-with-job-declaration.aux)
\openout1 = `pplns-with-job-declaration.aux'.

LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 17.
LaTeX Font Info: ... okay on input line 17.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 17.
LaTeX Font Info: ... okay on input line 17.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 17.
LaTeX Font Info: ... okay on input line 17.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 17.
LaTeX Font Info: ... okay on input line 17.
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 17.
LaTeX Font Info: ... okay on input line 17.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 17.
LaTeX Font Info: ... okay on input line 17.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 17.
LaTeX Font Info: ... okay on input line 17.
LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 17.
LaTeX Font Info: ... okay on input line 17.
LaTeX Font Info: Checking defaults for PU/pdf/m/n on input line 17.
LaTeX Font Info: ... okay on input line 17.
Package hyperref Info: Link coloring OFF on input line 17.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for PU/pdf/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
Package hyperref Info: Link coloring OFF on input line 19.
(./pplns-with-job-declaration.out)
(./pplns-with-job-declaration.out)
\@outlinefile=\write3
Expand Down Expand Up @@ -369,24 +371,24 @@ Package caption Info: End \AtBeginDocument code.

{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] [2] [3] [4] [5] [6]
[7]
Underfull \hbox (badness 10000) in paragraph at lines 172--174
Underfull \hbox (badness 10000) in paragraph at lines 181--183
[]\OT1/cmr/m/n/10.95 Extension on share ac-count-ing []$\OT1/cmtt/m/n/10.95 htt
ps : / / github . com / demand-[]open-[]source /
[]

[8] (./pplns-with-job-declaration.aux)
Package rerunfilecheck Info: File `pplns-with-job-declaration.out' has not chan
ged.
(rerunfilecheck) Checksum: 031A0800F7BF9FA752CA22FFC6BB36FB;1215.
(rerunfilecheck) Checksum: 0BF3DB904B4D0C33FD3BC9DEF2A5525B;1149.
)
Here is how much of TeX's memory you used:
10019 strings out of 478051
162922 string characters out of 5840944
1862330 words of memory out of 5000000
30030 multiletter control sequences out of 15000+600000
10030 strings out of 478051
163045 string characters out of 5840944
1861330 words of memory out of 5000000
30039 multiletter control sequences out of 15000+600000
519211 words of font info for 56 fonts, out of 8000000 for 9000
14 hyphenation exceptions out of 8191
75i,10n,79p,1069b,537s stack positions out of 10000i,1000n,20000p,200000b,200000s
75i,10n,79p,1069b,521s stack positions out of 10000i,1000n,20000p,200000b,200000s
</home/lorban/.texlive2022/texmf-var/fonts/pk/ljfour/jknappen/ec/tcrm1095.60
0pk></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx10.pfb></
usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb></usr/sh
Expand All @@ -403,10 +405,10 @@ b></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy6.pfb></usr
/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy8.pfb></usr/share/
texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmti10.pfb></usr/share/texliv
e/texmf-dist/fonts/type1/public/amsfonts/cm/cmtt10.pfb>
Output written on pplns-with-job-declaration.pdf (8 pages, 211852 bytes).
Output written on pplns-with-job-declaration.pdf (8 pages, 217370 bytes).
PDF statistics:
213 PDF objects out of 1000 (max. 8388607)
168 compressed objects within 2 object streams
39 named destinations out of 1000 (max. 500000)
217 PDF objects out of 1000 (max. 8388607)
172 compressed objects within 2 object streams
41 named destinations out of 1000 (max. 500000)
73 words of extra memory for PDF output out of 10000 (max. 10000000)

2 changes: 1 addition & 1 deletion pplns-with-job-declaration.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
\BOOKMARK [1][-]{section.1}{\376\377\000I\000n\000t\000r\000o\000d\000u\000c\000t\000i\000o\000n}{}% 1
\BOOKMARK [1][-]{section.2}{\376\377\000S\000l\000i\000c\000e\000s\000\040\000a\000n\000d\000\040\000w\000i\000n\000d\000o\000w\000s}{}% 2
\BOOKMARK [1][-]{section.2}{\376\377\000S\000l\000i\000c\000e\000s}{}% 2
\BOOKMARK [1][-]{section.3}{\376\377\000S\000c\000o\000r\000e\000s}{}% 3
\BOOKMARK [2][-]{subsection.3.1}{\376\377\000D\000i\000f\000f\000i\000c\000u\000l\000t\000y\000-\000b\000a\000s\000e\000d\000\040\000s\000c\000o\000r\000e}{section.3}% 4
\BOOKMARK [2][-]{subsection.3.2}{\376\377\000F\000e\000e\000-\000b\000a\000s\000e\000d\000\040\000s\000c\000o\000r\000e}{section.3}% 5
Expand Down
Binary file modified pplns-with-job-declaration.pdf
Binary file not shown.
Binary file modified pplns-with-job-declaration.synctex.gz
Binary file not shown.
25 changes: 17 additions & 8 deletions pplns-with-job-declaration.tex
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
\author{Lorenzo Bonazzi, Filippo Merli}
\date{August 28, 2024} % Activate to display a given date or no date (if empty),
% otherwise the current date is printed

\newtheorem{remark}{Remark}[subsection]

\begin{document}
\maketitle
Expand All @@ -24,8 +26,10 @@ \section{Introduction}

We define a fair payment schema that splits the share payout in two parts. The first comes from the coinbase and pays accordingly to the difficulty score of the share, in the same fashion as PPLNS. The second comes from the block fee and pays accordigly to share difficulty score and the share fee score in such a way that share with the highest fee in its group of shares (slice, see below) is paid at least $F_S/n$, where $F_S$ is the part of the block fee reserved to that group of shares $S$ and $n$ is the number of shares in $S$.

\section{Slices and windows}
In order to pay shares in a fair way with respect to fees, they must be scored somehow and the payout of the block fee must be redistributed accodingly to this score. Doing so, it is necessary to divide them in groups and compare scores only for shares belonging to the same group. Indeed, does not make any sense compare two shares taken randomly in the PPLNS window, because the mempool maximum extractable fees (MMEF) may change consistently. Indeed, it is difficult even to compare shares produced between a block and the following (we call this a \emph{mining round}).
In the following, we will call the \emph{window} of PPLNS the shares that are paid once that a block is found by some pool's miner. So, the windows size is $N$, where $N$ is symbol used for the acronym "Pay Per Last $N$ Shares". We will call also \emph{mining round} the number of shares produced in the time between a Bitcoin block and the following one or, equivalently, all the shares \emph{with the same prev-hash}.

\section{Slices}
In order to pay shares in a fair way with respect to fees, they must be scored somehow and the payout of the block fee must be redistributed accodingly to this score. Doing so, it is necessary to divide them in groups and compare scores only for shares belonging to the same group. Indeed, does not make any sense compare two shares taken randomly in the PPLNS window, because the mempool maximum extractable fees (MMEF) may change consistently. Indeed, it is difficult even to compare shares produced in a single mining round.

We call a group of shares whose fees can be scored (and the scores can be compared) a \emph{slice}, which is a portion of the stream of shares. As we seen in the previous paragraph, a slice must not cross two mining rounds. With other words, all shares in one slice must have the same prevhash. It is needed an introduction before giving the precise definition of a slice.

Expand Down Expand Up @@ -54,16 +58,19 @@ \subsection{Difficulty-based score}
If the window contains $N$ shares, then for the $i$-th share $s_i$ we define its score
\[score_d(s_i) = \frac{d_i}{\sum_{j=1}^Nd_j},\]
where $d_j$ is the difficulty of the share $s_j$ (for example, \cite{ocean} suggest to adopt $N$ such that the sum at the denominator eight times the bitcoin difficulty).\newline
\textbf{Remark.}
\begin{remark}
Note that
\[\sum_{j=1}^N score_d(s_i) = 1\] and that this score depends only on difficulty.
\end{remark}
\[\sum_{j=1}^N score_d(s_i) = 1\] and that this score depends only on difficulty.
\subsection{Fee-based score}
Suppose we want to score the $i$-th share $s_i$, and suppose that this share belongs to a slice $S$ that contains all the shares from the $k_1$-th to the $k_2$-th.
For the $i$-th share, call $\bar d_i = score_d(s_i)$ its score difficulty (calculated as above) and $f_i$ the fees of the share (which depends on the transactions chosen in the template). For this share, define the score relative to the fee
\[
score_f(s_i) = \frac{\bar d_if_i}{\sum_{j=k_1}^{k_2}\bar d_j f_j}.
\]

\textbf{Remarks.} \begin{enumerate}
\begin{remark}\label{properties-diff-based-score}
\begin{enumerate}
\item As remaked earlier, the dependence on difficulty is intentional. Otherwise, if there are two shares with the same fee, the one with lower difficulty is paid the same as the other, while requiring less computational effort to be produced.
\item Suppose that the slice $S$ contains $n$ shares, all of the same difficulty score. Then, if $f_i = f_{max}$ is the max fee of every share in the slice $S$, then the payout for this share is at least $score_f(s_i) \ge 1/n$. This sentence is proven by contraddiction. So, assume that
\[score_f(s_i) < 1/n.\]
Expand All @@ -75,16 +82,18 @@ \subsection{Fee-based score}
which is impossible.
\item if there is $c>0$ such that $f_i = cf_j$ for some $s_i, s_j$ two shares in the slice $S$, then $payout_f(s_i) = c \cdot payout_f(s_j)$. This means that if a miner becomes $c$ times more capable of finding a more profitable template, his shares will be paid proportionally.
\item similarly, if $\bar d_i = c \bar d_j$, then $payout_f(s_i) = c \cdot payout_f(s_j)$ this similarly represents the fact that a miner is paid proportionally with respect his hashpower.
\item similarly to difficulty score, if the slice $S$ contains shares from $k_1$-th to $k_2$-th, we have \[\sum_{i=k_1}^{k_2} score_f(s_i) = 1. \]
\item similarly to difficulty score, if the slice $S$ contains shares from $k_1$-th to $k_2$-th, we have \[\sum_{i=k_1}^{k_2} score_f(s_i) = 1. \] \label{addstoone}
\end{enumerate}

\end{remark}
\subsection{Payout for each share}
Suppose that we want to pay the $i$-th share. This share will belong to a slice $S$, to which is reserved a portion of block fees subsidy $F_S$. Then the payout is

\[payout(s_i) = r\cdot score_d(s_i) + F_S \cdot score_f(s_i).\]
The redistribution of the coinbase reward necessarly depend only on $d_i$, because it is guaranteed even in empty blocks, so it is independent from work selection.
We can see that the payouts of all shares add up to the right amount. Suppose that the slices are $S_1, \dots, S_t$, and suppose that there are $1=k_1\le k_2\le \dots \le k_t$ such that the $m$-th slice contains shares $s_{k_m} \dots s_{k_{m+1}}$. Note also that $F_S = F/t$. So:
We can see that the payouts of all shares add up to the right amount. Suppose that $N$ is the size of PPLNS window and that the slices are $S_1, \dots, S_t$, and suppose that there are $k_0=1<k_1< k_2< \dots < k_t=N$ such that the $m$-th slice contains shares $s_{k_{m-1}+1}, \dots, s_{k_{m}}$. Note also that $F_S = F/t$. So, by point \ref{addstoone} of Remark5 \ref{properties-diff-based-score}:
\begin{align*}
\sum_{i=1} ^N payout(s_i) &= r\sum_{i=1}^N score_d(s_i) +F_{S}\left(\sum_{j=k_1}^{k_2} score_f(s_j)+\dots +\sum_{j=k_{t-1}}^{k_t} score_f(s_j)\right) \\
\sum_{i=1} ^N payout(s_i) &= r\sum_{i=1}^N score_d(s_i) +F_{S}\left(\sum_{j=k_0}^{k_1} score_f(s_j)+\dots +\sum_{j=k_{t-1}+1}^{k_t} score_f(s_j)\right) \\
&= r +F_S\cdot t\\ &= r+F \\ &= R
\end{align*}

Expand Down

0 comments on commit 22c62a9

Please sign in to comment.