Class ConsensusNodeEndpoint
Represents a consensus node's network address, consisting of a node identifier and a gRPC endpoint URI for accessing the Hiero Network.
Implements
Inherited Members
Namespace: Hiero
Assembly: Hiero.dll
Syntax
[JsonConverter(typeof(ConsensusNodeEndpointConverter))]
public sealed record ConsensusNodeEndpoint : IEquatable<ConsensusNodeEndpoint>
Remarks
This class consists of both an EntityId representing the main node within the network and the gRPC URL for the network node where the public network endpoint is located. This class is immutable once created.
Constructors
| Edit this page View SourceConsensusNodeEndpoint(EntityId, Uri)
Public Constructor, a
ConsensusNodeEndpoint
is immutable after creation.
Declaration
public ConsensusNodeEndpoint(EntityId node, Uri uri)
Parameters
| Type | Name | Description |
|---|---|---|
| EntityId | node | Main Network Consensus Node's Address. |
| Uri | uri | The URL and port of the public Hiero Network Consensus Node's gRPC access point. A consensus node may actually have multiple gRPC endpoints mapped to the same wallet address (shard.realm.num). |
ConsensusNodeEndpoint(EntityId, Uri, ReadOnlyMemory<byte>)
Public Constructor accepting the node's expected TLS certificate hash, a
ConsensusNodeEndpoint
is immutable after creation.
Declaration
public ConsensusNodeEndpoint(EntityId node, Uri uri, ReadOnlyMemory<byte> certificateHash)
Parameters
| Type | Name | Description |
|---|---|---|
| EntityId | node | Main Network Consensus Node's Address. |
| Uri | uri | The URL and port of the public Hiero Network Consensus Node's gRPC access point. A consensus node may actually have multiple gRPC endpoints mapped to the same wallet address (shard.realm.num). |
| ReadOnlyMemory<byte> | certificateHash | The expected SHA-384 hash of the node's TLS certificate (see
CertificateHash). Supply this for |
Properties
| Edit this page View SourceCertificateHash
The expected SHA-384 hash of the node's TLS certificate, as published by
the network's address book (the mirror node's node_cert_hash field
or the classic address book's NodeAddress.cert_hash).
Declaration
public ReadOnlyMemory<byte> CertificateHash { get; }
Property Value
| Type | Description |
|---|---|
| ReadOnlyMemory<byte> |
Remarks
Hiero consensus nodes present self-signed certificates whose subject
alternative name does not match their real address, so standard TLS chain
and hostname validation can never succeed against a TLS (port 50212)
endpoint. When this hash is supplied and the Uri scheme is
https, the client's default channel factory pins the connection to
this hash instead of using chain/hostname validation; a custom channel
factory does the same with MatchesCertificate(X509Certificate?). When empty,
the default factory falls back to standard TLS validation (appropriate for
proxy-fronted DNS endpoints that present a chain-valid certificate).
This value participates in equality (by content): two endpoints that pin
to different certificate hashes — or one that pins and one that does not —
are distinct endpoints and receive distinct, independently validated gRPC
channels.
Node
The Network gRPC Consensus Node's Address, may only be [shard.realm.num] form.
Declaration
public EntityId Node { get; }
Property Value
| Type | Description |
|---|---|
| EntityId |
Uri
The URL and port of the public Hiero Network Consensus Node access point.
Declaration
public Uri Uri { get; }
Property Value
| Type | Description |
|---|---|
| Uri |
Methods
| Edit this page View SourceEquals(ConsensusNodeEndpoint?)
Determines equality with another ConsensusNodeEndpoint. Two endpoints are equal when they share the same Node, Uri, and CertificateHash content. The hash is compared by value (not by backing-array reference) so endpoints built from equal hash bytes are equal, and so distinct pinning targets remain distinct channel cache keys.
Declaration
public bool Equals(ConsensusNodeEndpoint? other)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsensusNodeEndpoint | other | The endpoint to compare against. |
Returns
| Type | Description |
|---|---|
| bool | True when the node address, URI, and certificate hash all match. |
GetHashCode()
Returns a hash code consistent with Equals(ConsensusNodeEndpoint?), derived from Node, Uri, and the CertificateHash content.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | A hash code for this endpoint. |
Overrides
| Edit this page View SourceMatchesCertificate(X509Certificate?)
Determines whether a certificate presented by this endpoint during the TLS handshake is the one the network's address book published for it, by comparing the certificate's hash to CertificateHash.
Declaration
public bool MatchesCertificate(X509Certificate? certificate)
Parameters
| Type | Name | Description |
|---|---|---|
| X509Certificate | certificate | The certificate the endpoint presented, as passed to a
|
Returns
| Type | Description |
|---|---|
| bool | True when this endpoint has a CertificateHash and the certificate's hash equals it; otherwise false. |
Remarks
A custom channel factory passed to
ConsensusClient(Func<ConsensusNodeEndpoint, GrpcChannel>, Action<IConsensusContext>?)
replaces the default factory, and with it the default factory's
certificate pinning. Call this method from the factory's
RemoteCertificateValidationCallback to pin the TLS connection
the same way:
SslOptions = new SslClientAuthenticationOptions
{
RemoteCertificateValidationCallback = (_, cert, _, _) => endpoint.MatchesCertificate(cert)
}
The hash is the SHA-384 of the certificate's PEM text with one trailing newline, the address book's convention, compared in constant time. An endpoint with no CertificateHash matches no certificate; with nothing to pin to, a factory should leave standard TLS validation in place for it, as the default factory does.
ToString()
Returns a string representation of the Consensus Node ConsensusNodeEndpoint.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | String Representation of the Consensus Node ConsensusNodeEndpoint |
Overrides
Operators
| Edit this page View Sourceimplicit operator EntityId(ConsensusNodeEndpoint)
Implicit operator for converting a ConsensusNodeEndpoint to an EntityId.
Declaration
public static implicit operator EntityId(ConsensusNodeEndpoint endpoint)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsensusNodeEndpoint | endpoint | The ConsensusNodeEndpoint object containing the shard, realm and node number information to convert into an address object. |
Returns
| Type | Description |
|---|---|
| EntityId |