Skip to main content
. 2026 Feb 23;26(4):1393. doi: 10.3390/s26041393
Algorithm 4 Audit (Replay)
  • Input: 

    PP,pkvrf,T,Acc,(εitot,ki)i,B

  • Output: 

    result, S

  •   1:

    State[i](εitot,recinit,0) for each i; BatchQueue; S

  •   2:

    for each recordtT do

  •   3:

        (i,t,opt,θt,yt,Δεt,idxt,rect,metat,πt,rt,πtvrf)recordt

  •   4:

        (εbal,recprev,cnt)State[i]

  •   5:

        if VRF.Verify(pkvrf,(i,t),rt,πtvrf)=0 or idxtH(itrt) then

  •   6:

            return (fail,recordt)

  •   7:

        end if

  •   8:

        if rectH(recprevidxtmetat) or Δεtε(opt,θt) then

  •   9:

            return (fail,recordt)

  • 10:

        end if

  • 11:

        εnewεbalΔεt

  • 12:

        if εnew<0 then

  • 13:

            return (fail,recordt)

  • 14:

        end if

  • 15:

        cntcnt+1

  • 16:

        if cnt>ki then

  • 17:

            SS{i}

  • 18:

        end if

  • 19:

        inpt(i,Ci,t,opt,θt,yt,Δεt,εt,ki,idxt,rect)

  • 20:

        Add(inpt,πt) to BatchQueue; State[i](εnew,rect,cnt)

  • 21:

        if |BatchQueue|B then

  • 22:

            validZK.BatchVerify(PP,R,BatchQueue)

  • 23:

            if valid=0 then

  • 24:

               return (fail,BatchQueue)

  • 25:

            end if

  • 26:

            BatchQueue

  • 27:

        end if

  • 28:

    end for

  • 29:

    if Size(BatchQueue)>0 and ZK.BatchVerify(PP,R,BatchQueue)=0 then

  • 30:

        return (fail,BatchQueue)

  • 31:

    end if

  • 32:

    for each device i do

  • 33:

        (ε*,Δ*)Acc(Historyofi)

  • 34:

        if ε*>εitot then

  • 35:

            SS{i}

  • 36:

        end if

  • 37:

    end for

  • 38:

    return (fail,S) if S else (pass,)