Skip to main content

ResQ.Blockchain.INeoClient

INeoClient.RecordEventAsync(BlockchainEvent, CancellationToken) Method

Records an event on the Neo N3 blockchain.
System.Threading.Tasks.Task<ResQ.Blockchain.TransactionResult> RecordEventAsync(ResQ.Blockchain.BlockchainEvent evt, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));

Parameters

evt BlockchainEvent The blockchain event to record. cancellationToken System.Threading.CancellationToken Cancellation token for the operation.

Returns

System.Threading.Tasks.Task<TransactionResult>
A TransactionResult containing the transaction hash and confirmation status.

Exceptions

System.InvalidOperationException
Thrown when the blockchain operation fails.
System.OperationCanceledException
Thrown when the operation is cancelled.

Example

var evt = new BlockchainEvent(
    EventId: "evt-001",
    EventType: "IncidentDetected",
    Payload: "{\"id\":\"inc-001\"}",
    IpfsCid: null,
    Timestamp: DateTimeOffset.UtcNow
);

var result = await neoClient.RecordEventAsync(evt);
Console.WriteLine($"Transaction: {result.TransactionHash}");

Remarks

Events are permanently recorded on the blockchain and provide an immutable audit trail. The operation may take several seconds to complete as it waits for transaction confirmation.