Class Transaction
Consists of
Inheritance
Namespace: Libplanet.Types.Tx
Assembly: Libplanet.Types.dll
Syntax
public sealed class Transaction : IEquatable<Transaction>, ITransaction, IUnsignedTx, ITxInvoice, ITxSigningMetadata
Constructors
| Improve this Doc View SourceTransaction(IUnsignedTx, ImmutableArray<Byte>)
Creates a new Transaction instance by verifying a
signature
of an unsignedTx
.
Declaration
public Transaction(IUnsignedTx unsignedTx, ImmutableArray<byte> signature)
Parameters
Type | Name | Description |
---|---|---|
IUnsigned |
unsignedTx | The IUnsigned |
Immutable |
signature | The signature to combine with |
Exceptions
Type | Condition |
---|---|
Invalid |
Thrown when the given
|
See Also
| Improve this Doc View SourceTransaction(IUnsignedTx, PrivateKey)
Creates a new Transaction instance by signing an
unsignedTx
with a privateKey
.
Declaration
public Transaction(IUnsignedTx unsignedTx, PrivateKey privateKey)
Parameters
Type | Name | Description |
---|---|---|
IUnsigned |
unsignedTx | The IUnsigned |
Private |
privateKey | The private key to sign |
See Also
Properties
| Improve this Doc View SourceActions
A list of
Declaration
public TxActionList Actions { get; }
Property Value
Type | Description |
---|---|
Tx |
See Also
| Improve this Doc View SourceGasLimit
The limit on the total amount of gas that the Transaction can use.
If null, gas processing is entirely bypassed.
The parity of null-ness is always the same as
that of Max
If not null, this value cannot be negative.
Declaration
public long? GasLimit { get; }
Property Value
Type | Description |
---|---|
System. |
See Also
| Improve this Doc View SourceGenesisHash
A Block
Declaration
public BlockHash? GenesisHash { get; }
Property Value
Type | Description |
---|---|
System. |
See Also
| Improve this Doc View SourceId
A unique identifier derived from this Transaction's content.
For more characteristics, see Tx
Declaration
public TxId Id { get; }
Property Value
Type | Description |
---|---|
Tx |
See Also
| Improve this Doc View SourceMaxGasPrice
The maximum amount of Fungible
If null, gas processing is entirely bypassed.
The parity of null-ness is always the same as
that of Gas
If not null, this value cannot be negative.
Declaration
public FungibleAssetValue? MaxGasPrice { get; }
Property Value
Type | Description |
---|---|
System. |
See Also
| Improve this Doc View SourceNonce
The number of previous Transactions committed by the Signer of this transaction. This nonce is used for preventing replay attack.
Declaration
public long Nonce { get; }
Property Value
Type | Description |
---|---|
System. |
See Also
| Improve this Doc View SourcePublicKey
A Public
Declaration
public PublicKey PublicKey { get; }
Property Value
Type | Description |
---|---|
Public |
See Also
| Improve this Doc View SourceSignature
A digital signature of the content of this
Transaction. This is signed by the account
who corresponds to Public
Declaration
public byte[] Signature { get; }
Property Value
Type | Description |
---|---|
System. |
A new |
Remarks
Although this cannot be null, it can be an empty array if the transaction is not signed yet.
See Also
| Improve this Doc View SourceSigner
Declaration
public Address Signer { get; }
Property Value
Type | Description |
---|---|
Address |
See Also
| Improve this Doc View SourceTimestamp
The time this transaction is created and signed.
Declaration
public DateTimeOffset Timestamp { get; }
Property Value
Type | Description |
---|---|
Date |
See Also
| Improve this Doc View SourceUpdatedAddresses
A deprecated property which was used as an approximated list of addresses whose states would be affected by actions in this transaction.
This is no longer officially supported in the sense that a Transaction cannot be created with a non-empty set of Addresses through normal means (i.e. using intended APIs).
It is still possible to create a Transaction through other means, such as creating a payload directly by assigning appropriate values and signing an "unsigned transaction". This is not recommended.
Declaration
public IImmutableSet<Address> UpdatedAddresses { get; }
Property Value
Type | Description |
---|---|
IImmutable |
See Also
Methods
| Improve this Doc View SourceCreate(Int64, PrivateKey, Nullable<BlockHash>, IEnumerable<IValue>, Nullable<FungibleAssetValue>, Nullable<Int64>, Nullable<DateTimeOffset>)
A façade factory to create a new Transaction. It automatically fills the following values from:
Property | Parameter the filled value derived from |
---|---|
Signer | privateKey |
Public | privateKey |
Updated | actions and
updatedAddresses |
Note that the privateKey
in itself is not
included in the created Transaction.
Declaration
public static Transaction Create(long nonce, PrivateKey privateKey, BlockHash? genesisHash, IEnumerable<IValue> actions, FungibleAssetValue? maxGasPrice = null, long? gasLimit = null, DateTimeOffset? timestamp = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
nonce | The number of previous Transactions committed by the Signer of this transaction. This goes to the Nonce property. |
Private |
privateKey | A Private |
System. |
genesisHash | A |
IEnumerable<IValue> | actions | A list of user-defined custom actions to include. This can be empty, but cannot be null. This goes to the Actions property. |
System. |
maxGasPrice | The maximum gas price this transaction can pay fee. |
System. |
gasLimit | The maximum amount of gas this transaction can consume. |
System. |
timestamp | The time this Transaction is created and signed. This goes to the Timestamp property. If null (which is default) is passed this will be the current time. |
Returns
Type | Description |
---|---|
Transaction | A created new Transaction signed by
the given |
See Also
| Improve this Doc View SourceDeserialize(Byte[])
Decodes a Transaction's Bencodex representation.
Declaration
public static Transaction Deserialize(byte[] bytes)
Parameters
Type | Name | Description |
---|---|---|
System. |
bytes | A Bencodex representation of a Transaction. |
Returns
Type | Description |
---|---|
Transaction | A decoded Transaction object. |
Exceptions
Type | Condition |
---|---|
Invalid |
Thrown when its
Signature is invalid or not signed by
the account who corresponds to Public |
See Also
| Improve this Doc View SourceEquals(Transaction)
Consists of
Declaration
public bool Equals(Transaction other)
Parameters
Type | Name | Description |
---|---|---|
Transaction | other |
Returns
Type | Description |
---|---|
System. |
See Also
| Improve this Doc View SourceEquals(Nullable<Object>)
Consists of
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
System. |
obj |
Returns
Type | Description |
---|---|
System. |
See Also
| Improve this Doc View SourceGetHashCode()
Consists of
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System. |
See Also
| Improve this Doc View SourceSerialize()
Encodes this Transaction into a
Declaration
public byte[] Serialize()
Returns
Type | Description |
---|---|
System. |
A Bencodex representation of this Transaction. |