sgns::EscrowTransaction¶
Transaction that reserves funds for a job escrow while tracking peer payout metadata.
#include <EscrowTransaction.hpp>
Inherits from sgns::GeniusTransaction
Public Functions¶
| Name | |
|---|---|
| EscrowTransaction | New(UTXOTxParameters params, uint64_t amount, std::string dev_addr, uint64_t peers_cut, SGTransaction::DAGStruct dag) Creates a new escrow-hold transaction from signed UTXO parameters. |
| std::shared_ptr< EscrowTransaction > | DeSerializeByteVector(const std::vector< uint8_t > & data) Deserializes a serialized escrow transaction. |
| ~EscrowTransaction() override =default Destroys the escrow transaction. |
|
| virtual std::vector< uint8_t > | SerializeByteVector(const SGTransaction::DAGStruct & dag) const override Serializes the transaction into a byte vector, including the DAG metadata. |
| virtual EmbeddedTransaction | SerializeToEmbeddedTransaction(const SGTransaction::DAGStruct & dag) const override Serializes the transaction into an EmbeddedTransaction proto with the appropriate oneof field set. |
| uint64_t | GetNumChunks() const Returns the number of chunks reserved for peer payouts. |
| virtual std::string | GetTransactionSpecificPath() const override Returns the transaction-specific path component for storage and retrieval. |
| UTXOTxParameters | GetUTXOParameters() const Returns the escrow transaction UTXO inputs and outputs. |
| virtual bool | HasUTXOParameters() const override Returns if transaction supports UTXOs. |
| virtual std::optional< UTXOTxParameters > | GetUTXOParametersOpt() const override Returns the UTXOs. |
| std::string | GetDevAddress() const Returns the developer payout address. |
| uint64_t | GetAmount() const Returns the total amount locked in escrow. |
| uint64_t | GetPeersCut() const Returns the configured peer-share multiplier. |
| std::vector< uint8_t > | SerializeByteVector() const Serializes the transaction using the internal DAG metadata. |
| EmbeddedTransaction | SerializeToEmbeddedTransaction() const Serializes using internal DAG metadata. |
Additional inherited members¶
Public Types inherited from sgns::GeniusTransaction
| Name | |
|---|---|
| using std::function< std::shared_ptr< GeniusTransaction >(const std::vector< uint8_t > &)> | TransactionDeserializeFn Alias for the de-serializer method type to be implemented in derived classes. |
Public Functions inherited from sgns::GeniusTransaction
| Name | |
|---|---|
| GeniusTransaction(std::string type, SGTransaction::DAGStruct dag) Constructs a GeniusTransaction with the specified type and DAG metadata. |
|
| virtual | ~GeniusTransaction() =default Virtual destructor to avoid leakage when deleting derived classes through a base pointer. |
| std::string | GetType() const Returns the transaction type. |
| virtual std::string | GetChainId() const Returns the source chain id for input validation routing. |
| std::string | GetTransactionFullPath() const Returns the full storage path for the transaction based on its hash. |
| std::string | GetProofFullPath() const Returns the full storage path for the proof based on the transaction hash. |
| std::string | GetSrcAddress() const Returns the source address for the transaction. |
| std::string | GetHash() const Returns the hash of the transaction. |
| std::string | GetPreviousHash() const Returns the hash of the previous transaction. |
| std::string | GetUncleHash() const Returns the hash of the uncle transaction. |
| uint64_t | GetTimestamp() const Returns the timestamp of the transaction. |
| uint64_t | GetNonce() const Returns the nonce of the transaction. |
| virtual std::unordered_set< std::string > | GetTopics() const Returns the destination topics associated with the transaction. |
| void | FillHash() Fills the data hash field in the DAG metadata based on the transaction content. |
| bool | CheckHash() const Checks the integrity of the transaction by verifying that the hash field matches the calculated hash. |
| std::vector< uint8_t > | MakeSignature(GeniusAccount & account) Creates a signature for the transaction using the provided GeniusAccount. |
| bool | CheckSignature() const Verifies the transaction signature using the source address and the serialized transaction content. |
| bool | CheckDAGSignatureLegacy() const Legacy method to verify the transaction signature using the DAG metadata. This method may be used for backward compatibility with older transaction formats. |
| virtual std::string | GetSlotID() const Generates a slot ID used by consensus to identify competing transactions. |
| outcome::result< SGTransaction::DAGStruct > | DeSerializeDAGStruct(const std::vector< uint8_t > & data) Deserializes the DAG metadata from a byte vector. |
| outcome::result< SGTransaction::DAGStruct > | DeSerializeDAGStruct(const std::string & data) Deserializes the DAG metadata from a string. |
| SGTransaction::DAGStruct | SetDAGWithType(SGTransaction::DAGStruct dag, const std::string & type) Sets the transaction type in the DAG metadata and returns the modified DAGStruct. |
| std::string | GetTransactionFullPath(const std::string & tx_hash) Returns the full storage path for the transaction based on its hash. |
| void | RegisterDeserializer(const std::string & transaction_type, TransactionDeserializeFn fn) Registers a deserializer function for a specific transaction type. |
| std::unordered_map< std::string, TransactionDeserializeFn > & | GetDeSerializers() Returns the map of registered deserializer functions for transaction types. |
Public Attributes inherited from sgns::GeniusTransaction
| Name | |
|---|---|
| std::string_view | GENIUS_CHAIN_ID The chain ID used for transactions that are not associated with a specific external chain. |
| SGTransaction::DAGStruct | dag_st The DAG metadata struct that is included in all transactions, containing common fields such as source address, hashes, timestamp, nonce, and signature. |
Public Functions Documentation¶
function New¶
static EscrowTransaction New(
UTXOTxParameters params,
uint64_t amount,
std::string dev_addr,
uint64_t peers_cut,
SGTransaction::DAGStruct dag
)
Creates a new escrow-hold transaction from signed UTXO parameters.
Parameters:
- params Signed UTXO inputs and escrow/change outputs for the hold.
- amount Total amount locked in escrow.
- dev_addr Developer payout address that receives the post-peer remainder.
- peers_cut Per-peer payout multiplier used when releasing escrow.
- dag DAG metadata shared by all transaction types.
Return: Escrow transaction with transaction type set and hash populated.
function DeSerializeByteVector¶
static std::shared_ptr< EscrowTransaction > DeSerializeByteVector(
const std::vector< uint8_t > & data
)
Deserializes a serialized escrow transaction.
Parameters:
- data Serialized
SGTransaction::EscrowTxbytes.
Return: Shared pointer to the parsed escrow transaction, or nullptr if parsing fails.
function ~EscrowTransaction¶
Destroys the escrow transaction.
function SerializeByteVector¶
virtual std::vector< uint8_t > SerializeByteVector(
const SGTransaction::DAGStruct & dag
) const override
Serializes the transaction into a byte vector, including the DAG metadata.
Parameters:
- dag The DAG metadata to be included in the serialization.
Return: The serialized byte vector representing the transaction.
Note: This should be defined in the derived class, but the version without parameters is to used
Reimplements: sgns::GeniusTransaction::SerializeByteVector
function SerializeToEmbeddedTransaction¶
virtual EmbeddedTransaction SerializeToEmbeddedTransaction(
const SGTransaction::DAGStruct & dag
) const override
Serializes the transaction into an EmbeddedTransaction proto with the appropriate oneof field set.
Parameters:
- dag The DAG metadata to be included in the serialization.
Return: EmbeddedTransaction proto with the typed transaction field set.
Reimplements: sgns::GeniusTransaction::SerializeToEmbeddedTransaction
function GetNumChunks¶
Returns the number of chunks reserved for peer payouts.
Return: Number of chunks associated with this escrow transaction.
function GetTransactionSpecificPath¶
Returns the transaction-specific path component for storage and retrieval.
Return: The transaction-specific path component, typically derived from the transaction type or other unique attributes.
Reimplements: sgns::GeniusTransaction::GetTransactionSpecificPath
function GetUTXOParameters¶
Returns the escrow transaction UTXO inputs and outputs.
Return: UTXO parameters carried by this escrow hold.
function HasUTXOParameters¶
Returns if transaction supports UTXOs.
Return: true if supported, false otherwise
Reimplements: sgns::GeniusTransaction::HasUTXOParameters
function GetUTXOParametersOpt¶
Returns the UTXOs.
Return: If exists, returns the UTXOs of the transaction
Reimplements: sgns::GeniusTransaction::GetUTXOParametersOpt
function GetDevAddress¶
Returns the developer payout address.
Return: Address that receives escrow remainder after peer payouts.
function GetAmount¶
Returns the total amount locked in escrow.
Return: Total amount locked by this escrow hold.
function GetPeersCut¶
Returns the configured peer-share multiplier.
Return: Peer payout multiplier applied during escrow release.
function SerializeByteVector¶
Serializes the transaction using the internal DAG metadata.
Return: The serialized byte vector representing the transaction.
function SerializeToEmbeddedTransaction¶
Serializes using internal DAG metadata.
Updated on 2026-06-05 at 17:22:18 -0700