NodeInfo
Keywords: net.corda.core.node.NodeInfo class
Date: 2023-09-18

net.corda.core.node

## Class NodeInfo

- net.corda.core.node.NodeInfo

-     public class NodeInfo

  Information about a network node that acts on behalf of some party. NodeInfos can be found via the network map cache, accessible from a `interface NetworkMapCache`. They are also available via RPC using the `net.corda.core.messaging.CordaRPCOps.networkMapSnapshot` method.

  See Also:
    `interface NetworkMapCache`, `net.corda.core.messaging.CordaRPCOps.networkMapSnapshot`

- - ### Constructor Detail

    - #### NodeInfo

          public NodeInfo(@NotNull
                          java.util.List<net.corda.core.utilities.NetworkHostAndPort> addresses,
                          @NotNull
                          java.util.List<net.corda.core.identity.PartyAndCertificate> legalIdentitiesAndCerts,
                          int platformVersion,
                          long serial)

      Information about a network node that acts on behalf of some party. NodeInfos can be found via the network map cache, accessible from a `interface NetworkMapCache`. They are also available via RPC using the `net.corda.core.messaging.CordaRPCOps.networkMapSnapshot` method.

      Parameters:
        `addresses` - An ordered list of IP addresses/hostnames where the node can be contacted.
        `legalIdentitiesAndCerts` - A non-empty list, where the first identity is assumed to be the default identity of the node.
        `platformVersion` - An integer representing the set of protocol features the node supports. See the docsite for information on how the platform is versioned.
        `serial` - An arbitrary number incremented each time the NodeInfo is changed. This is analogous to the same concept in DNS.
      See Also:
        `interface NetworkMapCache`, `net.corda.core.messaging.CordaRPCOps.networkMapSnapshot`

  - ### Method Detail

    - #### getLegalIdentities

          @NotNull
          public java.util.List<net.corda.core.identity.Party> getLegalIdentities()

      An ordered list of legal identities supported by this node. The node will always have at least one, so if you are porting code from earlier versions of Corda that expected a single party per node, just use the first item in the returned list.

    - #### isLegalIdentity

          public boolean isLegalIdentity(@NotNull
                                         Party party)

      Returns true if `party` is one of the identities of this node, else false.

      See Also:
        `party`

    - #### isLegalIdentity

          public boolean isLegalIdentity(@NotNull
                                         CordaX500Name name)

      Returns true if `name` matches one of the identities of this node, else false.

      See Also:
        `name`

    - #### identityFromX500Name

          @NotNull
          public Party identityFromX500Name(@NotNull
                                                     CordaX500Name name)

      Get a legal identity of this node from the X.500 name. This is intended for use in cases where the node is expected to have a matching identity, and will throw an exception if no match is found.

      Throws:
        `IllegalArgumentException` - if the node has no matching identity.

    - #### identityAndCertFromX500Name

          @NotNull
          public PartyAndCertificate identityAndCertFromX500Name(@NotNull
                                                                          CordaX500Name name)

      Get a legal identity and certificate of this node from the X.500 name. This is intended for use in cases where the node is expected to have a matching identity, and will throw an exception if no match is found.

      Throws:
        `IllegalArgumentException` - if the node has no matching identity.

    - #### getAddresses

          @NotNull
          public java.util.List<net.corda.core.utilities.NetworkHostAndPort> getAddresses()

      An ordered list of IP addresses/hostnames where the node can be contacted.

    - #### getLegalIdentitiesAndCerts

          @NotNull
          public java.util.List<net.corda.core.identity.PartyAndCertificate> getLegalIdentitiesAndCerts()

      A non-empty list,

      where the first identity is assumed to be the default identity of the node.

    - #### getPlatformVersion

          public int getPlatformVersion()

      An integer representing the set of protocol features the node supports.

      See the docsite for information on how the platform is versioned.

    - #### getSerial

          public long getSerial()

      An arbitrary number incremented each time the NodeInfo is changed.

      This is analogous to the same concept in DNS.

    - #### component1

          @NotNull
          public java.util.List<net.corda.core.utilities.NetworkHostAndPort> component1()

      An ordered list of IP addresses/hostnames where the node can be contacted.

    - #### component2

          @NotNull
          public java.util.List<net.corda.core.identity.PartyAndCertificate> component2()

      A non-empty list,

      where the first identity is assumed to be the default identity of the node.

    - #### component3

          public int component3()

      An integer representing the set of protocol features the node supports.

      See the docsite for information on how the platform is versioned.

    - #### component4

          public long component4()

      An arbitrary number incremented each time the NodeInfo is changed.

      This is analogous to the same concept in DNS.

    - #### copy

          @NotNull
          public NodeInfo copy(@NotNull
                                        java.util.List<net.corda.core.utilities.NetworkHostAndPort> addresses,
                                        @NotNull
                                        java.util.List<net.corda.core.identity.PartyAndCertificate> legalIdentitiesAndCerts,
                                        int platformVersion,
                                        long serial)

      Information about a network node that acts on behalf of some party. NodeInfos can be found via the network map cache, accessible from a `interface NetworkMapCache`. They are also available via RPC using the `net.corda.core.messaging.CordaRPCOps.networkMapSnapshot` method.

      See Also:
        `interface NetworkMapCache`, `net.corda.core.messaging.CordaRPCOps.networkMapSnapshot`

    - #### toString

          @NotNull
          public java.lang.String toString()

      Information about a network node that acts on behalf of some party. NodeInfos can be found via the network map cache, accessible from a `interface NetworkMapCache`. They are also available via RPC using the `net.corda.core.messaging.CordaRPCOps.networkMapSnapshot` method.

      See Also:
        `interface NetworkMapCache`, `net.corda.core.messaging.CordaRPCOps.networkMapSnapshot`

    - #### hashCode

          public int hashCode()

      Information about a network node that acts on behalf of some party. NodeInfos can be found via the network map cache, accessible from a `interface NetworkMapCache`. They are also available via RPC using the `net.corda.core.messaging.CordaRPCOps.networkMapSnapshot` method.

      See Also:
        `interface NetworkMapCache`, `net.corda.core.messaging.CordaRPCOps.networkMapSnapshot`

    - #### equals

          public boolean equals(@Nullable
                                java.lang.Object p)

      Information about a network node that acts on behalf of some party. NodeInfos can be found via the network map cache, accessible from a `interface NetworkMapCache`. They are also available via RPC using the `net.corda.core.messaging.CordaRPCOps.networkMapSnapshot` method.

      See Also:
        `interface NetworkMapCache`, `net.corda.core.messaging.CordaRPCOps.networkMapSnapshot`