hiero-ledger / hiero-sdk-go

Hiero SDK for Go
https://docs.hedera.com/docs/hedera-sdks
Apache License 2.0
110 stars 66 forks source link
distributed-ledger-technology go hacktoberfest hashgraph hedera hedera-sdk hiero sdk sdk-go

Hiero Go SDK

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).

Usage

Install

$ go install github.com/hiero-ledger/hiero-sdk-go/v2@latest

[!NOTE]
google.golang.org/protobuf v1.27.1 Breaks the SDK as it contains multiple protobuf files with the same name. Make sure to use v1.26.1 instead. The follow snippet can be used in go.mod to force the project to use v1.26.1

replace (
google.golang.org/protobuf v1.27.1 => google.golang.org/protobuf v1.26.1-0.20210525005349-febffdd88e85
)

Running Integration Tests

$ env CONFIG_FILE="<your_config_file>" go test -v Integration -timeout 9999s

or

$ env CONFIG_FILE="<your_config_file>" OPERATOR_KEY="<key>" OPERATOR_ID="<id>" go test -v Integration -timeout 9999s

or

$ env OPERATOR_KEY="<key>" OPERATOR_ID="<id>" go test -v Integration -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 Hedera testnet and OPERATOR_KEY and OPERATOR_ID must be provided.

Example Config File

Linting

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

Contributing

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.

Code of Conduct

Hiero uses the Linux Foundation Decentralised Trust Code of Conduct.

License

Apache License 2.0