Hedera (hedera_ex)
A native Elixir SDK for the Hedera network — keys, identifiers, protoc-generated protobuf, gRPC, and the Consensus, Crypto, Token (incl. NFTs), File, Schedule and Smart Contract services. No NIFs for the core crypto; no Java/Python bridge.
Installation
Add hedera_ex to your deps in mix.exs:
def deps do
[{:hedera_ex, "~> 0.2.0"}]
end
Status: alpha — but it talks to the network. The crypto/encoding foundation is unit-tested offline, and building, signing and submitting transactions has been validated against the live Hedera testnet (the node accepts the natively-signed transactions and returns SUCCESS receipts). APIs may still change.
It exists because the Elixir ecosystem has no maintained Hedera SDK — projects that need on-chain anchoring from the BEAM currently shell out to the Python/Java SDKs. This library brings the hard parts (Hedera's exact signing conventions and protobuf/gRPC wire format) into pure, tested Elixir.
What works today
| Area | Module(s) | Notes |
|---|---|---|
| Keccak-256 | Hedera.Crypto.Keccak | Pure Elixir; the Ethereum/Hedera padding (not SHA3). Matches known vectors. |
| Ed25519 keys | Hedera.PrivateKey, Hedera.PublicKey | Generate, sign, verify, hex round-trip. |
| ECDSA secp256k1 keys | same | Hedera convention: Keccak-256 prehash, canonical low-S 64-byte r‖s, 33-byte compressed public key. |
| Identifiers | Hedera.AccountId, Hedera.TopicId, Hedera.Timestamp, Hedera.TransactionId, Hedera.Duration | Parse / format / protobuf-encode. |
| Protobuf | Hedera.Proto | Minimal proto3 wire encoder + decoder. |
| Wire encoding | Hedera.Pb.* (protoc-generated) | Hedera.Transaction builds every body as a generated struct; priv/protos + generate.sh. |
| Transactions | Hedera.Transaction | Build + sign TransactionBody → SignedTransaction → Transaction. Multi-signature via :signers. |
| Consensus Service | submit_message/3, create_topic/2 | Create topics, submit messages (HCS). Verified live. |
| Crypto Service | transfer_hbar/3 | HBAR transfers (sint64/ZigZag; must net to zero). Verified live. |
| Token Service (HTS) | create_token/2, mint_token/4, burn_token/4, associate_token/4, transfer_token/4, transfer_nft/4, freeze_token/unfreeze_token, grant_kyc/revoke_kyc, wipe_token, pause_token/unpause_token | Fungible and NFT create / mint (metadata) / transfer, plus freeze / KYC / wipe / pause management. Full lifecycle verified live. |
| File Service | create_file/2, append_file/4, update_file/3, delete_file/2 | Verified live. |
| Schedule Service | create_schedule/2, sign_schedule/3 | Scheduled transfers + multi-sig collection. Verified live. |
| Smart Contract Service | create_contract/2, call_contract/3 | Deploy (inline bytecode or file) + call. Verified live. |
| gRPC | Hedera.Grpc, Hedera.Client, Hedera.Network | Unary calls over HTTP/2 (h2c); multi-node address book + cross-node retry. |
| Receipts | transaction_receipt/3, Hedera.Receipt | Poll getTransactionReceipts → status, topic seq / hash, token / file / schedule / contract id, new total supply, NFT serials. Verified live. |
| Mirror node | Hedera.MirrorNode | REST reads (topic messages, transactions). |
alias Hedera.{AccountId, Client, PrivateKey, TopicId}
client =
Client.testnet(
AccountId.parse("0.0.8260469"),
PrivateKey.from_string_ecdsa(System.fetch_env!("OPERATOR_KEY"))
)
{:ok, %{precheck_code: 0, ok?: true}} =
Client.submit_message(client, TopicId.parse("0.0.9339331"), "audit-event-hash")
Run the live test yourself:
OPERATOR_ID=0.0.x OPERATOR_KEY=0x... mix test --include network
Roadmap
- Keccak-256, Ed25519 + ECDSA secp256k1 (Hedera conventions), identifiers, protobuf primitives
TransactionBody+SignedTransaction+Transactionencoding (HCS create / submit)- gRPC client over HTTP/2 (
submitMessage,createTopic) — validated live on testnet - Receipt queries (status + sequence number) via gRPC
getTransactionReceipts— verified live - Mirror-node REST helpers (
Hedera.MirrorNode) - node address book + cross-node retry on transient (BUSY) failures
- Token Service (HTS), account create/transfer, crypto transfer
- protoc-generated message modules from the canonical Hedera
.protofiles - hex.pm release
Why field numbers aren't guessed
The transaction layer encodes Hedera protobuf messages whose field numbers must match the canonical schema exactly. Rather than ship unverified guesses, that layer lands together with the gRPC path so it can be validated end-to-end against a real testnet node.
Tests
mix test # offline; deterministic, no network
License
MIT — see LICENSE.