Show / Hide Table of Contents

Class Endorsement

Represents the key signing requirements for various transactions available within the network.

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

Constructors

| Edit this page View Source

Endorsement(params Endorsement[])

Create a M of M required list of endorsements. All listed endorsements must be fulfilled to fulfill this endorsement.

Declaration
public Endorsement(params Endorsement[] endorsements)
Parameters
Type Name Description
Endorsement[] endorsements

A list of endorsements that must be fulfilled, may be a mix of individual public keys or additional sub-lists of individual keys.

Exceptions
Type Condition
ArgumentNullException

if endorsements is null

| Edit this page View Source

Endorsement(EntityId)

Creates an endorsement representing a contract instance.

Declaration
public Endorsement(EntityId contract)
Parameters
Type Name Description
EntityId contract

The address of the contract instance.

| Edit this page View Source

Endorsement(KeyType, ReadOnlyMemory<byte>)

Creates an endorsement representing a single key of a valid type. Will accept Ed25519, ECDSASecp256K1 key types.

Declaration
public Endorsement(KeyType type, ReadOnlyMemory<byte> publicKey)
Parameters
Type Name Description
KeyType type

The type of key the bytes represent.

ReadOnlyMemory<byte> publicKey

The bytes for the public key.

Exceptions
Type Condition
ArgumentOutOfRangeException

If type passed into the constructor was not a valid single key type or not recognizable from supplied bytes.

| Edit this page View Source

Endorsement(ReadOnlyMemory<byte>)

Convenience constructor converting a public key represented 
in bytes into an 
Endorsement

. Ed25519 and ECDSA Secp256K1 keys. If the bytes entered are not recognizable as either of these formats, an exception is thrown.

Declaration
public Endorsement(ReadOnlyMemory<byte> publicKey)
Parameters
Type Name Description
ReadOnlyMemory<byte> publicKey

Bytes representing a public Ed25519, ECDSA Secp256K1 key or ABI or Protobuf encoded Contract ID.

Exceptions
Type Condition
ArgumentOutOfRangeException
If 
publicKey

is not recognizable as an Ed25519 ECDSA Secp256K1 public key or encoded contract id.

| Edit this page View Source

Endorsement(uint, params Endorsement[])

Create a N of M required list of endorsements. Only

requiredCount

number of listed endorsements must be fulfilled to fulfill this endorsement.

Declaration
public Endorsement(uint requiredCount, params Endorsement[] endorsements)
Parameters
Type Name Description
uint requiredCount

The number of child endorsements that must be fulfilled in order to fulfill this endorsement.

Endorsement[] endorsements

A list of candidate endorsements, may be a mix of individual public keys or additional sub-lists of individual keys.

Exceptions
Type Condition
ArgumentNullException

if endorsements is null

ArgumentOutOfRangeException

if the required amount is negative or greater than the number of endorsements

Properties

| Edit this page View Source

Contract

The endorsement address value held by this endorsement if it is
a Contract type.  If it is a list or other key type the value 
returned will be 
None

.

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

List

Returns a list of child endorsements identified by this endorsement (of list type). If the endorsement is not of a list type, the list will be empty.

Declaration
public Endorsement[] List { get; }
Property Value
Type Description
Endorsement[]
| Edit this page View Source

None

A special designation of an endorsement key that can't be created. It represents an "empty" list of keys, which the network will interpret as "clear all keys" from this setting (typically the value null is interpreted as "make no change"). In this way, it is possible to change a topic from mutable (which has an Administrator endorsement) to immutable (having no Administrator endorsement).

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

RequiredCount

When this endorsement contains a list of child endorsements, this represents the number of child endorsements that must be fulfilled in order to consider this endorsement fulfilled.

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

Type

The type of endorsement this object is. It either contains a representation of a public key or a list of child endorsements with a note of how many are required to be fulfilled for this endorsement to be fulfilled.

Declaration
public KeyType Type { get; }
Property Value
Type Description
KeyType

Methods

| Edit this page View Source

Equals(Endorsement?)

Equality implementation.

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

object to compare.

