Class NodeUpdateTransaction


public class NodeUpdateTransaction extends Transaction<NodeUpdateTransaction>
A transaction to modify address book node attributes. - This transaction SHALL enable the node operator, as identified by the `admin_key`, to modify operational attributes of the node. - This transaction MUST be signed by the active `admin_key` for the node. - If this transaction sets a new value for the `admin_key`, then both the current `admin_key`, and the new `admin_key` MUST sign this transaction. - This transaction SHALL NOT change any field that is not set (is null) in this transaction body. - This SHALL create a pending update to the node, but the change SHALL NOT be immediately applied to the active configuration. - All pending node updates SHALL be applied to the active network configuration during the next `freeze` transaction with the field `freeze_type` set to `PREPARE_UPGRADE`. ### Record Stream Effects Upon completion the `node_id` for the updated entry SHALL be in the transaction receipt.
  • Constructor Details

    • NodeUpdateTransaction

      public NodeUpdateTransaction()
      Constructor.
    • NodeUpdateTransaction

      NodeUpdateTransaction(LinkedHashMap<TransactionId,LinkedHashMap<AccountId,Transaction>> txs) throws com.google.protobuf.InvalidProtocolBufferException
      Constructor.
      Parameters:
      txs - Compound list of transaction id's list of (AccountId, Transaction) records
      Throws:
      com.google.protobuf.InvalidProtocolBufferException - when there is an issue with the protobuf
    • NodeUpdateTransaction

      NodeUpdateTransaction(TransactionBody txBody)
      Constructor.
      Parameters:
      txBody - protobuf TransactionBody
  • Method Details

    • getNodeId

      public long getNodeId()
      Extract the consensus node identifier in the network state.
      Returns:
      the consensus node identifier in the network state.
      Throws:
      IllegalStateException - when node is not being set
    • setNodeId

      public NodeUpdateTransaction setNodeId(long nodeId)
      A consensus node identifier in the network state.

      The node identified MUST exist in the network address book.
      The node identified MUST NOT be deleted.
      This value is REQUIRED.

      Parameters:
      nodeId - the consensus node identifier in the network state.
      Returns:
      this
      Throws:
      IllegalArgumentException - if nodeId is negative
    • getAccountId

      public AccountId getAccountId()
      Extract the Account ID of the Node.
      Returns:
      the Account ID of the Node.
    • setAccountId

      public NodeUpdateTransaction setAccountId(AccountId accountId)
      An account identifier.

      If set, this SHALL replace the node account identifier.
      If set, this transaction MUST be signed by the active `key` for _both_ the current node account _and_ the identified new node account.

      Parameters:
      accountId - the Account ID of the Node.
      Returns:
      this
    • getDescription

      @Nullable public String getDescription()
      Extract the description of the node.
      Returns:
      the node's description.
    • setDescription

      public NodeUpdateTransaction setDescription(String description)
      A short description of the node.

      This value, if set, MUST NOT exceed 100 bytes when encoded as UTF-8.
      If set, this value SHALL replace the previous value.

      Parameters:
      description - The String to be set as the description of the node.
      Returns:
      this
      Throws:
      IllegalArgumentException - if description exceeds 100 bytes when encoded as UTF-8
    • clearDescription

      public NodeUpdateTransaction clearDescription()
      Remove the description contents.
      Returns:
      this
    • getGossipEndpoints

      public List<Endpoint> getGossipEndpoints()
      Extract the list of service endpoints for gossip.
      Returns:
      the list of service endpoints for gossip.
    • setGossipEndpoints

      public NodeUpdateTransaction setGossipEndpoints(List<Endpoint> gossipEndpoints)
      A list of service endpoints for gossip.

      If set, this list MUST meet the following requirements.


      These endpoints SHALL represent the published endpoints to which other consensus nodes may _gossip_ transactions.
      These endpoints SHOULD NOT specify both address and DNS name.
      This list MUST NOT be empty.
      This list MUST NOT contain more than `10` entries.
      The first two entries in this list SHALL be the endpoints published to all consensus nodes.
      All other entries SHALL be reserved for future use.

      Each network may have additional requirements for these endpoints. A client MUST check network-specific documentation for those details.

      Example
      Hedera Mainnet _requires_ that address be specified, and does not permit DNS name (FQDN) to be specified.
      Mainnet also requires that the first entry be an "internal" IP address and the second entry be an "external" IP address.
      Solo, however, _requires_ DNS name (FQDN) but also permits address.

      If set, the new list SHALL replace the existing list.

      Parameters:
      gossipEndpoints - the list of service endpoints for gossip.
      Returns:
      this
      Throws:
      IllegalArgumentException - if the list is empty or contains more than 10 endpoints
    • addGossipEndpoint

      public NodeUpdateTransaction addGossipEndpoint(Endpoint gossipEndpoint)
      Add an endpoint for gossip to the list of service endpoints for gossip.
      Parameters:
      gossipEndpoint - endpoints for gossip to add.
      Returns:
      this
    • getServiceEndpoints

      public List<Endpoint> getServiceEndpoints()
      Extract the list of service endpoints for gRPC calls.
      Returns:
      the list of service endpoints for gRPC calls.
    • setServiceEndpoints

      public NodeUpdateTransaction setServiceEndpoints(List<Endpoint> serviceEndpoints)
      A list of service endpoints for gRPC calls.

      If set, this list MUST meet the following requirements.


      These endpoints SHALL represent the published endpoints to which clients may submit transactions.
      These endpoints SHOULD specify address and port.
      These endpoints MAY specify a DNS name.
      These endpoints SHOULD NOT specify both address and DNS name.
      This list MUST NOT be empty.
      This list MUST NOT contain more than `8` entries.

      Each network may have additional requirements for these endpoints. A client MUST check network-specific documentation for those details.

      If set, the new list SHALL replace the existing list.

      Parameters:
      serviceEndpoints - list of service endpoints for gRPC calls.
      Returns:
      this
      Throws:
      IllegalArgumentException - if the list is empty or contains more than 8 endpoints
    • addServiceEndpoint

      public NodeUpdateTransaction addServiceEndpoint(Endpoint serviceEndpoint)
      Add an endpoint for gRPC calls to the list of service endpoints for gRPC calls.
      Parameters:
      serviceEndpoint - endpoints for gRPC calls to add.
      Returns:
      this
    • getGossipCaCertificate

      @Nullable public byte[] getGossipCaCertificate()
      Extract the certificate used to sign gossip events.
      Returns:
      the DER encoding of the certificate presented.
    • setGossipCaCertificate

      public NodeUpdateTransaction setGossipCaCertificate(byte[] gossipCaCertificate)
      A certificate used to sign gossip events.

      This value MUST be a certificate of a type permitted for gossip signatures.
      This value MUST be the DER encoding of the certificate presented.

      If set, the new value SHALL replace the existing bytes value.

      Parameters:
      gossipCaCertificate - the DER encoding of the certificate presented.
      Returns:
      this
      Throws:
      IllegalArgumentException - if gossipCaCertificate is null or empty
    • getGrpcCertificateHash

      @Nullable public byte[] getGrpcCertificateHash()
      Extract the hash of the node gRPC TLS certificate.
      Returns:
      SHA-384 hash of the node gRPC TLS certificate.
    • setGrpcCertificateHash

      public NodeUpdateTransaction setGrpcCertificateHash(byte[] grpcCertificateHash)
      A hash of the node gRPC TLS certificate.

      This value MAY be used to verify the certificate presented by the node during TLS negotiation for gRPC.
      This value MUST be a SHA-384 hash.
      The TLS certificate to be hashed MUST first be in PEM format and MUST be encoded with UTF-8 NFKD encoding to a stream of bytes provided to the hash algorithm.

      If set, the new value SHALL replace the existing hash value.

      Parameters:
      grpcCertificateHash - SHA-384 hash of the node gRPC TLS certificate.
      Returns:
      this
      Throws:
      IllegalArgumentException - if grpcCertificateHash is not 48 bytes (SHA-384 size) when non-empty
    • getAdminKey

      @Nullable public Key getAdminKey()
      Get an administrative key controlled by the node operator.
      Returns:
      an administrative key controlled by the node operator.
    • setAdminKey

      public NodeUpdateTransaction setAdminKey(Key adminKey)
      An administrative key controlled by the node operator.

      This field is OPTIONAL.
      If set, this key MUST sign this transaction.
      If set, this key MUST sign each subsequent transaction to update this node.
      If set, this field MUST contain a valid `Key` value.
      If set, this field MUST NOT be set to an empty `KeyList`.

      Parameters:
      adminKey - an administrative key to be set.
      Returns:
      this
    • getDeclineReward

      @Nullable public Boolean getDeclineReward()
      Gets whether this node declines rewards.
      Returns:
      true if the node declines rewards; false if it accepts rewards.
    • setDeclineReward

      public NodeUpdateTransaction setDeclineReward(boolean decline)
      Sets whether this node should decline rewards.
      Parameters:
      decline - true to decline rewards; false to accept them. If left null no change will be made.
      Returns:
      this
    • getGrpcWebProxyEndpoint

      @Nullable public Endpoint getGrpcWebProxyEndpoint()
      Get a web proxy for gRPC from non-gRPC clients.
    • setGrpcWebProxyEndpoint

      public NodeUpdateTransaction setGrpcWebProxyEndpoint(@Nullable Endpoint grpcWebProxyEndpoint)
      A web proxy for gRPC from non-gRPC clients.

      This endpoint SHALL be a Fully Qualified Domain Name (FQDN) using the HTTPS protocol, and SHALL support gRPC-Web for use by browser-based clients.
      This endpoint MUST be signed by a trusted certificate authority.
      This endpoint MUST use a valid port and SHALL be reachable over TLS.
      This field MAY be omitted if the node does not support gRPC-Web access.
      This field MUST be updated if the gRPC-Web endpoint changes.
      This field SHALL enable frontend clients to avoid hard-coded proxy endpoints.

    • getAssociatedRegisteredNodes

      public List<Long> getAssociatedRegisteredNodes()
      Get a list of registered nodes operated by the same entity as this node.
      Returns:
      List<Long> the list of associated registered node.
    • setAssociatedRegisteredNodes

      public NodeUpdateTransaction setAssociatedRegisteredNodes(List<Long> associatedRegisteredNodes)
      Set a list of registered nodes operated by the same entity as this node.
      This value may contain a list of "registered nodes" (as described in HIP-1137) that are operated by the same entity that operates this consensus node.

      This field is OPTIONAL and MAY be empty.
      This field MUST NOT contain more than twenty(20) entries.
      Every entry in this list MUST be a valid `registered_node_id` for a current registered node.

      Parameters:
      associatedRegisteredNodes - list of associated registered node.
      Returns:
      this
    • addAssociatedRegisteredNode

      public NodeUpdateTransaction addAssociatedRegisteredNode(long associatedRegisteredNode)
      Add a registered nodes operated by the same entity as this node.
      Parameters:
      associatedRegisteredNode - the associated registered node.
      Returns:
      this
    • clearAssociatedRegisteredNodes

      public NodeUpdateTransaction clearAssociatedRegisteredNodes()
      Clear all registered nodes associated with this node.
      Returns:
      this
    • build

      Build the transaction body.
      Returns:
      NodeUpdateTransactionBody
    • initFromTransactionBody

      void initFromTransactionBody()
      Initialize from the transaction body.
    • validateChecksums

      void validateChecksums(Client client) throws BadEntityIdException
      Specified by:
      validateChecksums in class Transaction<NodeUpdateTransaction>
      Throws:
      BadEntityIdException
    • getMethodDescriptor

      io.grpc.MethodDescriptor<Transaction,TransactionResponse> getMethodDescriptor()
      Description copied from class: Executable
      Called to direct the invocation of the query to the appropriate gRPC service.
      Specified by:
      getMethodDescriptor in class Executable<NodeUpdateTransaction,Transaction,TransactionResponse,TransactionResponse>
    • onFreeze

      void onFreeze(TransactionBody.Builder bodyBuilder)
      Description copied from class: Transaction
      Called in Transaction.freezeWith(Client) just before the transaction body is built. The intent is for the derived class to assign their data variant to the transaction body.
      Specified by:
      onFreeze in class Transaction<NodeUpdateTransaction>
    • onScheduled

      void onScheduled(SchedulableTransactionBody.Builder scheduled)
      Description copied from class: Transaction
      Called in Transaction.schedule() when converting transaction into a scheduled version.
      Specified by:
      onScheduled in class Transaction<NodeUpdateTransaction>
    • freezeWith

      public NodeUpdateTransaction freezeWith(@Nullable Client client)
      Freeze this transaction with the given client.
      Overrides:
      freezeWith in class Transaction<NodeUpdateTransaction>
      Parameters:
      client - the client to freeze with
      Returns:
      this transaction
      Throws:
      IllegalStateException - if nodeId is not set
    • deleteGrpcWebProxyEndpoint

      public NodeUpdateTransaction deleteGrpcWebProxyEndpoint()
      Delete the gRPC web proxy endpoint.

      This method clears the gRPC web proxy endpoint by setting it to an empty Endpoint, which will effectively delete it in the mirror node.

      Returns:
      this