Show / Hide Table of Contents

Class EvmHash

Represents a 32-byte EVM hash, such as a keccak256 transaction hash or block hash returned by the Mirror Node REST API.

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

This is a value-type wrapper that distinguishes an EVM-style 32-byte hash from arbitrary ReadOnlyMemory<byte> payloads at the type level. Use it for transaction hashes, block hashes, and log topic values where the wire representation is a 32-byte keccak output. Hedera-native hashes (e.g., SHA-384 record-file hashes) are not 32 bytes and should not be represented with this type.

Constructors

| Edit this page View Source

EvmHash(ReadOnlyMemory<byte>)

Public Constructor, an EvmHash is immutable after construction.

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

The 32 bytes of the hash.

Exceptions
Type Condition
ArgumentOutOfRangeException

When the length of bytes is not 32.

| Edit this page View Source

EvmHash(ReadOnlySpan<byte>)

Public Constructor, an EvmHash is immutable after construction.

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

The 32 bytes of the hash.

Exceptions
Type Condition
ArgumentOutOfRangeException

When the length of bytes is not 32.

Properties

| Edit this page View Source

Bytes

The 32 bytes of the hash.

Declaration
public ReadOnlySpan<byte> Bytes { get; }
Property Value
Type Description
ReadOnlySpan<byte>
| Edit this page View Source

None

The zero hash (32 bytes of 0x00). Used as a sentinel for "no hash"; distinguishable from a valid hash because a real keccak256 output of all zeros is cryptographically improbable.

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

Methods

| Edit this page View Source

Equals(EvmHash?)

Equality implementation.

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

The other EvmHash object to compare.

Returns
Type Description
bool

True if the hash 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 EvmHash object. Only consistent within the current instance of the application process.

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

ToString()

Outputs the hash as a 0x-prefixed 64-character lowercase hex string.

Declaration
public override string ToString()
Returns
Type Description
string
Overrides
object.ToString()
| Edit this page View Source

TryParse(ReadOnlySpan<char>, out EvmHash?)

Tries to parse a string value into an EvmHash.

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

The string representation of the hash. May optionally start with 0x; must otherwise be exactly 64 hexadecimal characters.

EvmHash hash

Contains the EvmHash if parsing is successful.

Returns
Type Description
bool

True if parsing was successful, false if not.

| Edit this page View Source

TryParse(string?, out EvmHash?)

Tries to parse a string value into an EvmHash.

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

The string representation of the hash. May optionally start with 0x; must otherwise be exactly 64 hexadecimal characters.

EvmHash hash

Contains the EvmHash if parsing is successful.

Returns
Type Description
bool

True if parsing was successful, false if not.

Operators

| Edit this page View Source

implicit operator EvmHash(ReadOnlyMemory<byte>)

Implicit operator for converting a read-only memory of bytes into an EvmHash.

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

The 32 bytes of the hash.

Returns
Type Description
EvmHash
| Edit this page View Source

implicit operator EvmHash(ReadOnlySpan<byte>)

Implicit operator for converting a read-only span of bytes into an EvmHash.

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

The 32 bytes of the hash.

Returns
Type Description
EvmHash

Implements

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