Categorygithub.com/hashgraph/hedera-sdk-go
modulepackage
0.9.4
Repository: https://github.com/hashgraph/hedera-sdk-go.git
Documentation: pkg.go.dev

# README

Actions Status

Hedera™ Hashgraph Go SDK

The Go SDK for interacting with Hedera Hashgraph: the official distributed consensus platform built using the hashgraph consensus algorithm for fast, fair and secure transactions. Hedera enables and empowers developers to build an entirely new class of decentralized applications.

Hedera Hashgraph communicates using gRPC; the Protobufs definitions for the protocol are available in the hashgraph/hedera-protobuf repository.

Install

$ go get github.com/hashgraph/hedera-sdk-go

Running Integration Tests

$ env CONFIG_FILE="<your_config_file>" go test -v _Execute

or

$ env CONFIG_FILE="<your_config_file>" OPERATOR_KEY="<key>" OPERATOR_ID="<id>" go test -v _Execute

or

$ env OPERATOR_KEY="<key>" OPERATOR_ID="<id>" go test -v _Execute

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 testnet and OPERATOR_KEY and OPERATOR_ID must be provided.

Example Config File

Contributing to this Project

We welcome participation from all developers! For instructions on how to contribute to this repo, please review the Contributing Guide.

License Information

Licensed under Apache License, Version 2.0 – see LICENSE in this repo or apache.org/licenses/LICENSE-2.0

# Packages

No description provided by the author
No description provided by the author

# Functions

