Skip to main content

HCS-27: Transparency Log Checkpoints

HCS-27 anchors append-only transparency logs to Hedera by publishing signed or unsigned checkpoint commitments. The Standards SDK now exposes draft-aligned HCS-27 clients in TypeScript, Go, and Python, including topic creation, checkpoint publication, mirror-node reads, Merkle helpers, proof verification, and automatic overflow metadata inscription when a checkpoint payload exceeds the Hedera message size limit.

What the SDK CoversDirect link to What the SDK Covers

  • Draft-aligned checkpoint message and metadata shapes.
  • Topic memo and transaction memo helpers for HCS-27 topics.
  • Checkpoint publication with root.treeSize, rootHashB64u, and optional prev linkage.
  • Mirror-node checkpoint reads with resolved effective metadata.
  • Inclusion and consistency proof verification helpers.
  • Automatic HCS-1 metadata references plus metadata_digest when the serialized checkpoint exceeds 1024 bytes.

InstallationDirect link to Installation

pnpm add @hashgraphonline/standards-sdk
# npm install @hashgraphonline/standards-sdk

QuickstartDirect link to Quickstart

import { createHash } from 'node:crypto';
import { HCS27Client } from '@hashgraphonline/standards-sdk';

const rootHash = (value: string): string =>
createHash('sha256').update(value).digest('base64url');

const client = new HCS27Client({
operatorId: process.env.HEDERA_ACCOUNT_ID!,
operatorKey: process.env.HEDERA_PRIVATE_KEY!,
network: 'testnet',
});

const topic = await client.createCheckpointTopic({
ttl: 3600,
adminKey: true,
submitKey: true,
});

await client.publishCheckpoint(
topic.topicId,
{
type: 'ans-checkpoint-v1',
stream: { registry: 'ans', log_id: 'typescript-example' },
log: {
alg: 'sha-256',
leaf: 'sha256(jcs(event))',
merkle: 'rfc9162',
},
root: {
treeSize: '1',
rootHashB64u: rootHash('ts-sdk-hcs27-root-1'),
},
},
'typescript checkpoint 1',
);

const checkpoints = await client.getCheckpoints(topic.topicId);
client.validateCheckpointChain(checkpoints);
console.log(checkpoints[0]?.effectiveMetadata.root.rootHashB64u);

Automatic Overflow InscriptionDirect link to Automatic Overflow Inscription

When a serialized checkpoint message would exceed the Hedera TopicMessageSubmitTransaction payload limit, the SDK automatically stores the full metadata as an inscription and publishes an HCS-27 message with:

  • metadata: "hcs://1/<topicId>"
  • metadata_digest: { alg: "sha-256", b64u: "..." }

You do not need to chunk or assemble the HCS-1 payload manually. getCheckpoints(...) resolves the effective metadata for you, and resolveHCS1Reference(...) is available if you want the raw bytes directly.

ReferencesDirect link to References