Skip to main content

Hashgraph Online Go SDK

The Go SDK (standards-sdk-go) provides a native Go implementation of the Hiero Consensus Specifications (HCS) and Registry Broker utilities, offering the same capabilities as the TypeScript SDK for Go developers.

Go Reference Go Report Card

What This SDK DoesDirect link to What This SDK Does

  • Implements HCS Protocols — Full Go implementations of HCS-2, HCS-5, HCS-11, HCS-14, HCS-15, HCS-16, HCS-17, HCS-20, and HCS-27
  • Inscriber Utilities — Kiloscribe auth, websocket-based inscription, quote generation, bulk-files, and skill inscription helpers
  • Registry Broker Client — Full-featured client for search, agents, credits, verification, ledger auth, chat/encryption, feedback, and skills (including DNS TXT domain proof)
  • Idiomatic Go Patterns — Context-aware APIs, structured error handling, and familiar Go conventions

InstallationDirect link to Installation

go get github.com/hashgraph-online/standards-sdk-go@latest

Quick StartDirect link to Quick Start

package main

import (
"context"
"fmt"
"log"

"github.com/hashgraph-online/standards-sdk-go/pkg/hcs2"
)

func main() {
client, err := hcs2.NewClient(hcs2.ClientConfig{
OperatorAccountID: "0.0.1234",
OperatorPrivateKey: "<private-key>",
Network: "testnet",
})
if err != nil {
log.Fatal(err)
}

result, err := client.CreateRegistry(context.Background(), hcs2.CreateRegistryOptions{
RegistryType: hcs2.RegistryTypeIndexed,
TTL: 86400,
UseOperatorAsAdmin: true,
UseOperatorAsSubmit: true,
})
if err != nil {
log.Fatal(err)
}

fmt.Printf("Registry created: %s\n", result.TopicID)
}

Supported PackagesDirect link to Supported Packages

PackageStandardDescription
pkg/hcs2HCS-2Registry topic creation, tx builders, indexed entry operations, memo helpers, mirror reads
pkg/hcs5HCS-5Hashinal minting helpers and end-to-end inscribe+mint workflow
pkg/hcs11HCS-11Profile models/builders, validation, inscription, account memo updates, profile resolution
pkg/hcs14HCS-14UAID generation/parsing plus profile resolution (_uaid, _agent, ANS _ans, uaid:did base)
pkg/hcs15HCS-15Base/petal account creation, tx builders, petal/base key verification helpers
pkg/hcs16HCS-16Flora account + topic management, message builders/senders, threshold-member key assembly
pkg/hcs17HCS-17State-hash topic/message support, deterministic state hash calculators, verification
pkg/hcs20HCS-20Auditable points deployment, mint/transfer/burn flows, tx builders, and state indexing
pkg/hcs27HCS-27Checkpoint topic creation, publish/retrieval, validation, Merkle/proof helpers
pkg/inscriberKiloscribe auth flow, websocket inscription, quote generation, bulk-files, skill inscription
pkg/registrybrokerFull Registry Broker client (search, adapters, agents, credits, verification, chat, skills)
pkg/mirrorMirror node client used by HCS and inscriber packages
pkg/sharedNetwork normalization, operator env loading, Hedera client/key parsing helpers

Registry Broker skill verification (domain proof)Direct link to Registry Broker skill verification (domain proof)

import "github.com/hashgraph-online/standards-sdk-go/pkg/registrybroker"

client, _ := registrybroker.NewRegistryBrokerClient(registrybroker.RegistryBrokerClientOptions{
APIKey: "<registry-broker-api-key>",
BaseURL: "https://hol.org/registry/api/v1",
})

status, _ := client.GetSkillVerificationStatusWithOptions(
context.Background(),
"demo-skill",
registrybroker.SkillVerificationStatusOptions{Version: "1.0.0"},
)

challenge, _ := client.CreateSkillDomainProofChallenge(
context.Background(),
registrybroker.SkillVerificationDomainProofChallengeRequest{
Name: "demo-skill",
Version: "1.0.0",
Domain: "example.com",
},
)

_, _ = client.VerifySkillDomainProof(
context.Background(),
registrybroker.SkillVerificationDomainProofVerifyRequest{
Name: "demo-skill",
Version: "1.0.0",
Domain: "example.com",
ChallengeToken: "<token-from-dns-txt-record>",
},
)

_ = status
_ = challenge

Registry Broker UAID DNS verification (HCS-14)Direct link to Registry Broker UAID DNS verification (HCS-14)

import "github.com/hashgraph-online/standards-sdk-go/pkg/registrybroker"

client, _ := registrybroker.NewRegistryBrokerClient(registrybroker.RegistryBrokerClientOptions{
APIKey: "<registry-broker-api-key>",
BaseURL: "https://hol.org/registry/api/v1",
})

uaid := "uaid:aid:3AUoqGTHnMXv1PB8ATCtkB86Xw2uEEJuqMRNCirGQehhNhnQ1vHuwJfAh5K5Dp6RFE;uid=registry-ping-agent;registry=a2a-registry;proto=a2a-registry;nativeId=hol.org"
persist := true
refresh := true

verifyResult, _ := client.VerifyUaidDnsTXT(
context.Background(),
registrybroker.VerificationDnsVerifyRequest{
UAID: uaid,
Persist: &persist,
},
)

dnsStatus, _ := client.GetVerificationDNSStatus(
context.Background(),
uaid,
registrybroker.VerificationDnsStatusQuery{
Refresh: &refresh,
Persist: &persist,
},
)

_ = verifyResult
_ = dnsStatus

Client methods map to:

  • POST /api/v1/verification/dns/verify
  • GET /api/v1/verification/dns/status/:uaid

Environment VariablesDirect link to Environment Variables

The SDK auto-loads .env from the current working directory or ancestor directories before resolving credentials.

CommonDirect link to Common

VariableDescription
HEDERA_ACCOUNT_IDHedera operator account ID
HEDERA_PRIVATE_KEYHedera operator private key
HEDERA_NETWORKTarget network (testnet or mainnet)

Aliases are also supported: HEDERA_OPERATOR_ID/HEDERA_OPERATOR_KEY, OPERATOR_ID/OPERATOR_KEY, ACCOUNT_ID/PRIVATE_KEY.

Network-scoped OverridesDirect link to Network-scoped Overrides

VariableDescription
TESTNET_HEDERA_ACCOUNT_IDTestnet operator account ID
TESTNET_HEDERA_PRIVATE_KEYTestnet operator private key
MAINNET_HEDERA_ACCOUNT_IDMainnet operator account ID
MAINNET_HEDERA_PRIVATE_KEYMainnet operator private key

Running TestsDirect link to Running Tests

# All packages
go test ./...

# Live HCS + Inscriber integration (no mocks)
RUN_INTEGRATION=1 \
RUN_INSCRIBER_INTEGRATION=1 \
go test -v ./pkg/hcs2 ./pkg/hcs27 ./pkg/inscriber

TypeScript SDK ComparisonDirect link to TypeScript SDK Comparison

The Go SDK mirrors the TypeScript SDK's structure and capabilities. See the Standards SDK (TypeScript) documentation for the TypeScript equivalents. Throughout the per-standard documentation pages, you can switch between TypeScript and Go code snippets using the language tabs.

Community and SupportDirect link to Community and Support