AccountIDFromSolidityAddress constructs an AccountID from a string representation of a solidity address.
AccountIDFromString constructs an AccountID from a string formatted as `Shard.Realm.Account` (for example "0.0.3").
ClientForMainnet returns a preconfigured client for use with the standard Hedera mainnet.
ClientForPreviewnet returns a preconfigured client for use with the standard Hedera previewnet.
ClientForTestnet returns a preconfigured client for use with the standard Hedera testnet.
ClientFromFile takes a filename string representing the path to a JSON encoded Client file and returns a Client based on the configuration.
ClientFromJSON takes in the byte slice representation of a JSON string or document and returns Client based on the configuration.
ContractIDFromSolidityAddress constructs a ContractID from a string representation of a solidity address.
ContractIDFromString constructs a ContractID from a string formatted as `Shard.Realm.Contract` (for example "0.0.3").
Ed25519PrivateKeyFromBytes constructs an Ed25519PrivateKey from a raw slice of either 32 or 64 bytes.
Ed25519PrivateKeyFromKeystore recovers an Ed25519PrivateKey from an encrypted keystore encoded as a byte slice.
Ed25519PrivateKeyFromMnemonic recovers an Ed25519PrivateKey from a valid 24 word length mnemonic phrase and a passphrase.
No description provided by the author
Ed25519PrivateKeyFromString recovers an Ed25519PrivateKey from its text-encoded representation.
Ed25519PrivateKeyReadKeystore recovers an Ed25519PrivateKey from an encrypted keystore file.
No description provided by the author
Ed25519PublicKeyFromBytes constructs a known Ed25519PublicKey from its text-encoded representation.
Ed25519PublicKeyFromString recovers an Ed25519PublicKey from its text-encoded representation.
FileIDForAddressBook returns the public node address book for the current network.
FileIDForExchangeRate returns the current exchange rates of HBAR to USD.
FileIDForFeeSchedule returns the current fee schedule for the network.
No description provided by the author
FileIDFromString returns a FileID parsed from the given string.
GenerateEd25519PrivateKey generates a random new Ed25519PrivateKey.
No description provided by the author
GenerateMnemonic generates a random 24-word mnemonic.
HbarFrom creates a representation of Hbar in tinybar on the unit provided.
HbarFromTinybar creates a representation of Hbar in tinybars.
MnemonicFromString creates a mnemonic from a string of 24 words separated by spaces Keys are lazily generated.
NewAccountBalanceQuery creates an AccountBalanceQuery builder which can be used to construct and execute an AccountBalanceQuery.
NewAccountCreateTransaction creates an AccountCreateTransaction builder which can be used to construct and execute a Crypto Create Transaction.
NewAccountDeleteTransaction creates an AccountDeleteTransaction builder which can be used to construct and execute a Crypto Delete Transaction.
NewAccountInfoQuery creates an AccountInfoQuery builder which can be used to construct and execute an AccountInfoQuery.
NewAccountRecordsQuery creates an AccountRecordsQuery builder which can be used to construct and execute an AccountRecordsQuery.
NewAccountStakersQuery creates an AccountStakersQuery builder which can be used to construct and execute an AccountStakersQuery.
NewAccountUpdateTransaction creates an AccountUpdateTransaction builder which can be used to construct and execute a Crypto Update Transaction.
NewClient takes in a map of node addresses to their respective IDS (network) and returns a Client instance which can be used to.
No description provided by the author
NewConsensusMessageSubmitTransaction creates a ConsensusMessageSubmitTransaction builder which can be used to construct and execute a Consensus Submit Message Transaction.
NewConsensusTopicCreateTransaction creates a ConsensusTopicCreateTransaction builder which can be used to construct and execute a Consensus Create Topic Transaction.
NewConsensusTopicDeleteTransaction creates a ConsensusTopicDeleteTransaction builder which can be used to construct and execute a Consensus Delete Topic Transaction.
NewConsensusTopicInfoQuery creates a ConsensusTopicInfoQuery builder which can be used to construct and execute a Consensus Get Topic Info Query.
NewConsensusTopicUpdateTransaction creates a ConsensusTopicUpdateTransaction builder which can be used to construct and execute a Consensus Update Topic Transaction.
NewContractBytecodeQuery creates a ContractBytecodeQuery builder which can be used to construct and execute a Contract Get Bytecode Query.
NewContractCallQuery creates a ContractCallQuery builder which can be used to construct and execute a Contract Call Local Query.
NewContractCreateTransaction creates a ContractCreateTransaction builder which can be used to construct and execute a Contract Create Transaction.
NewContractDeleteTransaction creates a Contract Delete Transaction builder which can be used to construct and execute a Contract Delete Transaction.
NewContractExecuteTransaction creates a ContractExecuteTransaction builder which can be used to construct and execute a Contract Call Transaction.
No description provided by the author
No description provided by the author
NewContractInfoQuery creates a ContractInfoQuery builder which can be used to construct and execute a Contract Get Info Query.
NewContractRecordsQuery creates a ContractRecordsQuery builder which can be used to construct and execute a Contract Get Records Query.
NewContractUpdateTransaction creates a ContractUpdateTransaction builder which can be used to construct and execute a Contract Update Transaction.
NewCryptoTransferTransaction creates a CryptoTransferTransaction builder which can be used to construct and execute a Crypto Transfer Transaction.
NewFileAppendTransaction creates a FileAppendTransaction builder which can be used to construct and execute a File Append Transaction.
NewFileContentsQuery creates a FileContentsQuery builder which can be used to construct and execute a File Get Contents Query.
NewFileCreateTransaction creates a FileCreateTransaction builder which can be used to construct and execute a File Create Transaction.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewHbar constructs a new Hbar from a possibly fractional amount of hbar.
No description provided by the author
No description provided by the author
No description provided by the author
NewMnemonic Creates a mnemonic from a slice of 24 strings Keys are lazily generated.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewFileContentsQuery creates a FileContentsQuery builder which can be used to construct and execute a File Get Contents Query.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewTokenInfoQuery creates an TokenInfoQuery builder which can be used to construct and execute an TokenInfoQuery.
No description provided by the author
No description provided by the author
NewTokenTransferTransaction creates a TokenTransferTransaction builder which can be used to construct and execute a Token Transfers Transaction.
No description provided by the author
No description provided by the author
No description provided by the author
NewTransactionID constructs a new Transaction id struct with the provided AccountID and the valid start time set to the current time - 10 seconds.
No description provided by the author
NewTransactionIDWithValidStart constructs a new Transaction id struct with the provided AccountID and the valid start time set to a provided time.
No description provided by the author
No description provided by the author
NewTransferTransaction creates a TransferTransaction builder which can be used to construct and execute a Token Transfers Transaction.
ScheduleIDFromSolidityAddress constructs an ScheduleID from a string representation of a solidity address.
ScheduleIDFromString constructs an ScheduleID from a string formatted as `Shard.Realm.Account` (for example "0.0.3").
TokenIDFromSolidityAddress constructs an TokenID from a string representation of a solidity address.
TokenIDFromString constructs an TokenID from a string formatted as `Shard.Realm.Token` (for example "0.0.3").
TopicIDFromString constructs a TopicID from a string formatted as `Shard.Realm.Topic` (for example "0.0.3").

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

