Class Endorsement
Represents the key signing requirements for various transactions available within the network.
Implements
Inherited Members
Namespace: Hashgraph
Assembly: Hashgraph.dll
Syntax
public sealed class Endorsement : IEquatable<Endorsement>
Constructors
| Improve this Doc View SourceEndorsement(Endorsement[])
Create a M of M requied 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 fullfilled, may be a mix of individual public keys or additional sub-lists of individual keys. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | if endorsements is null |
Endorsement(KeyType, ReadOnlyMemory<Byte>)
Creates an endorsement representing a single key of a valid type. Will accept Ed25519, RSA3072, ECDSA381 and Smart Contract ID. Presently the only key implemented by the network Ed25519 and validity of this key is checked upon creation of this object.
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, for an Ed25519 key that is not recognizable from supplied bytes. |
Endorsement(ReadOnlyMemory<Byte>)
Convenience constructor creating an Ed25519 public key endorsement. This is the most common key format for the network.
Declaration
public Endorsement(ReadOnlyMemory<byte> publicKey)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlyMemory<Byte> | publicKey | Bytes representing a public Ed25519 key. |
Endorsement(UInt32, 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 |
|---|---|---|
| UInt32 | 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 greater than tne number of endorsements |
Properties
| Improve this Doc View SourceList
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[] |
None
A special designation of an endorsement key that can't be created. It represents an "empty" list of keys, which the network will intrepret as "clear all keys" from this setting (typically the value null is intepreted as "make no change"). In this way, it is possible to change a topic from mutable (which has an Administrator endorsement) to imutable (having no Administrator endorsement).
Declaration
public static Endorsement None { get; }
Property Value
| Type | Description |
|---|---|
| Endorsement |
PublicKey
The value of the public key held by this endorsement if it is of a key type. If it is a list type, the value returned will be
Empty.
Declaration
public ReadOnlyMemory<byte> PublicKey { get; }
Property Value
| Type | Description |
|---|---|
| ReadOnlyMemory<Byte> |
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 |
|---|---|
| UInt32 |
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 not of how many are requrired to be fullfilled for this endorsement to be fulfilled.
Declaration
public KeyType Type { get; }
Property Value
| Type | Description |
|---|---|
| KeyType |
Methods
| Improve this Doc View SourceEquals(Endorsement)
Equality implementation.
Declaration
public bool Equals(Endorsement other)
Parameters
| Type | Name | Description |
|---|---|---|
| Endorsement | other | The other object to compare.
|
Returns
| Type | Description |
|---|---|
| Boolean | True if public key layout and requirements are equivalent to the other object.
|
Equals(Object)
Equality implementation.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | obj | The other object to compare (if it is
an ).
|
Returns
| Type | Description |
|---|---|
| Boolean | If the other object is an Endorsement, then
if key requirements are identical to the other
object, otherwise
.
|
Overrides
| Improve this Doc View SourceGetHashCode()
Equality implementation.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| Int32 | A unique hash of the contents of this
object. Only consistent within the current instance of
the application process.
|
Overrides
Operators
| Improve this Doc View SourceEquality(Endorsement, Endorsement)
Equals implementation.
Declaration
public static bool operator ==(Endorsement left, Endorsement right)
Parameters
| Type | Name | Description |
|---|---|---|
| Endorsement | left | Left hand argument.
|
| Endorsement | right | Right hand argument.
|
Returns
| Type | Description |
|---|---|
| Boolean | True if Key requirements are identical within each objects.
|
Implicit(ReadOnlyMemory<Byte> to Endorsement)
Implicit constructor converting an Ed25519 public key represented in bytes into an
Endorsement
representing an Ed25519 key. This convenience operator
exists becuase Ed25519 keys are the most prominent in
the system at the moment.
Declaration
public static implicit operator Endorsement(ReadOnlyMemory<byte> publicKey)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlyMemory<Byte> | publicKey | Bytes representing a public Ed25519 key. |
Returns
| Type | Description |
|---|---|
| Endorsement |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | If is not recognizable as an Ed25519 public key.
|
Inequality(Endorsement, Endorsement)
Not equals implementation.
Declaration
public static bool operator !=(Endorsement left, Endorsement right)
Parameters
| Type | Name | Description |
|---|---|---|
| Endorsement | left | Left hand argument.
|
| Endorsement | right | Right hand argument.
|
Returns
| Type | Description |
|---|---|
| Boolean | if the Key requirements are identical
within each object.
if they are not identical.
|