Class TxMetadata
A concrete class implementing ITxMetadata. It's used to represent drafts of unsigned Transaction<T>s.
Implements
Namespace: Libplanet.Tx
Assembly: Libplanet.dll
Syntax
public sealed class TxMetadata : object, ITxMetadata
Constructors
| Improve this Doc View SourceTxMetadata(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. |
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 |
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 SourceGenesisHash
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> |
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.
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 |
Signer
Declaration
public Address Signer { get; }
Property Value
Type | Description |
---|---|
Address |
Remarks
This is automatically derived from PublicKey.
Timestamp
The time this transaction is created and signed.
Declaration
public DateTimeOffset Timestamp { get; set; }
Property Value
Type | Description |
---|---|
DateTimeOffset |
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 SourceToBencodex(IEnumerable<IValue>, Nullable<ImmutableArray<Byte>>)
Builds a Bencodex dictionary used for signing and calculating TxId.
Declaration
public Bencodex.Types.Dictionary ToBencodex(IEnumerable<IValue> customActions, ImmutableArray<byte>? signature = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IValue> | customActions | PlainValues of user-defined custom actions 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. |
ToBencodex(IValue, Nullable<ImmutableArray<Byte>>)
Builds a Bencodex dictionary used for signing and calculating TxId.
Declaration
public Bencodex.Types.Dictionary ToBencodex(IValue systemAction, ImmutableArray<byte>? signature = null)
Parameters
Type | Name | Description |
---|---|---|
IValue | systemAction | PlainValue of a system built-in action 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. |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |