Skip to main content

HCS-17 Transactions

Note

  • These builders are for direct transaction construction (e.g., with the Standards Agent Kit or custom pipelines).
  • For most applications, prefer the higher‑level client (Node/Go) or browser client (wallet).

Sources

All transaction construction is centralized in builders. Clients never assemble JSON payloads themselves. Builders return Hedera SDK transaction instances ready to be signed and executed.

Create TopicDirect link to Create Topic

import { buildHcs17CreateTopicTx } from '@hashgraphonline/standards-sdk';

const tx = buildHcs17CreateTopicTx({
ttl: 86400,
adminKey: true,
submitKey: true,
});
// Node: await tx.execute(client)
// Browser: await (await tx.freezeWithSigner(signer)).executeWithSigner(signer)

This builder encodes the memo as hcs-17:<type>:<ttl> using numeric enums (HCS17TopicType.STATE = 0).

Submit State Hash MessageDirect link to Submit State Hash Message

import { buildHcs17MessageTx } from '@hashgraphonline/standards-sdk';

const tx = buildHcs17MessageTx({
topicId: '0.0.7777',
stateHash: 'ab…',
accountId: '0.0.1234',
topics: ['0.0.2001', '0.0.2002'],
memo: 'optional app memo',
transactionMemo: 'HCS-17 publish',
});

The builder constructs the canonical HCS‑17 payload internally:

{
"p": "hcs-17",
"op": "state_hash",
"state_hash": "…",
"topics": ["…"],
"account_id": "…",
"timestamp": "ISO8601",
"m": "…"
}

Execution PatternsDirect link to Execution Patterns

  • Node: await tx.execute(client).then(r => r.getReceipt(client))
  • Browser: await (await tx.freezeWithSigner(signer)).executeWithSigner(signer) then getReceiptWithSigner