Show / Hide Table of Contents

Class SubmitMessageParams

Submit Message Parameters, optionally including message segment information.

Inheritance
object
TransactionParams
TransactionParams<SubmitMessageReceipt>
SubmitMessageParams
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Hiero
Assembly: Hiero.dll
Syntax
public sealed class SubmitMessageParams : TransactionParams<SubmitMessageReceipt>
Remarks

The hedera network does not validate the segment information submitted to a consensus topic. This metadata must be validated upon consumption and there can be gaps and inconsistencies in the resulting mirror HCS stream for the related topic.

Examples

Split a large payload across multiple segments. The SDK fills in the ParentTransactionId for segment 1 from the returned receipt — pass that id on each subsequent segment:

// Messages larger than ~4KB must be split into segments. On segment 1,
// leave ParentTransactionId null — the SDK computes it for you and
// returns it via the receipt. Pass that TransactionId as the
// ParentTransactionId on every subsequent segment so the mirror node
// can reassemble them into a single logical message.
const int chunkSize = 4000;
var totalSegments = (int)Math.Ceiling((double)largePayload.Length / chunkSize);

var first = await client.SubmitMessageAsync(new SubmitMessageParams
{
    Topic = topic,
    Message = largePayload.Slice(0, Math.Min(chunkSize, largePayload.Length)),
    SegmentIndex = 1,
    TotalSegmentCount = totalSegments
});

for (int i = 1; i < totalSegments; i++)
{
    var offset = i * chunkSize;
    var length = Math.Min(chunkSize, largePayload.Length - offset);
    await client.SubmitMessageAsync(new SubmitMessageParams
    {
        Topic = topic,
        Message = largePayload.Slice(offset, length),
        ParentTransactionId = first.TransactionId,
        SegmentIndex = i + 1,
        TotalSegmentCount = totalSegments
    });
}

Properties

| Edit this page View Source

CancellationToken

Optional cancellation token that can interrupt the submission process.

Declaration
public CancellationToken? CancellationToken { get; set; }
Property Value
Type Description
CancellationToken?
| Edit this page View Source

Message

The value of this message or segment of the message, limited to the 4K total network transaction size.

Declaration
public ReadOnlyMemory<byte> Message { get; set; }
Property Value
Type Description
ReadOnlyMemory<byte>
| Edit this page View Source

ParentTransactionId

If this is a segment of a larger message, the transaction that created the first segment of the message. This acts as a correlation identifier to coalesce the segments of the message into one.

Declaration
public TransactionId? ParentTransactionId { get; set; }
Property Value
Type Description
TransactionId
Remarks

This must be left to be null when sending the first segment of a message. The value of the transaction ID returned from the receipt or record will contain the value associated with this parameter for the first segment. This value must be included in subsequent segments for this message.

| Edit this page View Source

SegmentIndex

The index of this segment (one based). Leave as zero (0) to submit an un-segmented message.

Declaration
public int SegmentIndex { get; set; }
Property Value
Type Description
int
| Edit this page View Source

Signatory

The signatory containing any additional private keys or callbacks to meet the key signing requirements for participants.

Declaration
public Signatory? Signatory { get; set; }
Property Value
Type Description
Signatory
| Edit this page View Source

Topic

The address of the topic for the message.

Declaration
public EntityId Topic { get; set; }
Property Value
Type Description
EntityId
| Edit this page View Source

TotalSegmentCount

The total number of segments making up the whole of the message when assembled. Set to 0 to indicate that this is not a a segmented message.

Declaration
public int TotalSegmentCount { get; set; }
Property Value
Type Description
int
  • Edit this page
  • View Source
In this article
Back to top .NET Client Library for Hiero Network and Hedera Hashgraph