Show / Hide Table of Contents

Class TxMetadata

A concrete class implementing ITxMetadata. It's used to represent drafts of unsigned Transaction<T>s.

Inheritance
Object
TxMetadata
Implements
ITxMetadata
Namespace: Libplanet.Tx
Assembly: Libplanet.dll
Syntax
public sealed class TxMetadata : object, ITxMetadata

Constructors

| Improve this Doc View Source

TxMetadata(Bencodex.Types.Dictionary)

Creates a TxMetadata from a Bencodex dictionary.

Declaration
public TxMetadata(Bencodex.Types.Dictionary dictionary)
Parameters
Type Name Description
Bencodex.Types.Dictionary dictionary

A Bencodex dictionary made using ToBencodex(IEnumerable<IValue>, Nullable<ImmutableArray<Byte>>) method.

| Improve this Doc View Source

TxMetadata(PublicKey)

Creates a TxMetadata instance with a publicKey. Other fields can be set using property setters.

Declaration
public TxMetadata(PublicKey publicKey)
Parameters
Type Name Description
PublicKey publicKey

Configures PublicKey and Signer.

| Improve this Doc View Source

TxMetadata(ITxMetadata)

Creates a TxMetadata instance by copying fields from the specified metadata.

Declaration
public TxMetadata(ITxMetadata metadata)
Parameters
Type Name Description
ITxMetadata metadata

The transaction metadata whose data to copy.

Remarks

Signer from the specified metadata is ignored. Signer field is automatically derived from PublicKey instead.

Properties

| Improve this Doc View Source

GenesisHash

A HashDigest<T> value of the genesis which this transaction is made from. This can be null iff the transaction is contained in the genesis block.

Declaration
public BlockHash? GenesisHash { get; set; }
Property Value
Type Description
Nullable<BlockHash>
| Improve this Doc View Source

Nonce

The number of previous Transaction<T>s committed by the Signer of this transaction. This nonce is used for preventing replay attack.

Declaration
public long Nonce { get; set; }
Property Value
Type Description
Int64
Remarks

Don't confuse this with Nonce for proof-of-work.

| Improve this Doc View Source

PublicKey

A PublicKey of the account who signs this transaction. The Signer address is always corresponding to this for each transaction. This cannot be null.

Declaration
public PublicKey PublicKey { get; }
Property Value
Type Description
PublicKey
| Improve this Doc View Source

Signer

A PublicKey of the account who signs this transaction. This is derived from the PublicKey.

Declaration
public Address Signer { get; }
Property Value
Type Description
Address
Remarks

This is automatically derived from PublicKey.

| Improve this Doc View Source

Timestamp

The time this transaction is created and signed.

Declaration
public DateTimeOffset Timestamp { get; set; }
Property Value
Type Description
DateTimeOffset
| Improve this Doc View Source

UpdatedAddresses

An approximated list of addresses whose states would be affected by actions in this transaction. However, it could be wrong.

Declaration
public IImmutableSet<Address> UpdatedAddresses { get; set; }
Property Value
Type Description
IImmutableSet<Address>

Methods

| Improve this Doc View Source

ToBencodex(IEnumerable<IValue>, Nullable<ImmutableArray<Byte>>)

Builds a Bencodex dictionary used for signing and calculating TxId.

Declaration
public Bencodex.Types.Dictionary ToBencodex(IEnumerable<IValue> actions, ImmutableArray<byte>? signature = null)
Parameters
Type Name Description
IEnumerable<IValue> actions

A list of PlainValues to include.

Nullable<ImmutableArray<Byte>> signature

Optionally specifies the transaction signature. It should be null (which is the default) when you make a signature, and should be present when you make a TxId.

Returns
Type Description
Bencodex.Types.Dictionary

A Bencodex dictionary that the transaction turns into.

| Improve this Doc View Source

ToString()

Declaration
public override string ToString()
Returns
Type Description
String

Implements

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