Skip to main content
. 2025 Jan 12;25(2):413. doi: 10.3390/s25020413
Algorithm 1. Layer-2: RWABA
Initialization: When node Pi receives the input binput , set est0 :=binput,  decided :=false, r:=0 , bin_valuesr:= and  RWeightSumrd :=0, where r={0, 1, 2,...} and d={0, 1}.
1: RWeightSumrestr :=rwinput;
2: broadcast to other nodes  Valrestr,rwi= {Val,r,estr,rwinput}
3: Upon  receiving Valrv,rw  from Pj   do
4:         RWeightSumrv :=RWeightSumrv+rw;
5: Upon  RWeightSumrvf+1   do
6:         If Valrv,rwinput has not been sent, then broadcast Valrv,rwinput.
7: Upon  RWeightSumrv2f+1   do
8:         bin_valuesr :=bin_valuesr{v};
9: Upon  bin_valuesr  do
10:          broadcast AUXrμ,rwinput={AUX,r,μ,rwinput} , where μbin_valuesr
11:         Wait until the sum of the reputation weights in AUXrμ,* is greater than or equal to nf, then set  valr as the set of x in the AUXr, resulting in valrbin_valuesr.
12:         s :=H(H(m)|r);
13:          if  valr={b}  then
14:                if  b=s % 2  then
15:                        if  decided=false  then
16:                               reach consensus b;
17:                                decidedtrue ;
18:                        else:
19:                               terminate program;
20:               estr+1b;
21:          else:
22:               estr+1s%2;
23: rr+1;
24: goto line 1;