Table of Contents

Interface ILedgerService

Namespace
NuvTools.Blockchain
Assembly
NuvTools.Blockchain.dll

Defines the contract for blockchain ledger operations.

public interface ILedgerService

Methods

ReadAsync<T>(string, string?, int, int, CancellationToken)

Reads an entry from the ledger.

Task<LedgerEntry<T>?> ReadAsync<T>(string transactionId, string? collectionId = null, int maxRetries = 10, int delayMilliseconds = 500, CancellationToken cancellationToken = default) where T : class

Parameters

transactionId string

The transaction ID to read.

collectionId string

Optional collection/sub-ledger identifier.

maxRetries int

Maximum retry attempts for pending entries.

delayMilliseconds int

Base delay between retries in milliseconds.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<LedgerEntry<T>>

The ledger entry if found; otherwise, null.

Type Parameters

T

The type of the entry content.

WriteAsync<T>(T, string?, CancellationToken)

Writes an entry to the ledger.

Task<string> WriteAsync<T>(T entry, string? collectionId = null, CancellationToken cancellationToken = default) where T : class

Parameters

entry T

The entry to write.

collectionId string

Optional collection/sub-ledger identifier.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<string>

The transaction ID of the written entry.

Type Parameters

T

The type of the entry content.