Enum Class NodeRole

java.lang.Object
java.lang.Enum<NodeRole>
com.privatechain.access.rbac.NodeRole
All Implemented Interfaces:
Serializable, Comparable<NodeRole>, Constable

public enum NodeRole extends Enum<NodeRole>
Enumeration of node roles in a private blockchain network.

Each role carries specific capabilities for block submission, transaction submission, validation, and reading from the chain. This enum is used by PermissionManager to enforce role-based access control (FR-AC-02, FR-AC-03).

Role hierarchy and capabilities

  • NODE_ADMIN: Full authority. Can submit blocks, transactions, validate, read, and manage the network (add/remove peers).
  • NODE_MINER: Can produce blocks and submit transactions, but cannot validate blocks produced by other nodes.
  • NODE_OBSERVER: Read-only access. Can query the chain and view events but cannot submit blocks or transactions.
Since:
1.0.0
See Also:
  • Enum Constant Details

    • NODE_ADMIN

      public static final NodeRole NODE_ADMIN
      Administrator node with unrestricted permissions. Can submit blocks, submit transactions, validate blocks, and read all data.
    • NODE_MINER

      public static final NodeRole NODE_MINER
      Mining node with permission to produce and submit blocks, and submit transactions. Cannot validate or review blocks (assumes the network enforces strict consensus rules).
    • NODE_OBSERVER

      public static final NodeRole NODE_OBSERVER
      Observer node with read-only access to the chain. Cannot submit transactions or blocks but can query state and listen to events.
  • Method Details

    • values

      public static NodeRole[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static NodeRole valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • roleName

      public String roleName()
      Returns the user-friendly name of this role.
      Returns:
      role name (lowercase)
    • canSubmitBlock

      public boolean canSubmitBlock()
      Returns true if this role is permitted to submit blocks.
      Returns:
      true for NODE_ADMIN and NODE_MINER
    • canSubmitTransaction

      public boolean canSubmitTransaction()
      Returns true if this role is permitted to submit transactions.
      Returns:
      true for NODE_ADMIN and NODE_MINER
    • canValidateBlock

      public boolean canValidateBlock()
      Returns true if this role is permitted to validate blocks.
      Returns:
      true for NODE_ADMIN only
    • canRead

      public boolean canRead()
      Returns true if this role is permitted to read chain data.
      Returns:
      true for all roles