Show / Hide Table of Contents

Class EntityId

Identifies a Hedera Address, Token, File, Topics, or Contract, typically
in the native format of 
shard.realm.num

, but can also hold a Key Alias or EVM Payer if such an Entity TransactionId type is required.

Inheritance
object
EntityId
Implements
IEquatable<EntityId>
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
Namespace: Hiero
Assembly: Hiero.dll
Syntax
[JsonConverter(typeof(EntityIdConverter))]
public sealed record EntityId : IEquatable<EntityId>

Constructors

| Edit this page View Source

EntityId(long, long, Endorsement)

Constructor creating a form of Entity TransactionId that represents a Key Alias.

Declaration
public EntityId(long shardNum, long realmNum, Endorsement keyAlias)
Parameters
Type Name Description
long shardNum

The shard number for this Entity ID.

long realmNum

The realm number for this Entity ID.

Endorsement keyAlias

The Ed25519 or ECDSA Secp 256K1 Endorsement this Entity TransactionId will encapsulate.

| Edit this page View Source

EntityId(long, long, EvmAddress)

Constructor creating a form of Entity TransactionId that represents an EVM Address.

Declaration
public EntityId(long shardNum, long realmNum, EvmAddress evmAddress)
Parameters
Type Name Description
long shardNum

The shard number for this Entity ID.

long realmNum

The realm number for this Entity ID.

EvmAddress evmAddress

The EVM Address this Entity TransactionId will encapsulate.

| Edit this page View Source

EntityId(long, long, long)

Public Constructor, an 
EntityId

is immutable after creation.

Declaration
public EntityId(long shardNum, long realmNum, long accountNum)
Parameters
Type Name Description
long shardNum

Network Shard Number

long realmNum

Network Realm Number

long accountNum

Network Address Number

Properties

| Edit this page View Source

AccountNum

Network Address Number for this Entity,

Declaration
public long AccountNum { get; }
Property Value
Type Description
long
| Edit this page View Source

IsEvmAddress

Indicates if this Entity TransactionId contains an EVM Payer (EIP-1014) format.

Declaration
public bool IsEvmAddress { get; }
Property Value
Type Description
bool
| Edit this page View Source

IsKeyAlias

Indicates if this Entity TransactionId contains a Key Alias format.

Declaration
public bool IsKeyAlias { get; }
Property Value
Type Description
bool
| Edit this page View Source

IsShardRealmNum

Indicates if this Entity TransactionId contains a [shard.realm.num] native address.

Declaration
public bool IsShardRealmNum { get; }
Property Value
Type Description
bool
| Edit this page View Source

None

A special designation of an Entity TransactionId that can't be created. It represents the absence of a valid Entity TransactionId. The network will interpret as "no account/file/topic/token/contract" when applied to change parameters. (typically the value null is interpreted as "make no change"). In this way, it is possible to remove a auto-renew account from a topic for example.

Declaration
public static EntityId None { get; }
Property Value
Type Description
EntityId
| Edit this page View Source

RealmNum

Network Realm Number for this Entity

Declaration
public long RealmNum { get; }
Property Value
Type Description
long
| Edit this page View Source

ShardNum

Network Shard Number for this Entity

Declaration
public long ShardNum { get; }
Property Value
Type Description
long

Methods

| Edit this page View Source

CastToEvmAddress()

Casts this Entity ID into the Evm Payer format.
If this ID already represents an underlying Evm Payer, that instance value will be returned, otherwise the equivalent long-zero format of an EVM Payer will be computed from shard.realm.num values, or an EOA 20-byte address will be computed from the Key Alias if it represents an ECDSA public key.

Declaration
public EvmAddress CastToEvmAddress()
Returns
Type Description
EvmAddress

An EVM Payer compatible for use with smart contracts.

Exceptions
Type Condition
InvalidOperationException

If this Entity TransactionId represents a Key Alias form of an Entity ID, this will throw an exception, if the underlying key is not a single ECDSA public key.

| Edit this page View Source

Equals(EntityId?)

Determines if this Entity TransactionId is equal to another Entity TransactionId.

Declaration
public bool Equals(EntityId? other)
Parameters
Type Name Description
EntityId other
The other 
EntityId

object to compare.

Returns
Type Description
bool

True if these represent the same entity TransactionId, otherwise false.

| Edit this page View Source

GetHashCode()

Equality implementation.

Declaration
public override int GetHashCode()
Returns
Type Description
int
A unique hash of the contents of this 
EntityId
object.  Only consistent within the current instance of 
the application process.
Overrides
object.GetHashCode()
| Edit this page View Source

ToString()

Outputs a string representation of the Entity TransactionId
(
shard.realm.keyAlias

), Key Alias or Evm Payer.

Declaration
public override string ToString()
Returns
Type Description
string

String representation of this account identifier in its entityId, keyAlias or evmAddress format.

Overrides
object.ToString()
| Edit this page View Source

TryGetEvmAddress(out EvmAddress)

Attempts to retrieve the Evm Payer wrapped by this Entity TransactionId instance. Will return false if this Entity TransactionId does not hold an Evm Payer.

Declaration
public bool TryGetEvmAddress(out EvmAddress evmAddress)
Parameters
Type Name Description
EvmAddress evmAddress
Variable receiving the Evm Payer instance if the 
operation is successful, otherwise 
null

.

Returns
Type Description
bool
True

if the entityId holds an Evm Address, otherwise false.

| Edit this page View Source

TryGetKeyAlias(out Endorsement)

Attempts to retrieve the Key Alias Endorsement wrapped by this Entity TransactionId instance. Will return false if this Entity TransactionId does not hold a Key Alias.

Declaration
public bool TryGetKeyAlias(out Endorsement keyAlias)
Parameters
Type Name Description
Endorsement keyAlias
Variable receiving the Key Alias instance if the
operation is successful, otherwise 
null

.

Returns
Type Description
bool
True

if the entityId holds a Key Alias, otherwise false.

| Edit this page View Source

TryParseShardRealmNum(ReadOnlySpan<char>, out EntityId?)

Attempts to parse a span of characters (string) from in the [shard.realm.num] format to convert into a Hedera Entity TransactionId.

Declaration
public static bool TryParseShardRealmNum(ReadOnlySpan<char> value, out EntityId? entityId)
Parameters
Type Name Description
ReadOnlySpan<char> value

The sequence of characters in the form ([shard.realm.num]) of an Entity ID.

EntityId entityId

The resulting Entity TransactionId if convertible, otherwise null.

Returns
Type Description
bool

True if the Entity TransactionId could be converted and contains a valid value.

| Edit this page View Source

TryParseShardRealmNum(string?, out EntityId?)

Attempts to parse a string as in the [shard.realm.num] format to convert into a Hedera Entity TransactionId.

Declaration
public static bool TryParseShardRealmNum(string? value, out EntityId? entityId)
Parameters
Type Name Description
string value

The string form ([shard.realm.num]) of an Entity ID.

EntityId entityId

The resulting Entity TransactionId if convertible, otherwise null.

Returns
Type Description
bool

True if the Entity TransactionId could be converted and contains a valid value.

Implements

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