Skip to main content
. 2025 Jul 30;25(15):4695. doi: 10.3390/s25154695
Algorithm 5 The robotic arm needs to run for five seconds when calling coordinate()
Require: Smart contract deployment address: SCAddr, Smart Contract Owner: owner, Address of device: d1Addr
Ensure: All cases λ
  •   1:

    startTimegetEnv(timestamp)                                                                   ▷ Get the timestamp of d1Addr runtime

  •   2:

    startHeightgetEnv(height)                                                                    ▷ Get the block height of d1Addr runtime

  •   3:

    callFunction(SCAddr,updateStatus(d1Addr,Running))

  •   4:

    ξbuiltIn(0<time<5)                                                       ▷ Generate a random set of parameters on request

  •   5:

    Failedcasesω

  •   6:

    SucceedcasesΩ

  •   7:

    for timeξ do                                                                                                                           ▷ Create a new case

  •   8:

          finishTimeexpression(startTime+time)

  •   9:

          finishHeightexpression(startHeight+time/2)

  • 10:

          setEnv(timestamp,finishTime)                                                                                                ▷ Set the timestamp

  • 11:

          setEnv(height,finishHeight)                                                                                                             ▷ Set the block

  • 12:

          resultcallFunction(SCAddr,coordinate())

  • 13:

          if result == false then

  • 14:

               ΩCaseΩ                                                                                     ▷ Add Case to the success collection

  • 15:

          else

  • 16:

               ωCaseω                                                                                         ▷ Add Case to the failed collection

  • 17:

          end if

  • 18:

    end for

  • 19:

    return All cases λΩω