Show / Hide Table of Contents

Class EvmAddress

Represents 20-byte EVM Address for Hedera Virtual Machine.

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

Constructors

| Edit this page View Source

EvmAddress(Endorsement)

Constructor from ECDSASecp256K1 Endorsement, converts the public key into the appropriate 20-byte public key hash.

Declaration
public EvmAddress(Endorsement endorsement)
Parameters
Type Name Description
Endorsement endorsement

An ECDSASecp256K1 public key. The EvmAddress will automatically convert the public key into the matching 20-byte eth hash.

| Edit this page View Source

EvmAddress(ReadOnlyMemory<byte>)

Public Constructor, a 
EvmAddress

is immutable after construction.

Declaration
public EvmAddress(ReadOnlyMemory<byte> bytes)
Parameters
Type Name Description
ReadOnlyMemory<byte> bytes

The bytes representing the address, if originates from a long-zero address (shard.realm.num) form the encoding follows:

The first 4 bytes are the big-endian representation of the shard.
The next 8 bytes are the big-endian representation of the realm.
The final 8 bytes are the big-endian representation of the number.
Exceptions
Type Condition
ArgumentOutOfRangeException

when any of the inputs are out of range, such as the bytes not having a length of 20.

| Edit this page View Source

EvmAddress(ReadOnlySpan<byte>)

Public Constructor, a 
EvmAddress

is immutable after construction.

Declaration
public EvmAddress(ReadOnlySpan<byte> bytes)
Parameters
Type Name Description
ReadOnlySpan<byte> bytes

The bytes representing the address, if originates from a long-zero address (shard.realm.num) form the encoding follows:

The first 4 bytes are the big-endian representation of the shard.
The next 8 bytes are the big-endian representation of the realm.
The final 8 bytes are the big-endian representation of the number.
Exceptions
Type Condition
ArgumentOutOfRangeException

when any of the inputs are out of range, such as the bytes not having a length of 20.

Properties

| Edit this page View Source

Bytes

The 20-byte EVM Address of the contract.

Every contract has an EVM Address determined by its
shard.realm.num

id.

This Address is as follows:

    The first 4 bytes are the big-endian representation of the shard.
    The next 8 bytes are the big-endian representation of the realm.
    The final 8 bytes are the big-endian representation of the number.

In the above format, the shard and realm should match the encoded values.

Contracts created via CREATE2 have an <b>additional, primary address</b> that is 
derived from the<a href="https://eips.ethereum.org/EIPS/eip-1014"> EIP-1014</a> 
specification, and does not have a simple relation to a<tt> shard.realm.num</tt> id.
(therefore shard and realm values do not match the encoded bytes)
Declaration
public ReadOnlySpan<byte> Bytes { get; }
Property Value
Type Description
ReadOnlySpan<byte>
| Edit this page View Source

None

A special designation of an alias that can't be created. It represents the absence of a valid alias. 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.

Declaration
public static EvmAddress None { get; }
Property Value
Type Description
EvmAddress

Methods

| Edit this page View Source

Equals(EvmAddress?)

Equality implementation

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

object to compare.

Returns
Type Description
bool

True if the EVM address bytes are identical.

| 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 
EvmAddress
object.  Only consistent within the current instance of 
the application process.
Overrides
object.GetHashCode()
| Edit this page View Source

ToString()

Outputs an EIP-55 Checksum Encoding of EvmAddress

Declaration
public override string ToString()
Returns
Type Description
string

String representation of this EVM Address

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

TryParse(ReadOnlySpan<char>, out EvmAddress?)

Tries to parse a string value into an EVM Address.

Declaration
public static bool TryParse(ReadOnlySpan<char> value, out EvmAddress? evmAddress)
Parameters
Type Name Description
ReadOnlySpan<char> value

The string representation of the EVM address, may start with '0x'

EvmAddress evmAddress

Contains the EVM Address if parsing is successful

Returns
Type Description
bool

True if parsing was successful, false if not.

| Edit this page View Source

TryParse(string?, out EvmAddress?)

Tries to parse a string value into an EVM Address.

Declaration
public static bool TryParse(string? value, out EvmAddress? evmAddress)
Parameters
Type Name Description
string value

The string representation of the EVM address, may start with '0x'

EvmAddress evmAddress

Contains the EVM Address if parsing is successful

Returns
Type Description
bool

True if parsing was successful, false if not.

Operators

| Edit this page View Source

implicit operator EntityId(EvmAddress)

Implicitly wraps an EVM Address within an

EntityId

construct.

Declaration
public static implicit operator EntityId(EvmAddress evmAddress)
Parameters
Type Name Description
EvmAddress evmAddress
The EVM Address to wrap within an 
EntityId

.

Returns
Type Description
EntityId
| Edit this page View Source

implicit operator EvmAddress(ReadOnlyMemory<byte>)

Implicit operator for converting a readonly memory array into an EVM Address.

Declaration
public static implicit operator EvmAddress(ReadOnlyMemory<byte> bytes)
Parameters
Type Name Description
ReadOnlyMemory<byte> bytes

The bytes representing the EVM Address.

Returns
Type Description
EvmAddress
| Edit this page View Source

implicit operator EvmAddress(ReadOnlySpan<byte>)

Implicit operator for converting a readonly span of bytes into an EVM Address.

Declaration
public static implicit operator EvmAddress(ReadOnlySpan<byte> bytes)
Parameters
Type Name Description
ReadOnlySpan<byte> bytes

The bytes representing the EVM Address.

Returns
Type Description
EvmAddress

Implements

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