Skip to content

sgns::RevokeTransaction

Transaction for main-initiated revocation of a registered child wallet. More...

#include <RevokeTransaction.hpp>

Inherits from sgns::GeniusTransaction

Public Functions

Name
RevokeTransaction New(std::string child_address, uint64_t registration_sequence, SGTransaction::DAGStruct dag)
Factory — constructs a RevokeTransaction and fills its hash.
std::shared_ptr< RevokeTransaction > DeSerializeByteVector(const std::vector< uint8_t > & data)
Deserializes a RevokeTransaction from bytes.
~RevokeTransaction() override =default
Default destructor.
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.
const std::string & GetChildAddress() const
Returns the target child wallet address.
uint64_t GetRegistrationSequence() const
Returns the registration sequence being revoked.
virtual std::string GetTransactionSpecificPath() const override
Returns the transaction-specific path for storage, derived from GetType().
virtual std::unordered_set< std::string > GetTopics() const override
Returns the set of pubsub topics associated with this transaction.
virtual std::vector< uint8_t > SerializeByteVector(const SGTransaction::DAGStruct & dag) const
Serializes the transaction into a byte vector, including the DAG metadata.
std::vector< uint8_t > SerializeByteVector() const
Serializes the transaction using the internal DAG metadata.
virtual EmbeddedTransaction SerializeToEmbeddedTransaction(const SGTransaction::DAGStruct & dag) const
Serializes the transaction into an EmbeddedTransaction proto with the appropriate oneof field set.
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 bool HasUTXOParameters() const
Returns if transaction supports UTXOs.
virtual std::optional< UTXOTxParameters > GetUTXOParametersOpt() const
Returns the UTXOs.
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.
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 CheckSignatureAgainst(const std::string & address) const
Verifies the transaction signature against an arbitrary caller-supplied address, rather than the transaction's own declared source address. CheckSignature delegates to this with dag_st.source_addr().
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
constexpr 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.

Detailed Description

class sgns::RevokeTransaction;

Transaction for main-initiated revocation of a registered child wallet.

Main-signed — the main wallet is the transaction's own source/signer, targeting a child's reg/ record via child_address_. Validated by an extended CheckParentChildAuthority gate (main signature + reg/{child}.main_address == signer

  • Registered state), per D-36.

Public Functions Documentation

function New

static RevokeTransaction New(
    std::string child_address,
    uint64_t registration_sequence,
    SGTransaction::DAGStruct dag
)

Factory — constructs a RevokeTransaction and fills its hash.

Parameters:

  • child_address Target child wallet address being revoked.
  • registration_sequence Sequence of the reg/ record being revoked.
  • dag DAG struct describing the transaction graph.

Return: A constructed RevokeTransaction with computed data_hash.

function DeSerializeByteVector

static std::shared_ptr< RevokeTransaction > DeSerializeByteVector(
    const std::vector< uint8_t > & data
)

Deserializes a RevokeTransaction from bytes.

Parameters:

  • data Serialized bytes.

Return: Shared pointer to the deserialized transaction, or nullptr on parse failure.

function ~RevokeTransaction

~RevokeTransaction() override =default

Default destructor.

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 GetChildAddress

inline const std::string & GetChildAddress() const

Returns the target child wallet address.

Return: The child_address_ string.

function GetRegistrationSequence

inline uint64_t GetRegistrationSequence() const

Returns the registration sequence being revoked.

Return: The registration_sequence_ value.

function GetTransactionSpecificPath

inline virtual std::string GetTransactionSpecificPath() const override

Returns the transaction-specific path for storage, derived from GetType().

Return: The transaction type string ("revoke").

Reimplements: sgns::GeniusTransaction::GetTransactionSpecificPath

function GetTopics

virtual std::unordered_set< std::string > GetTopics() const override

Returns the set of pubsub topics associated with this transaction.

Return: A set containing the child_address_ so the revoke is discoverable/routable to the target child, mirroring RegistrationTransaction::GetTopics().

Reimplements: sgns::GeniusTransaction::GetTopics

function SerializeByteVector

virtual std::vector< uint8_t > SerializeByteVector(
    const SGTransaction::DAGStruct & dag
) const

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 SerializeByteVector

inline std::vector< uint8_t > SerializeByteVector() const

Serializes the transaction using the internal DAG metadata.

Return: The serialized byte vector representing the transaction.

function SerializeToEmbeddedTransaction

virtual EmbeddedTransaction SerializeToEmbeddedTransaction(
    const SGTransaction::DAGStruct & dag
) const

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 SerializeToEmbeddedTransaction

inline EmbeddedTransaction SerializeToEmbeddedTransaction() const

Serializes using internal DAG metadata.


Updated on 2026-09-17 at 06:29:13 +0000