# A Compute and Wait in PoW (CW-PoW) Consensus Algorithm for Preserving Energy Consumption
## 6 Implementation
Let \(e_{1}+e_{2}=2\times e\). If \(NbrR=3\), then \(g=\frac{2\times w}{3\times e}\), if \(NbrR=4\), then \(g=\frac{3\times w}{4\times e}\ldots\), if \(NbrR=\alpha\), then \(g=\frac{a\times w}{(a+1)\times e}\). The effect of the wait time absence in the last round decreases if we increase \(NbrR\) and the gain \(g\) converges to \(\frac{w}{e}\) because \(\frac{\alpha}{(a+1)}\) converges to 1. Discussion: In the second scenario illustrated by Figure 4, we fixed \(NbrP\) to 10, and we made several tests, in each of them increasing the number of rounds (\(NbrR=5,10,15,20\)) to study the effect of this increase and its influence on the gain. These tests have shown that the more \(NbrR\) increases, the more the gain increases but not absolutely. Rather, this increase converges to an upper bound related to the number of processes. Then the gain decreases because the difficulty is also reduced (NbrR increases then difficulty decreases). Therefore, the processes will end almost at the same time because the solution is easy to find. **Lemma 4**. : _If \(NbrR\) increases then \(Gain(G_{nw})\) converges to a number \(G\)_  
Proof. : The average gain of the network \((G_{nw})=(g_{1}+g_{1}+\ldots g_{NbrR})/NbrR\) where \(g_{i}\) is the gain of round \(i\). We have \(g_{NbrR}\) (gain of the last round) equal to 0 because there is a calculation and there is no wait. \(g_{i}\) depends on moments \(t_{i,j}\) at which solutions are found (\(t_{i,1}\) is the instant where the first solution of round \(i\) is found, \(t_{i,NbrR}\) is the instant at which the last solution of round \(i\) is found). In general, these times are random in each round, therefore, \(g_{1}\approx g_{2}\approx\ldots g_{NbrR-1}\) and then \(G_{nw}=(NbrR-1)\times g_{1}/NbrR\)  
We obtain:  
\[G_{nw}=g_{1}-(g_{1}/NbrR) \tag{8}\]  
We observe that if \(NbrR=1\) then \(G_{nw}=0\) and if \(NbrR\)_increases_ then \(G_{nw}\approx g_{1}=G\)  
Discussion: Figure 5 shows how the gain converges to a constant number G when the number of rounds increases (NbrR = 5, 10, 15, 20, 25). Usually, G depends on the number of processes and the number of solutions. In Figure 5, we have fixed the number of processes and the number of solutions. In Figure 5-right, (NbrP, NbrS) = (10, 5) and we have set up several scenarios (NbrR = 5,... until NbrR = 200). We noticed that starting from NbrR = 20 the gain remains greater than 8 and less than 9. In the similar way, in Figure 5-left, the gain remains close to 19.5 whenever NbrR > 20 (20 \(\leqq\) NbrR \(\leqq\) 200). This is why we said that the gain converges to a constant number G when the number of rounds increases. \(G\approx 8.5\) with (NbrP, NbrS) = (10, 5) and NbrR \(\geqq\) 20; \(G\approx 19.5\) with (NbrP, NbrS) = (10, 10) and NbrR \(\geqq\) 20. The number of solutions is a very important factor because it designates the number of processes that will wait; therefore, it controls the gain. Figure 6 shows the increase in gain as NbrS increases. On the other hand, we cannot introduce a number of solutions without having a multi-round environment. The importance of NbrS directs us towards private blockchains; In which we can talk about NbrS compared to the total number of processes. In another philosophy, we may consider that the node leaves the competition if NbrS of the next round is saturated. In this case, we will increase the gain to the maximum (Table 1). The downside of this philosophy is that after a round \(j\) in which the number  
Figure 4: The influence of NbrR, case A. As for the 51% attack, when dominance is reduced, the 51% attack will also be reduced. On the other hand, the pool can not work freely to find a single solution, it has to go through several rounds. After each round, the node must share the identifier of this round (\(id_{round}\)) which is calculated from the solutions trounced in the previous round, from which the protocol implies to introduce this \(id_{round}\) in the next proof of round (Equation (3)).