Skip to main content
. 2020 Dec 22;21(1):23. doi: 10.3390/s21010023
Algorithm 3. Device trust insertion and update rules for smart contract
Require: Trust Value (Tv), Node Identification (node.id), System Identification (sys.id), Fog Address (fog_address)
  • 1:

    Parameters:

    block_chain: Blockchain

    System: Object

    Gateway: Object

    Fog: Object

  • 2:

    if (fog_system_mapping(sys.id) = fog_address) then

  • 3:

    if (fog_verifier(fog_address,block_chain) = true) then

  • 4:

      if (Node_exist(node.id) = true) then

  • 5:

       if (system_node_mapping(sys.id) = node.id) then

  • 6:

        update_trust(node.ID, Tv, block_chain)

  • 7:

        node_trust_mapping(node.id, Tv)

  • 8:

       else

  • 9:

        return error()

  • 10:

       end if

  • 11:

      else

  • 12:

       return error()

  • 13:

      end if

  • 14:

    else

  • 15:

      return error()

  • 16:

    end if

  • 17:

    else

  • 18:

     return error()

  • 19:

    end if