Class EvmAddress
Represents 20-byte EVM Address for Hedera Virtual Machine.
Implements
Inherited Members
Namespace: Hiero
Assembly: Hiero.dll
Syntax
[JsonConverter(typeof(EvmAddressConverter))]
public sealed record EvmAddress : IEquatable<EvmAddress>
Constructors
| Edit this page View SourceEvmAddress(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. |
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:
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | when any of the inputs are out of range, such as the bytes not having a length of 20. |
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:
|
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 SourceBytes
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> |
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 SourceEquals(EvmAddress?)
Equality implementation
Declaration
public bool Equals(EvmAddress? other)
Parameters
| Type | Name | Description |
|---|---|---|
| EvmAddress | other |
object to compare. |
Returns
| Type | Description |
|---|---|
| bool | True if the EVM address bytes are identical. |
GetHashCode()
Equality implementation.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int |
|
Overrides
| Edit this page View SourceToString()
Outputs an EIP-55 Checksum Encoding of EvmAddress
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | String representation of this EVM Address |
Overrides
| Edit this page View SourceTryParse(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. |
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 Sourceimplicit 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 |
. |
Returns
| Type | Description |
|---|---|
| EntityId |
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 |
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 |