Show / Hide Table of Contents

Struct TxId

TxId, abbreviation of transaction identifier, is a SHA-256 digest derived from a Transaction's content.

As it is a SHA-256 digest, it consists of 32 Bytes, and 64 characters in hexadecimal. (See also Size constant.)

Implements
ISerializable
IEquatable<TxId>
IComparable<TxId>
IComparable
Bencodex.IBencodable
Inherited Members
Object.Equals(Object, Object)
Object.GetType()
Object.ReferenceEquals(Object, Object)
Namespace: Libplanet.Types.Tx
Assembly: Libplanet.Types.dll
Syntax
[Serializable]
[JsonConverter(typeof(TxIdJsonConverter))]
public readonly struct TxId : ISerializable, IEquatable<TxId>, IComparable<TxId>, IComparable, IBencodable

Constructors

| Improve this Doc View Source

TxId(IValue)

Creates a TxId instance from given bencoded.

Declaration
public TxId(IValue bencoded)
Parameters
Type Name Description
Bencodex.Types.IValue bencoded

A Bencodex Bencodex.Types.Binary of 32 Bytes which represents an TxId.

Exceptions
Type Condition
ArgumentException

Thrown when given bencoded is not of type Bencodex.Types.Binary.

See Also
TxId(in ImmutableArray<Byte>)
| Improve this Doc View Source

TxId(Byte[])

Converts a mutable Byte array into a TxId.

Declaration
public TxId(byte[] txid)
Parameters
Type Name Description
Byte[] txid

A mutable Byte array that encodes a TxId. It must not be null, and its Length must be the same to Size.

Exceptions
Type Condition
ArgumentOutOfRangeException

Thrown when the given txid's Length is not the same to the required Size.

See Also
Id
| Improve this Doc View Source

TxId(in ImmutableArray<Byte>)

Converts an immutable Byte array into a TxId.

Declaration
public TxId(in ImmutableArray<byte> txid)
Parameters
Type Name Description
ImmutableArray<Byte> txid

An immutable Byte array that encodes a TxId. It must not be null, and its Length must be the same to Size.

Exceptions
Type Condition
ArgumentOutOfRangeException

Thrown when the given txid's Length is not the same to the required Size.

See Also
Id
| Improve this Doc View Source

TxId(SerializationInfo, StreamingContext)

TxId, abbreviation of transaction identifier, is a SHA-256 digest derived from a Transaction's content.

As it is a SHA-256 digest, it consists of 32 Bytes, and 64 characters in hexadecimal. (See also Size constant.)

Declaration
public TxId(SerializationInfo info, StreamingContext context)
Parameters
Type Name Description
SerializationInfo info
StreamingContext context
See Also
Id

Fields

| Improve this Doc View Source

Size

The Bytes size that each TxId takes.

As a txid is a SHA-256 digest, it is 32 Bytes.

Declaration
public const int Size = 32
Field Value
Type Description
Int32
See Also
Id

Properties

| Improve this Doc View Source

Bencoded

TxId, abbreviation of transaction identifier, is a SHA-256 digest derived from a Transaction's content.

As it is a SHA-256 digest, it consists of 32 Bytes, and 64 characters in hexadecimal. (See also Size constant.)

Declaration
public readonly IValue Bencoded { get; }
Property Value
Type Description
Bencodex.Types.IValue
See Also
Id
| Improve this Doc View Source

ByteArray

A bare immutable Byte array of this TxId.

Declaration
public readonly ImmutableArray<byte> ByteArray { get; }
Property Value
Type Description
ImmutableArray<Byte>
Remarks

It is immutable. For a mutable array, use ToByteArray() method instead.

See Also
ToByteArray()

Methods

| Improve this Doc View Source

CompareTo(TxId)

TxId, abbreviation of transaction identifier, is a SHA-256 digest derived from a Transaction's content.

As it is a SHA-256 digest, it consists of 32 Bytes, and 64 characters in hexadecimal. (See also Size constant.)

Declaration
public readonly int CompareTo(TxId other)
Parameters
Type Name Description
TxId other
Returns
Type Description
Int32
See Also
Id
| Improve this Doc View Source

CompareTo(Object)

TxId, abbreviation of transaction identifier, is a SHA-256 digest derived from a Transaction's content.

As it is a SHA-256 digest, it consists of 32 Bytes, and 64 characters in hexadecimal. (See also Size constant.)