No description provided by the author
MaxHbar is the maximum amount the Hbar type can wrap.
MinHbar is the minimum amount the Hbar type can wrap.
ZeroHbar wraps a 0 value of Hbar.

# Structs

AccountBalanceQuery gets the balance of a CryptoCurrency account.
AccountCreateTransaction creates a new account.
AccountDeleteTransaction marks an account as deleted, moving all its current hbars to another account.
AccountID is the ID for a Hedera account.
AccountInfo is info about the account returned from an AccountInfoQuery.
AccountInfoQuery gets all the information about an account excluding account records.
AccountRecordsQuery gets all of the records for an account for any transfers into it and out of it, that were above the threshold, during the last 25 hours.
AccountStakersQuery gets all of the accounts that are proxy staking to this account.
AccountUpdateTransaction changes properties for the given account.
No description provided by the author
Client is the Hedera protocol wrapper for the SDK used by all transaction and query types.
No description provided by the author
No description provided by the author
A ConsensusMessageSubmitTransaction is used for submitting a message to HCS.
A ConsensusTopicCreateTransaction is for creating a new Topic on HCS.
A ConsensusTopicDeleteTransaction is for deleting a topic on HCS.
ConsensusTopicID is a unique identifier for a topic (used by the consensus service).
No description provided by the author
No description provided by the author
ConsensusTopicUpdateTransaction updates all fields on a Topic that are set in the transaction.
ContractBytecodeQuery retrieves the bytecode for a smart contract instance.
ContractCallQuery calls a function of the given smart contract instance, giving it ContractFunctionParameters as its inputs.
ContractCreateTransaction starts a new smart contract instance.
No description provided by the author
ContractExecuteTransaction calls a function of the given smart contract instance, giving it ContractFuncionParams as its inputs.
No description provided by the author
ContractFunctionResult is the result returned by a call to a smart contract function.
No description provided by the author
ContractID is the ID for a Hedera smart contract.
ContractInfo is the information about the contract instance returned by a ContractInfoQuery.
ContractInfoQuery retrieves information about a smart contract instance.
ContractLogInfo is the log info for events returned by a function.
ContractRecordsQuery retrieves all of the records for a smart contract instance, for any function call (or the constructor call) during the last 25 hours, for which a Record was requested.
ContractUpdateTransaction is used to modify a smart contract instance to have the given parameter values.
A CryptoTransferTransaction is for transferring hbar from some account balances to other account balances.
Ed25519PrivateKey is an ed25519 private key.
Ed25519PublicKey is an ed25519 public key.
ErrBadKey is returned if a key is provided in an invalid format or structure.
ErrHederaNetwork is returned in cases where the Hedera network cannot be reached or a network-side error occurs.
ErrHederaPreCheckStatus is returned by Transaction.Execute and QueryBuilder.Execute if an exceptional status is returned during network side validation of the sent transaction.
ErrHederaReceiptStatus is returned by TransactionID.GetReceipt if the status of the receipt is exceptional.
ErrHederaRecordStatus is returned by TransactionID.GetRecord if the status of the record is exceptional.
ErrLocalValidation is returned by TransactionBuilder.Build(*Client) and QueryBuilder.Execute(*Client) if the constructed transaction or query fails local sanity checks.
No description provided by the author
ErrMaxQueryPaymentExceeded is returned during query execution if the total cost of the query + estimated fees exceeds the max query payment threshold set on the client or QueryBuilder.
ErrPingStatus is returned by client.Ping(AccountID) if an error occurs.
FileAppendTransaction appends the given contents to the end of the file.
FileContentsQuery retrieves the contents of a file.
FileCreateTransaction creates a new file, containing the given contents.
No description provided by the author
A FileID is the ID for a file on the network.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Hbar is a typesafe wrapper around values of HBAR providing foolproof conversions to other denominations.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ScheduleID is the ID for a Hedera account.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
FileContentsQuery retrieves the contents of a file.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
TokenID is the ID for a Hedera token.
TokenInfo is info about the token returned from an TokenInfoQuery.
TokenInfoQuery gets all the information about an token excluding token records.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
TransactionBuilder is used to construct Transactions.
TransactionID is the id used to identify a Transaction on the Hedera network.
No description provided by the author
TransactionReceipt is the consensus result for a transaction which is returned from a TransactionReceiptQuery.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

EntityID is an interface for various IDs of entities (Account, Contract, File, etc).
Transaction contains the protobuf of a prepared transaction which can be signed and executed.
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
TransactionSigner is a closure or function that defines how transactions will be signed.