corda / net.corda.core.node / NodeInfo

NodeInfo

data 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 net.corda.core.node.services.NetworkMapCache. They are also available via RPC using the net.corda.core.messaging.CordaRPCOps.networkMapSnapshot method.

Constructors

<init>

NodeInfo(addresses: List<NetworkHostAndPort>, legalIdentitiesAndCerts: List<PartyAndCertificate>, platformVersion: Int, serial: Long)

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

Properties

addresses

val addresses: List<NetworkHostAndPort>

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

legalIdentities

val legalIdentities: List<Party>

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.

legalIdentitiesAndCerts

val legalIdentitiesAndCerts: List<PartyAndCertificate>

A non-empty list, where the first identity is assumed to be the default identity of the node.

platformVersion

val platformVersion: Int

An integer representing the set of protocol features the node supports. See the docsite for information on how the platform is versioned.

serial

val serial: Long

An arbitrary number incremented each time the NodeInfo is changed. This is analogous to the same concept in DNS.

Functions

identityAndCertFromX500Name

fun identityAndCertFromX500Name(name: CordaX500Name): PartyAndCertificate

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.

identityFromX500Name

fun identityFromX500Name(name: CordaX500Name): Party

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.

isLegalIdentity

fun isLegalIdentity(party: Party): Boolean

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

Extension Functions

contextLogger

fun Any.contextLogger(): Logger

When called from a companion object, returns the logger for the enclosing class.

singleIdentity

fun NodeInfo.singleIdentity(): Party

Extract a single identity from the node info. Throws an error if the node has multiple identities.

singleIdentityAndCert

fun NodeInfo.singleIdentityAndCert(): PartyAndCertificate

Extract a single identity from the node info. Throws an error if the node has multiple identities.