Declaration
public readonly int CompareTo(object obj)
Parameters
Type Name Description
Object obj
Returns
Type Description
Int32
See Also
Id
| Improve this Doc View Source

Equals(TxId)

TxId, abbreviation of transaction identifier, is a SHA-256 digest derived from a Transaction's content.

As it is a SHA-256 digest, it consists of 32 Bytes, and 64 characters in hexadecimal. (See also Size constant.)

Declaration
public readonly bool Equals(TxId other)
Parameters
Type Name Description
TxId other
Returns
Type Description
Boolean
See Also
Id
| Improve this Doc View Source

Equals(Object)

TxId, abbreviation of transaction identifier, is a SHA-256 digest derived from a Transaction's content.

As it is a SHA-256 digest, it consists of 32 Bytes, and 64 characters in hexadecimal. (See also Size constant.)

Declaration
public override readonly bool Equals(object obj)
Parameters
Type Name Description
Object obj
Returns
Type Description
Boolean
Overrides
ValueType.Equals(Object)
See Also
Id
| Improve this Doc View Source

FromHex(String)

Creates a TxId value from a hex string.

Declaration
public static TxId FromHex(string hex)
Parameters
Type Name Description
String hex

A hexadecimal string which encodes a TxId. This has to contain 64 hexadecimal digits and must not be null This is usually made by ToHex() method.

Returns
Type Description
TxId

A corresponding TxId value.

Exceptions
Type Condition
ArgumentOutOfRangeException

Thrown when the given hex is shorter or longer than 64 characters.

FormatException

Thrown when the given hex string is not a valid hexadecimal string.

See Also
ToHex()
| Improve this Doc View Source

GetHashCode()

TxId, abbreviation of transaction identifier, is a SHA-256 digest derived from a Transaction's content.

As it is a SHA-256 digest, it consists of 32 Bytes, and 64 characters in hexadecimal. (See also Size constant.)

Declaration
public override readonly int GetHashCode()
Returns
Type Description
Int32
Overrides
ValueType.GetHashCode()
See Also
Id
| Improve this Doc View Source

GetObjectData(SerializationInfo, StreamingContext)

TxId, abbreviation of transaction identifier, is a SHA-256 digest derived from a Transaction's content.

As it is a SHA-256 digest, it consists of 32 Bytes, and 64 characters in hexadecimal. (See also Size constant.)

Declaration
public readonly void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
Type Name Description
SerializationInfo info
StreamingContext context
See Also
Id
| Improve this Doc View Source

ToByteArray()

Gets a bare mutable Byte array of this TxId.

Declaration
[Pure]
public readonly byte[] ToByteArray()
Returns
Type Description
Byte[]

A new mutable Byte array of this TxId. Since a returned array is created every time the method is called, any mutations on that array does not affect to the TxId object.

See Also
ByteArray
| Improve this Doc View Source

ToHex()

Gets a hexadecimal form of a TxId.

Declaration
[Pure]
public readonly string ToHex()
Returns
Type Description
String

64 hexadecimal characters.

See Also
Id
| Improve this Doc View Source

ToString()

Gets a TxId's representative string.

Declaration
[Pure]
public override readonly string ToString()
Returns
Type Description
String

A string which represents this TxId.

Overrides
ValueType.ToString()
See Also
Id

Operators

| Improve this Doc View Source

Equality(TxId, TxId)

TxId, abbreviation of transaction identifier, is a SHA-256 digest derived from a Transaction's content.

As it is a SHA-256 digest, it consists of 32 Bytes, and 64 characters in hexadecimal. (See also Size constant.)

Declaration
public static bool operator ==(TxId left, TxId right)
Parameters
Type Name Description
TxId left
TxId right
Returns
Type Description
Boolean
See Also
Id
| Improve this Doc View Source

Inequality(TxId, TxId)

TxId, abbreviation of transaction identifier, is a SHA-256 digest derived from a Transaction's content.

As it is a SHA-256 digest, it consists of 32 Bytes, and 64 characters in hexadecimal. (See also Size constant.)

Declaration
public static bool operator !=(TxId left, TxId right)
Parameters
Type Name Description
TxId left
TxId right
Returns
Type Description
Boolean
See Also
Id

Implements

System.Runtime.Serialization.ISerializable
System.IEquatable<T>
System.IComparable<T>
System.IComparable
Bencodex.IBencodable

See Also

Id
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2018–2023 Planetarium