Class NodeCreateTransaction


public class NodeCreateTransaction extends Transaction<NodeCreateTransaction>
A transaction to create a new node in the network address book. The transaction, once complete, enables a new consensus node to join the network, and requires governing council authorization.

This transaction body SHALL be considered a "privileged transaction".

- MUST be signed by the governing council. - MUST be signed by the `Key` assigned to the `admin_key` field. - The newly created node information SHALL be added to the network address book information in the network state. - The new entry SHALL be created in "state" but SHALL NOT participate in network consensus and SHALL NOT be present in network "configuration" until the next "upgrade" transaction (as noted below). - All new address book entries SHALL be added 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 newly assigned `node_id` SHALL be in the transaction receipt.

  • Constructor Details

    • NodeCreateTransaction

      public NodeCreateTransaction()
      Constructor.
    • NodeCreateTransaction

      NodeCreateTransaction(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
    • NodeCreateTransaction

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

    • getAccountId

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

      public NodeCreateTransaction setAccountId(AccountId accountId)
      A Node account identifier.

      This account identifier MUST be in the "account number" form.
      This account identifier MUST NOT use the alias field.
      If the identified account does not exist, this transaction SHALL fail.
      Multiple nodes MAY share the same node account.
      This field is REQUIRED.

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

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

      public NodeCreateTransaction setDescription(@Nullable String description)
      A short description of the node.

      This value, if set, MUST NOT exceed 100 bytes when encoded as UTF-8.
      This field is OPTIONAL.

      Parameters:
      description - The String to be set as the description of the node.
      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 NodeCreateTransaction setGossipEndpoints(List<Endpoint> gossipEndpoints)
      A list of service endpoints for gossip.

      These endpoints SHALL represent the published endpoints to which other consensus nodes may _gossip_ transactions.
      These endpoints MUST specify a port.
      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.
      If the network configuration value `gossipFqdnRestricted` is set, then all endpoints in this list MUST supply only IP address.
      If the network configuration value `gossipFqdnRestricted` is _not_ set, then endpoints in this list MAY supply either IP address or FQDN, but MUST NOT supply both values for the same endpoint.

      Parameters:
      gossipEndpoints - the list of service endpoints for gossip.
      Returns:
      this
    • addGossipEndpoint

      public NodeCreateTransaction 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 NodeCreateTransaction setServiceEndpoints(List<Endpoint> serviceEndpoints)
      A list of service endpoints for gRPC calls.

      These endpoints SHALL represent the published gRPC endpoints to which clients may submit transactions.
      These endpoints MUST specify a port.
      Endpoints in this list MAY supply either IP address or FQDN, but MUST NOT supply both values for the same endpoint.
      This list MUST NOT be empty.
      This list MUST NOT contain more than `8` entries.

      Parameters:
      serviceEndpoints - list of service endpoints for gRPC calls.
      Returns:
      this
    • addServiceEndpoint

      public NodeCreateTransaction 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 NodeCreateTransaction setGossipCaCertificate(@Nullable 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.
      This field is REQUIRED and MUST NOT be empty.

      Parameters:
      gossipCaCertificate - the DER encoding of the certificate presented.
      Returns:
      this
    • 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 NodeCreateTransaction 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 an 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.
      This field is OPTIONAL.

      Parameters:
      grpcCertificateHash - SHA-384 hash of the node gRPC TLS certificate.
      Returns:
      this
    • 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 NodeCreateTransaction setAdminKey(Key adminKey)
      An administrative key controlled by the node operator.

      This key MUST sign this transaction.
      This key MUST sign each transaction to update this node.
      This field MUST contain a valid `Key` value.
      This field is REQUIRED and 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. If null, the default behavior is to accept rewards.
      Returns:
      true if rewards are declined; false if accepted; null if unset.
    • setDeclineReward

      public NodeCreateTransaction setDeclineReward(boolean decline)
      Sets whether this node should decline rewards.
      Parameters:
      decline - true to decline rewards, false to accept.
      Returns:
      this
    • getGrpcWebProxyEndpoint

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

      public NodeCreateTransaction 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 NodeCreateTransaction 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 NodeCreateTransaction addAssociatedRegisteredNode(long associatedRegisteredNode)
      Add a registered nodes operated by the same entity as this node.
      Parameters:
      associatedRegisteredNode - the associated registered node.
      Returns:
      this
    • build

      Build the transaction body.
      Returns:
      NodeCreateTransactionBody
    • initFromTransactionBody

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

      void validateChecksums(Client client) throws BadEntityIdException
      Specified by:
      validateChecksums in class Transaction<NodeCreateTransaction>
      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<NodeCreateTransaction,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<NodeCreateTransaction>
    • 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<NodeCreateTransaction>