The Go SDK for interacting with a Hiero based network. Hiero communicates using gRPC; the Protobufs definitions for the protocol are available in the hashgraph/hedera-protobuf repository (the repo will be migrated to Hiero in near future).
$ go get github.com/hiero-ledger/hiero-sdk-go/v2@latest
$ env CONFIG_FILE="<your_config_file>" go test ./sdk -tags="e2e" -v -timeout 9999s
or
$ env OPERATOR_KEY="<key>" OPERATOR_ID="<id>" go test ./sdk -tags="e2e" -timeout 9999s
$ go test ./sdk -tags="unit" -v -timeout 9999s
The config file can contain both the network and the operator, but you can also
use environment variables OPERATOR_KEY
and OPERATOR_ID
. If both are provided
the network is used from the config file, but for the operator the environment variables
take precedence. If the config file is not provided then the network will default to Hiero testnet
and OPERATOR_KEY
and OPERATOR_ID
must be provided.
This repository uses golangci-lint for linting. You can install a pre-commit git hook that runs golangci-lint before each commit by running the following command:
scripts/install-hooks.sh
This script automates the process of moving and compiling .proto
files using protoc
. It supports multiple source directories for proto
definitions and allows for configurable destination directory for the generation output.
Run the script with the following command:
go run generate_proto.go -source <dir1,dir2,...> -dest <dir>
-
-source (required): A comma-separated list of directories containing .proto files.
-
-dest (required): The destination directory where all .proto files will be moved before compilation.
go run generate_proto.go -source ../services/hapi/hedera-protobufs/services/state,../services/hapi/hedera-protobufs/services/auxiliary -dest ../services/hapi/hedera-protobufs/services
- If proto file definitions are located in the
services
submodule make sure it is initialised. - Keep in mind that the script does not still support protobuf import altering. If errors related to
the
proto
import paths occur we resolve them manually.
Whether you’re fixing bugs, enhancing features, or improving documentation, your contributions are important — let’s build something great together!
Please read our contributing guide to see how you can get involved.
Hiero uses the Linux Foundation Decentralised Trust Code of Conduct.