Show / Hide Table of Contents

What is Hiero?

Hiero provides access to the Hedera Hashgraph Network for the .NET platform. It manages the communication details with participating network nodes and provides an efficient set of asynchronous interface methods for consumption by .NET programs.

Hiero is built with .NET 10

How do I Install It?

Hiero is published in NuGet. You can install it with your favorite NuGet client, for example from the command line:

dotnet add package Hiero

The library references a minimum of dependencies. It relies on .NET's native gRPC libraries to access the Hedera network and utilizes the cryptographic services provided by the Bouncy Castle Project.

What does 'Hello World' for this Library Look like?

The most simple thing one can ask of the Hedera network is the balance of an account. Here is an example console program:

class Program
{
    static async Task Main(string[] args)
    {
        // Usage: dotnet run -- https://2.testnet.hedera.com:50211 0.0.5 0.0.98
        var endpointUrl = args[0];
        if (!EntityId.TryParseShardRealmNum(args[1], out var nodeAccount))
            throw new ArgumentException($"Invalid node account: {args[1]}");
        if (!EntityId.TryParseShardRealmNum(args[2], out var queryAccount))
            throw new ArgumentException($"Invalid query account: {args[2]}");

        try
        {
            await using var client = new ConsensusClient(ctx =>
            {
                ctx.Endpoint = new ConsensusNodeEndpoint(nodeAccount, new Uri(endpointUrl));
            });
            var balance = await client.GetAccountBalanceAsync(queryAccount);
            Console.WriteLine($"Account Balance for {queryAccount} is {balance:#,#} tinybars.");
        }
        catch (Exception ex)
        {
            Console.Error.WriteLine(ex.Message);
            Console.Error.WriteLine(ex.StackTrace);
        }
    }
}

Hiero provides access to the Hedera network via the ConsensusClient object. The ConsensusClient object orchestrates the request construction and communication with the Hedera network. During creation, it requires a small amount of configuration. At a minimum to retrieve an account balance, the client must be configured with an Endpoint. The ConsensusNodeEndpoint object represents the internet network address and account for the node processing requests. The EntityId identifies accounts, tokens, topics, and other entities using the standard shard.realm.num format (e.g. 0.0.98). Use EntityId.TryParseShardRealmNum to parse them from strings — this accepts the same format the Hedera portal gives you.

How do I learn more?

  • Tutorials: Step-by-step guides with code for every major workflow:

    • Crypto Transactions
      • Get Account Balance
      • Transfer Crypto
      • Get Account Info
      • Create New Account
      • Update Account
      • Delete Account
    • Fungible Tokens
      • Create a Token
      • Mint Tokens
      • Transfer Tokens
      • Associate and Dissociate
    • Non-Fungible Tokens (NFTs)
      • Create an NFT Collection
      • Mint an NFT
      • Transfer an NFT
    • Consensus Service (HCS)
      • Create a Topic
      • Submit a Message
      • Subscribe to a Topic
    • Smart Contracts
      • Deploy and Call a Contract
    • File Manipulation
      • Create File
    • Scheduled Transactions
      • Schedule a Transaction
    • Airdrops
      • Airdrop Tokens
    • Mirror Node
      • Query Historical State
    • Miscellaneous
      • Fee Schedule
      • Exchange Rates
      • Suspend Network
  • Developer Guides:

    • Network Configuration — testnet vs mainnet, node rotation patterns
    • Key Management — environment variables, vaults, async signing
    • Dependency Injection — registering clients with IServiceCollection
    • Error Handling — exception hierarchy, transient vs permanent codes, retry patterns
    • Logging — gRPC-level diagnostics
  • API Documentation: Generated API reference with code examples for every type and method.

  • API Cookbook: Quick reference for all SDK operations in one flat list.

Is this project Open Source?

Yes, this is an open source project released under the Apache-2.0 License, the source code can be found at https://github.com/bugbytesinc/Hiero.

  • Edit this page
In this article
Back to top .NET Client Library for Hiero Network and Hedera Hashgraph