Show / Hide Table of Contents

Class TransactionTimestampDataExtensions

Extension methods for retrieving the latest consensus timestamp from the mirror node.

Inheritance
object
TransactionTimestampDataExtensions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Hiero.Mirror
Assembly: Hiero.dll
Syntax
public static class TransactionTimestampDataExtensions

Methods

| Edit this page View Source

GetLatestConsensusTimestampAsync(MirrorRestClient, CancellationToken)

Retrieves the most recent consensus timestamp observed by the mirror node via /api/v1/transactions?limit=1&order=desc. There is no dedicated "now" endpoint on the mirror node; this is the canonical way to get a current-ish network clock.

Declaration
public static Task<ConsensusTimeStamp> GetLatestConsensusTimestampAsync(this MirrorRestClient client, CancellationToken cancellationToken = default)
Parameters
Type Name Description
MirrorRestClient client

Mirror Rest Client to use for the request.

CancellationToken cancellationToken

Optional token that cancels the request.

Returns
Type Description
Task<ConsensusTimeStamp>

The latest consensus timestamp known by the mirror node, or MinValue if the mirror has no transactions recorded yet (e.g., freshly-started local node).

Remarks

This is the clock to judge a transaction's expiry by when settling an unknown outcome: a transaction the mirror has not recorded can no longer execute once this time is past its valid start plus its duration, plus a margin for lagging mirror replicas. Read it before looking the transaction up, so the lookup sees at least everything the mirror held at that time. The local clock is no substitute. See the example on ConsensusException.

  • Edit this page
  • View Source
In this article
Back to top .NET Client Library for Hiero Network and Hedera Hashgraph