Show / Hide Table of Contents

Class CreateAccountExtensions

Extension methods for creating cryptocurrency accounts.

Inheritance
object
CreateAccountExtensions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Hiero
Assembly: Hiero.dll
Syntax
public static class CreateAccountExtensions

Methods

| Edit this page View Source

CreateAccountAsync(ConsensusClient, CreateAccountParams, Action<IConsensusContext>?)

Creates a new network account with a given initial balance and other values as indicated in the create parameters.

Declaration
public static Task<CreateAccountReceipt> CreateAccountAsync(this ConsensusClient client, CreateAccountParams createParameters, Action<IConsensusContext>? configure = null)
Parameters
Type Name Description
ConsensusClient client

The Consensus Node Client orchestrating the create.

CreateAccountParams createParameters

The account creation parameters, includes the initial balance, public key and values associated with the new account.

Action<IConsensusContext> configure

Optional callback method providing an opportunity to modify the execution configuration for just this method call. It is executed prior to submitting the request to the network.

Returns
Type Description
Task<CreateAccountReceipt>

A transaction receipt with a description of the newly created account.

Examples
// Create a new account funded with 1 HBAR from the client's Payer.
// `newAccountEndorsement` is the public key or key list that will
// authorize future transactions on the new account.
var receipt = await client.CreateAccountAsync(new CreateAccountParams
{
    Endorsement = newAccountEndorsement,
    InitialBalance = 100_000_000, // 1 HBAR in tinybars
    Memo = "Created via Hiero SDK"
});
Console.WriteLine($"New account: {receipt.Address}");
Exceptions
Type Condition
ArgumentOutOfRangeException

If required arguments are missing.

InvalidOperationException

If required context configuration is missing.

PrecheckException

If the gateway node rejected the request upon submission.

ConsensusException

If the network was unable to come to consensus before the duration of the transaction expired.

TransactionException

If the network rejected the create request as invalid or had missing data.

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