Returns
Type Description
bool
True if public key layout and requirements are equivalent to the 
other 
Endorsement

object.

| Edit this page View Source

Equals(object?)

Equality implementation.

Declaration
public override bool Equals(object? obj)
Parameters
Type Name Description
object obj
The other 
Endorsement

object to compare (if it is an

Endorsement

).

Returns
Type Description
bool
If the other object is an Endorsement, then 
True
if key requirements are identical to the other 

<pre><code class="lang-csharp">Endorsements</code></pre>

object, otherwise

<pre><code class="lang-csharp">False</code></pre>

.

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

ToBytes(KeyFormat)

The bytes of the public key held by this endorsement if it is an Ed25519 or ECDSA Secp256K1 key type. If it is a list or contract type, it can be extracted as HAPI protobuf.

Declaration
public ReadOnlyMemory<byte> ToBytes(KeyFormat keyFormat = KeyFormat.Default)
Parameters
Type Name Description
KeyFormat keyFormat
Returns
Type Description
ReadOnlyMemory<byte>
| Edit this page View Source

ToString()

Outputs a string representation of the endorsement.

Declaration
public override string ToString()
Returns
Type Description
string

The Hex encoding of the "Hedera" byte format for the endorsement.

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

Verify(ReadOnlyMemory<byte>, ReadOnlyMemory<byte>)

Determines if the given signature was generated by the private key that this Endorsement represents. Only works for key type endorsements.

Declaration
public bool Verify(ReadOnlyMemory<byte> data, ReadOnlyMemory<byte> signature)
Parameters
Type Name Description
ReadOnlyMemory<byte> data

The data bytes that were signed.

ReadOnlyMemory<byte> signature

The signature generated for the given data bytes.

Returns
Type Description
bool
True

if the signature is valid for this data and the public key held by this endorsement.

Exceptions
Type Condition
InvalidOperationException
If this is not an Ed25519 or ECDSASecp256K1, only these types of keys
can be validated.  To determine the satisfaction of a complex key 
requirement, please use the 
SigMap.Satisfies

extension method instead.

Operators

| Edit this page View Source

operator ==(Endorsement, Endorsement)

Equals implementation.

Declaration
public static bool operator ==(Endorsement left, Endorsement right)
Parameters
Type Name Description
Endorsement left
Left hand 
Endorsement

argument.

Endorsement right
Right hand 
Endorsement

argument.

Returns
Type Description
bool
True if Key requirements are identical 
within each 
Endorsement

objects.

| Edit this page View Source

implicit operator EntityId(Endorsement)

Implicit constructor converting an endorsement key alias into an

<pre><code class="lang-csharp">EntityId</code></pre>

.

Declaration
public static implicit operator EntityId(Endorsement endorsement)
Parameters
Type Name Description
Endorsement endorsement

The Key Alias value to wrap in an Entity ID

Returns
Type Description
EntityId
| Edit this page View Source

implicit operator Endorsement(ReadOnlyMemory<byte>)

Implicit constructor converting a public key represented 
in bytes into an 
Endorsement

. Ed25519 and ECDSA Secp256K1 keys are supported. If the bytes entered are not recognizable as either of these two types of keys an exception is thrown.

Declaration
public static implicit operator Endorsement(ReadOnlyMemory<byte> publicKey)
Parameters
Type Name Description
ReadOnlyMemory<byte> publicKey

Bytes representing a public Ed25519 or ECDSA Secp256K1 key.

Returns
Type Description
Endorsement
Exceptions
Type Condition
ArgumentOutOfRangeException
If 
publicKey

is not recognizable as an Ed25519 or ECDSA Secp256K1 public key.

| Edit this page View Source

operator !=(Endorsement, Endorsement)

Not equals implementation.

Declaration
public static bool operator !=(Endorsement left, Endorsement right)
Parameters
Type Name Description
Endorsement left
Left hand 
Endorsement

argument.

Endorsement right
Right hand 
Endorsement

argument.

Returns
Type Description
bool
False

if the Key requirements are identical within each

Endorsement

object.

<pre><code class="lang-csharp">True</code></pre>

if they are not identical.

Implements

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