Builds and signs Hedera transactions for the Consensus, Crypto and Token Services.
The flow follows the Hedera HAPI: encode a TransactionBody, sign its exact
bytes with the operator key (and any additional :signers), wrap them in a
SignedTransaction (bodyBytes + signature map), and finally a Transaction
(signedTransactionBytes). The signature is computed over the precise
bodyBytes that are transmitted.
Protobuf field numbers are taken from the canonical Hedera protobufs and are validated end-to-end against a live node by the gRPC layer.
Summary
Functions
Build + sign a consensusCreateTopic transaction. By default the topic is
open (no admin/submit key). Optional: :memo, :max_fee.
Build + sign a cryptoTransfer of HBAR and/or HTS tokens.
Build + sign a consensusSubmitMessage transaction.
Build + sign a tokenAssociate. Required: :account (an AccountId) and
:tokens (a list of TokenId). The account being associated must sign — pass
its key via :signers when it differs from the operator.
Build + sign a tokenBurn. Required: :token and :amount. Requires the
token's supply key to sign.
Build + sign a tokenCreation. Required: :treasury (an AccountId).
Common opts: :name, :symbol, :decimals, :initial_supply, :admin_key,
:supply_key (both PublicKeys — needed to later mint/burn), :token_type
(:fungible | :nft), :supply_type (:infinite | :finite),
:max_supply, :token_memo, :auto_renew_account, :auto_renew_period.
Build + sign a tokenMint. Required: :token (a TokenId). For fungible
tokens pass :amount (smallest unit); for NFTs pass :metadata (a list of
binaries). Requires the token's supply key to sign.
Types
@type build_result() :: %{ transaction: binary(), transaction_id: Hedera.TransactionId.t() }
Functions
@spec create_topic(keyword()) :: build_result()
Build + sign a consensusCreateTopic transaction. By default the topic is
open (no admin/submit key). Optional: :memo, :max_fee.
@spec crypto_transfer(keyword()) :: build_result()
Build + sign a cryptoTransfer of HBAR and/or HTS tokens.
Opts (standard operator/node options plus):
:transfers— HBAR moves, a list of{%AccountId{}, tinybars}pairs.:token_transfers— token moves, a list of{%TokenId{}, [{%AccountId{}, amount}]}pairs.
Debits are negative, credits positive, and each currency (HBAR, and every
token independently) MUST net to zero. Amounts are encoded as protobuf
sint64 (ZigZag), matching AccountAmount. Optional: :memo, :max_fee.
@spec submit_message(keyword()) :: build_result()
Build + sign a consensusSubmitMessage transaction.
Required opts: :operator_id, :operator_key, :node_account_id, :topic_id,
:message. Optional: :max_fee, :memo.
@spec token_associate(keyword()) :: build_result()
Build + sign a tokenAssociate. Required: :account (an AccountId) and
:tokens (a list of TokenId). The account being associated must sign — pass
its key via :signers when it differs from the operator.
@spec token_burn(keyword()) :: build_result()
Build + sign a tokenBurn. Required: :token and :amount. Requires the
token's supply key to sign.
@spec token_create(keyword()) :: build_result()
Build + sign a tokenCreation. Required: :treasury (an AccountId).
Common opts: :name, :symbol, :decimals, :initial_supply, :admin_key,
:supply_key (both PublicKeys — needed to later mint/burn), :token_type
(:fungible | :nft), :supply_type (:infinite | :finite),
:max_supply, :token_memo, :auto_renew_account, :auto_renew_period.
The treasury account (and the admin key, if set) must sign — pass extra keys
via :signers when they differ from the operator.
@spec token_mint(keyword()) :: build_result()
Build + sign a tokenMint. Required: :token (a TokenId). For fungible
tokens pass :amount (smallest unit); for NFTs pass :metadata (a list of
binaries). Requires the token's supply key to sign.