sgns::GeniusNode¶
High-level facade that initializes and coordinates account, networking, transaction, blockchain, and processing subsystems.
#include <GeniusNode.hpp>
Inherits from IComponent, sgns::IBridgeInitObserver, std::enable_shared_from_this< GeniusNode >
Public Types¶
| Name | |
|---|---|
| enum class uint8_t | NodeState { CREATING = 0, MIGRATING_DATABASE, INITIALIZING_DATABASE, INITIALIZING_BLOCKCHAIN, INITIALIZING_TRANSACTIONS, INITIALIZING_PROCESSING, READY} Lifecycle states reported while the node is bootstrapping. |
| enum class uint8_t | Error { INSUFFICIENT_FUNDS = 1, DATABASE_WRITE_ERROR = 2, INVALID_TRANSACTION_HASH = 3, INVALID_CHAIN_ID = 4, INVALID_TOKEN_ID = 5, TOKEN_ID_MISMATCH = 6, PROCESS_COST_ERROR = 7, PROCESS_INFO_MISSING = 8, INVALID_JSON = 9, INVALID_BLOCK_PARAMETERS = 10, NO_PROCESSOR = 11, NO_PRICE = 12, TRANSACTIONS_NOT_READY = 13, TRANSACTION_NOT_FINALIZED = 14, TRANSACTION_FAILED = 15, INVALID_NODE_TYPE = 16} Error codes returned by GeniusNode operations. |
| enum class uint8_t | NodeType { Full = 0, Light = 1, Archive = 2} Deployment node role, read from sgns_config.json ("node_type"). |
Public Functions¶
| Name | |
|---|---|
| std::shared_ptr< GeniusNode > | New(const GeniusNodeConfig & dev_config, AccountSource source) Canonical node factory (INTF-01). Account identity is chosen via AccountSource; node role (is_full_node_) is derived from node_type in sgns_config.json, not a param. Old factories are retained this phase (deleted in Phase 3 per 02-CONTEXT.md D-01). |
| outcome::result< void > | WriteNetworkConfig(const std::string & base_path, uint16_t port_seed, bool auto_dht) Writes a minimal network_config.json for test/example setup (MIG-02). |
| outcome::result< void > | WriteSgnsConfig(const std::string & base_path, const std::string & node_type, bool is_processor, bool rpc_catchup =true) Writes a minimal sgns_config.json for test/example setup; validates node_type (MIG-02). |
| constexpr uint64_t | GetBurnBasisPoints() Basis points of an escrow payout burned to the zero address during release. |
| constexpr uint64_t | GetBasisPointsTotal() Total basis points denominator used with GetBurnBasisPoints. |
| ~GeniusNode() override Stops node services, joins background threads, and releases processing callbacks. |
|
| std::vector< std::string > | GetAvailableAccounts() Lists the account addresses currently available in local storage. |
| uint16_t | GetPubsubPort() const Returns the resolved PubSub listening port. |
| bool | IsAutodhtEnabled() const Returns whether DHT discovery is enabled after config resolution. |
| bool | IsFullNode() const Returns whether this node runs in full-node mode after config resolution. |
| NodeType | GetNodeType() const Returns the resolved node role. |
| outcome::result< void > | AddAccountWithKey(const char * private_key) const Adds an account to local storage using an Ethereum private key. |
| outcome::result< void > | AddAccountWithMnemonic(const std::string & mnemonic) const Adds an account to local storage using a BIP39 mnemonic phrase. |
| outcome::result< std::string > | AddAccountWithRandomMnemonic() const Adds an account to local storage using a newly generated random BIP39 mnemonic. |
| outcome::result< void > | SelectAccount(std::string_view public_address) Selects the active account for subsequent node operations. |
| outcome::result< void > | TransferAccount(std::string_view public_address) Transfers node ownership to another stored account address. |
| outcome::result< void > | DeleteAccount(std::string_view public_address) Deletes a locally stored account. |
| outcome::result< void > | MergeAccount(std::string_view public_address) Merges the active account into another stored account. |
| outcome::result< void > | SetPayoutAddress(std::string_view payout_address) Updates the payout address used by processing rewards. |
| outcome::result< std::string > | ProcessImage(const std::string & jsondata) Submits an image-processing request described by JSON input. |
| std::vector< std::string > | GetMyTaskIds(size_t limit =50, size_t offset =0) const Returns the task IDs of jobs submitted by the active account. |
| outcome::result< SGProcessing::TaskResult > | GetTaskResult(const std::string & taskId) Retrieves the completed result for a specific job by its task ID. |
| uint64_t | GetProcessCost(std::shared_ptr< sgns::sgprocessing::ProcessingManager > & procmgr) Estimates the GNUS cost of a processing request manager. |
| outcome::result< double > | GetGNUSPrice() Retrieves the current GNUS market price from the configured pricing service. |
| virtual std::string | GetName() override Returns the component name used by the component framework. |
| std::string | GetVersion() Returns the full SuperGenius version string. |
| void | LoadLogConfig() |
| outcome::result< std::string > | MintTokens(uint64_t amount, const std::string & transaction_hash, const std::string & chainid, TokenID tokenid, std::string destination ="") Creates and submits a mint transaction. |
| outcome::result< std::pair< std::string, uint64_t > > | MintTokens(uint64_t amount, const std::string & transaction_hash, const std::string & chainid, TokenID tokenid, std::string destination, std::chrono::milliseconds timeout) Creates a mint transaction and waits for it to finalize. |
| void | AddPeer(const std::string & peer) Adds a peer to PubSub and starts connecting to it. |
| void | AddPeers(const std::vector< std::string > & peers) Adds peers to PubSub and starts connecting to them. |
| void | RefreshUPNP(uint16_t pubsubport) Starts or restarts the background UPnP port refresh thread. |
| uint64_t | GetBalance() Returns the active account balance across all tokens. |
| uint64_t | GetBalance(TokenID token_id) Returns the active account balance for a token. |
| uint64_t | GetBalance(const std::string & address) Returns an address balance across all tokens. |
| uint64_t | GetBalance(TokenID token_id, const std::string & address) Returns an address balance for a token. |
| std::vector< std::vector< uint8_t > > | GetInTransactions() const Returns serialized incoming transactions known to the transaction manager. |
| std::vector< std::vector< uint8_t > > | GetOutTransactions() const Returns serialized outgoing transactions known to the transaction manager. |
| size_t | CountTransactions(std::optional< TransactionManager::TransactionStatus > tx_status =std::nullopt) const Counts known transactions filtered by optional status. |
| std::string | GetAddress() const Returns the active account public address. |
| std::optional< std::string > | GetMnemonicOfActiveAccount() const Retrieves the BIP39 mnemonic of the active account from secure storage. |
| TokenID | GetTokenID() const Returns the configured child token identifier. |
| std::pair< float, std::string > | GetInitializationStatus() const Returns the current node initialization progress as a percentage and description. The percentage ranges from 0.0 (CREATING) to 1.0 (READY), with sub-progress reported during database migration and transaction manager initialization. |
| processing::ProcessingServiceImpl::ProcessingStatus | GetProcessingStatus() const Returns the current processing service status. |
| outcome::result< std::pair< std::string, uint64_t > > | TransferFunds(uint64_t amount, const std::string & destination, TokenID token_id, std::chrono::milliseconds timeout) Transfers funds and waits for the transaction to finalize. |
| outcome::result< std::string > | TransferFunds(uint64_t amount, const std::string & destination, TokenID token_id) Transfers funds without waiting for finalization. |
| outcome::result< std::string > | PayDev(uint64_t amount, TokenID token_id) Transfers funds to the configured developer address. |
| outcome::result< std::pair< std::string, uint64_t > > | PayDev(uint64_t amount, TokenID token_id, std::chrono::milliseconds timeout) Transfers funds to the configured developer address and waits for finalization. |
| outcome::result< std::pair< TransactionManager::TransactionStatus, uint64_t > > | WaitForFinalized(const std::string & tx_id, std::chrono::milliseconds timeout) Waits until an outgoing transaction reaches a terminal state. |
| std::optional< TransactionManager::TransactionStatus > | IsFinalized(const std::string & tx_id) Checks whether an outgoing transaction has reached a terminal state. |
| std::shared_ptr< ipfs_pubsub::GossipPubSub > | GetPubSub() Returns the underlying PubSub service. |
| void | ResetProcessingMembers() Releases processing service, core, queue, and result-storage references. |
| outcome::result< std::string > | FormatTokens(uint64_t amount, TokenID tokenId) Formats a fixed-point amount into a human-readable string. |
| outcome::result< uint64_t > | ParseTokens(const std::string & str, TokenID tokenId) Parses a human-readable string into a fixed-point amount. |
| void | PrintDataStore() const Prints the transaction GlobalDB datastore for debugging. |
| void | StopProcessing() Stops the processing service if it is initialized. |
| void | StartProcessing() Starts the processing service on the configured processing grid channel. |
| outcome::result< std::map< std::string, double > > | GetCoinprice(const std::vector< std::string > & tokenIds) Retrieves current USD prices for token identifiers, using a short local cache. |
| outcome::result< std::map< std::string, std::map< int64_t, double > > > | GetCoinPriceByDate(const std::vector< std::string > & tokenIds, const std::vector< int64_t > & timestamps) Retrieves historical USD prices for token identifiers at exact timestamps. |
| outcome::result< std::map< std::string, std::map< int64_t, double > > > | GetCoinPricesByDateRange(const std::vector< std::string > & tokenIds, int64_t from, int64_t to) Retrieves historical USD prices for token identifiers over a date range. |
| TransactionManager::TransactionStatus | WaitForTransactionIncoming(const std::string & txId, std::chrono::milliseconds timeout) Waits for an incoming transaction to be processed. |
| TransactionManager::TransactionStatus | WaitForTransactionOutgoing(const std::string & txId, std::chrono::milliseconds timeout) Waits for an outgoing transaction to be processed. |
| TransactionManager::TransactionStatus | WaitForEscrowRelease(const std::string & originalEscrowId, std::chrono::milliseconds timeout) Waits until an escrow hold output is consumed. |
| TransactionManager::State | GetTransactionManagerState() const Returns the current transaction manager lifecycle state. |
| outcome::result< std::shared_ptr< TransactionManager > > | GetTransactionManager() const Returns the transaction manager when initialized. |
| bool | ConfigureRpcEndpoint(const std::string & chain_id, std::vector< WeightedRpcEndpoint > endpoints) Configures RPC endpoints for a specific EVM chain on the public-chain input validator. |
| void | SetChainlistFetcher(std::function< std::optional< std::string >()> fetcher) Injects a custom chainlist fetcher for RPC endpoint discovery (test injection point). |
| TransactionManager::TransactionStatus | GetTransactionStatus(const std::string & txId) const Returns a tracked transaction status by transaction hash. |
| void | SetAuthorizedFullNodeAddress(const std::string & pub_address) Sets the authorized full-node address for blockchain genesis verification. |
| std::string | GetAuthorizedFullNodeAddress() const Gets the current authorized full-node public address. |
| NodeState | GetState() const Returns the current GeniusNode lifecycle state. |
Protected Functions¶
| Name | |
|---|---|
| void | SendTransactionAndProof(std::shared_ptr< GeniusTransaction > tx, std::vector< uint8_t > proof) Enqueues a transaction and its proof directly through the transaction manager. |
Public Attributes¶
| Name | |
|---|---|
| constexpr std::chrono::milliseconds | TIMEOUT_ESCROW_PAY Escrow payout timeout. |
| constexpr std::chrono::milliseconds | TIMEOUT_TRANSFER Transfer timeout. |
| constexpr std::chrono::milliseconds | TIMEOUT_MINT Mint timeout. |
Protected Attributes¶
| Name | |
|---|---|
| std::string | write_base_path_ Base path for node databases, logs, and account storage. |
| std::shared_ptr< GeniusAccount > | account_ Active account used by node services. |
Friends¶
| Name | |
|---|---|
| class | TransactionSyncTest |
| class | MultiAccountTestAccess |
| class | GeniusNodeTestAccess |
Additional inherited members¶
Public Functions inherited from IComponent
| Name | |
|---|---|
| virtual | ~IComponent() =default |
Public Functions inherited from sgns::IBridgeInitObserver
| Name | |
|---|---|
| virtual | ~IBridgeInitObserver() =default |
Public Types Documentation¶
enum NodeState¶
| Enumerator | Value | Description |
|---|---|---|
| CREATING | 0 | Object construction is in progress. |
| MIGRATING_DATABASE | Versioned database migrations are running. | |
| INITIALIZING_DATABASE | Primary CRDT database is being initialized. | |
| INITIALIZING_BLOCKCHAIN | Blockchain service is being initialized. | |
| INITIALIZING_TRANSACTIONS | Transaction manager is being initialized. | |
| INITIALIZING_PROCESSING | Processing modules are being initialized. | |
| READY | Node is ready for external operations. |
Lifecycle states reported while the node is bootstrapping.
enum Error¶
| Enumerator | Value | Description |
|---|---|---|
| INSUFFICIENT_FUNDS | 1 | Insufficient funds for a transaction. |
| DATABASE_WRITE_ERROR | 2 | Error writing data into the database. |
| INVALID_TRANSACTION_HASH | 3 | Input transaction hash is invalid. |
| INVALID_CHAIN_ID | 4 | Chain ID is invalid. |
| INVALID_TOKEN_ID | 5 | Token ID is invalid. |
| TOKEN_ID_MISMATCH | 6 | Provided token ID does not match the configured token. |
| PROCESS_COST_ERROR | 7 | Processing cost could not be calculated. |
| PROCESS_INFO_MISSING | 8 | Processing information is missing from the JSON request. |
| INVALID_JSON | 9 | JSON cannot be parsed. |
| INVALID_BLOCK_PARAMETERS | 10 | JSON block parameters are incorrect or missing. |
| NO_PROCESSOR | 11 | No processor is available for this request type. |
| NO_PRICE | 12 | GNUS price could not be retrieved. |
| TRANSACTIONS_NOT_READY | 13 | Transaction manager is not ready. |
| TRANSACTION_NOT_FINALIZED | 14 | Requested transaction did not finalize within the timeout. |
| TRANSACTION_FAILED | 15 | Requested transaction failed. |
| INVALID_NODE_TYPE | 16 | sgns_config.json node_type string was not Full/Light/Archive. |
Error codes returned by GeniusNode operations.
enum NodeType¶
| Enumerator | Value | Description |
|---|---|---|
| Full | 0 | Full node (is_full_node_ = true). |
| Light | 1 | Light node (is_full_node_ = false). Default on missing/unknown key. |
| Archive | 2 | Archive node (is_full_node_ = true; behavior identical to Full this milestone). |
Deployment node role, read from sgns_config.json ("node_type").
Drives the derived is_full_node_ flag (Full/Archive -> true, Light -> false). Co-located with NodeState/Error per CFG-02.
Public Functions Documentation¶
function New¶
static std::shared_ptr< GeniusNode > New(
const GeniusNodeConfig & dev_config,
AccountSource source
)
Canonical node factory (INTF-01). Account identity is chosen via AccountSource; node role (is_full_node_) is derived from node_type in sgns_config.json, not a param. Old factories are retained this phase (deleted in Phase 3 per 02-CONTEXT.md D-01).
Parameters:
- dev_config Runtime configuration (paths, token, payout data).
- source Account-creation source (NewAccount / FromPrivateKey / FromMnemonic / FromPublicKey).
Return: Shared node instance after asynchronous DB init is scheduled, or nullptr on account-restore or initialization failure (D-04).
function WriteNetworkConfig¶
static outcome::result< void > WriteNetworkConfig(
const std::string & base_path,
uint16_t port_seed,
bool auto_dht
)
Writes a minimal network_config.json for test/example setup (MIG-02).
Parameters:
- base_path Directory whose network_config.json will be (over)written (dev_config.BaseWritePath).
- port_seed Numeric port seed (Phase-1 key "port_seed").
- auto_dht Whether DHT discovery is enabled (key "auto_dht").
Return: Failure on file I/O error; success otherwise. Truncates/rewrites the file and disables UPnP so tests and examples do not depend on the host LAN.
function WriteSgnsConfig¶
static outcome::result< void > WriteSgnsConfig(
const std::string & base_path,
const std::string & node_type,
bool is_processor,
bool rpc_catchup =true
)
Writes a minimal sgns_config.json for test/example setup; validates node_type (MIG-02).
Parameters:
- base_path Directory whose sgns_config.json will be (over)written.
- node_type Role string — validated case-insensitively (Full/Light/Archive); any other value returns Error::INVALID_NODE_TYPE.
- is_processor Whether processing services run (key "is_processor").
- rpc_catchup Whether the bridge catchup scan watcher starts at bridge init (key "rpc_catchup"). Defaults true; pass false for tests that do not exercise bridge/RPC/catchup paths.
Return: Error::INVALID_NODE_TYPE on an unrecognized node_type; failure on I/O error; success otherwise.
function GetBurnBasisPoints¶
Basis points of an escrow payout burned to the zero address during release.
Return: Burn fraction in basis points (1/10000ths), e.g. 100 == 1%.
function GetBasisPointsTotal¶
Total basis points denominator used with GetBurnBasisPoints.
Return: Basis points total (10000).
function ~GeniusNode¶
Stops node services, joins background threads, and releases processing callbacks.
function GetAvailableAccounts¶
Lists the account addresses currently available in local storage.
Return: Public addresses stored under the configured base write path.
function GetPubsubPort¶
Returns the resolved PubSub listening port.
Return: The TCP port selected during InitNetwork (from pubsub_port override or derived from port_seed). Test/read-only observable; does not mutate state.
function IsAutodhtEnabled¶
Returns whether DHT discovery is enabled after config resolution.
Return: The resolved autodht_ value (constructor param, or the auto_dht key from network_config.json when present — config wins). Read-only observable.
function IsFullNode¶
Returns whether this node runs in full-node mode after config resolution.
Return: The resolved is_full_node_ (derived from node_type_ in the AccountSource constructor: Full/Archive -> true, Light -> false). Test/read-only observable; does not mutate state.
function GetNodeType¶
Returns the resolved node role.
Return: The node_type_ read from sgns_config.json (default Light). Read-only observable.
function AddAccountWithKey¶
Adds an account to local storage using an Ethereum private key.
Parameters:
- private_key Ethereum private key in hex format.
Return: Success if the account was created and stored, or an error.
function AddAccountWithMnemonic¶
Adds an account to local storage using a BIP39 mnemonic phrase.
Parameters:
- mnemonic BIP39 mnemonic phrase.
Return: Success if the account was created and stored, or an error.
function AddAccountWithRandomMnemonic¶
Adds an account to local storage using a newly generated random BIP39 mnemonic.
Return: The generated mnemonic phrase on success, or an error.
function SelectAccount¶
Selects the active account for subsequent node operations.
Parameters:
- public_address Stored account address to activate.
Return: Success after services are reset and database initialization is restarted, or an address error.
function TransferAccount¶
Transfers node ownership to another stored account address.
Parameters:
- public_address Stored account address that should receive the current balance and become active.
Return: Success after funds are transferred and the target account is selected, or an address/transaction error.
function DeleteAccount¶
Deletes a locally stored account.
Parameters:
- public_address Stored account address to delete.
Return: Success when the account is deleted; failure when the address is active or unavailable.
function MergeAccount¶
Merges the active account into another stored account.
Parameters:
- public_address Stored account address to receive the configured-token balance and become active.
Return: Success when transfer, selection, and deletion of the previous active account complete.
function SetPayoutAddress¶
Updates the payout address used by processing rewards.
Parameters:
- payout_address Address to save as the processing payout destination.
Return: Success when the address is persisted and processing reinitialization is scheduled.
function ProcessImage¶
Submits an image-processing request described by JSON input.
Parameters:
- jsondata Processing request JSON.
Return: Escrow transaction hash on success, or a validation, balance, or database error.
function GetMyTaskIds¶
Returns the task IDs of jobs submitted by the active account.
Parameters:
- limit Maximum number of task IDs to return (default: 50).
- offset Number of task IDs to skip from the end of the list (default: 0).
Return: Vector of task IDs from the in-memory set, newest last.
Note: The on-disk file retains full history; only the most recent entries are kept in memory for polling.
function GetTaskResult¶
Retrieves the completed result for a specific job by its task ID.
Parameters:
- taskId The task ID (ipfs_block_id) of the job.
Return: The TaskResult if the task has completed, or an error if not found/incomplete.
function GetProcessCost¶
Estimates the GNUS cost of a processing request manager.
Parameters:
- procmgr Processing manager containing parsed request data.
Return: Estimated cost in minions, or 0 when the request size, price, or cost calculation fails.
function GetGNUSPrice¶
Retrieves the current GNUS market price from the configured pricing service.
Return: Current GNUS price in USD, or Error::NO_PRICE when unavailable.
function GetName¶
Returns the component name used by the component framework.
Return: Static component name "GeniusNode".
Reimplements: IComponent::GetName
function GetVersion¶
Returns the full SuperGenius version string.
Return: Version string built from the compiled version metadata.
function LoadLogConfig¶
Reloads log level overrides from log_config.json at runtime.
function MintTokens¶
outcome::result< std::string > MintTokens(
uint64_t amount,
const std::string & transaction_hash,
const std::string & chainid,
TokenID tokenid,
std::string destination =""
)
Creates and submits a mint transaction.
Parameters:
- amount Amount to mint in token base units.
- transaction_hash Source-chain transaction hash that justifies the mint.
- chainid Source chain identifier where the burn or lock event occurred.
- tokenid Token identifier to mint.
- destination Recipient address; defaults to the active account address when empty.
Return: Mint transaction hash on success, or a transaction readiness/submission error.
function MintTokens¶
outcome::result< std::pair< std::string, uint64_t > > MintTokens(
uint64_t amount,
const std::string & transaction_hash,
const std::string & chainid,
TokenID tokenid,
std::string destination,
std::chrono::milliseconds timeout
)
Creates a mint transaction and waits for it to finalize.
Parameters:
- amount Amount to mint in token base units.
- transaction_hash Source-chain transaction hash that justifies the mint.
- chainid Source chain identifier where the burn or lock event occurred.
- tokenid Token identifier to mint.
- destination Recipient address for the minted tokens.
- timeout Maximum time to wait for finalization.
Return: Pair of transaction hash and elapsed milliseconds on success, or a transaction/finalization error.
function AddPeer¶
Adds a peer to PubSub and starts connecting to it.
Parameters:
- peer Peer multiaddress to connect to.
function AddPeers¶
Adds peers to PubSub and starts connecting to them.
Parameters:
- peers Peer multiaddresses to connect to.
function RefreshUPNP¶
Starts or restarts the background UPnP port refresh thread.
Parameters:
- pubsubport TCP port to keep mapped through UPnP.
function GetBalance¶
Returns the active account balance across all tokens.
Return: Total local UTXO balance for the active account.
function GetBalance¶
Returns the active account balance for a token.
Parameters:
- token_id Token identifier to filter by.
Return: Local UTXO balance for token_id.
function GetBalance¶
Returns an address balance across all tokens.
Parameters:
- address Address whose UTXO balance should be queried.
Return: Total local UTXO balance for address.
function GetBalance¶
Returns an address balance for a token.
Parameters:
- token_id Token identifier to filter by.
- address Address whose UTXO balance should be queried.
Return: Local UTXO balance for address and token_id.
function GetInTransactions¶
Returns serialized incoming transactions known to the transaction manager.
Return: Incoming transaction byte vectors, or an empty vector when transactions are not ready.
function GetOutTransactions¶
Returns serialized outgoing transactions known to the transaction manager.
Return: Outgoing transaction byte vectors, or an empty vector when transactions are not ready.
function CountTransactions¶
size_t CountTransactions(
std::optional< TransactionManager::TransactionStatus > tx_status =std::nullopt
) const
Counts known transactions filtered by optional status.
Parameters:
- tx_status Optional transaction status filter.
Return: Number of matching transactions, or zero when transactions are not ready.
function GetAddress¶
Returns the active account public address.
Return: Public address of the active account.
function GetMnemonicOfActiveAccount¶
Retrieves the BIP39 mnemonic of the active account from secure storage.
Return: The mnemonic phrase if found, or std::nullopt.
function GetTokenID¶
Returns the configured child token identifier.
Return: Token identifier from the node runtime configuration.
function GetInitializationStatus¶
Returns the current node initialization progress as a percentage and description. The percentage ranges from 0.0 (CREATING) to 1.0 (READY), with sub-progress reported during database migration and transaction manager initialization.
Return: Pair of progress fraction and a human-readable status description.
function GetProcessingStatus¶
Returns the current processing service status.
Return: Processing status, or DISABLED when the service is not initialized.
function TransferFunds¶
outcome::result< std::pair< std::string, uint64_t > > TransferFunds(
uint64_t amount,
const std::string & destination,
TokenID token_id,
std::chrono::milliseconds timeout
)
Transfers funds and waits for the transaction to finalize.
Parameters:
- amount Amount to transfer in token base units.
- destination Recipient address.
- token_id Token identifier to transfer.
- timeout Maximum time to wait for finalization.
Return: Pair of transaction hash and elapsed milliseconds on success, or a transfer/finalization error.
function TransferFunds¶
outcome::result< std::string > TransferFunds(
uint64_t amount,
const std::string & destination,
TokenID token_id
)
Transfers funds without waiting for finalization.
Parameters:
- amount Amount to transfer in token base units.
- destination Recipient address.
- token_id Token identifier to transfer.
Return: Transfer transaction hash on success, or a readiness, balance, or submission error.
function PayDev¶
Transfers funds to the configured developer address.
Parameters:
- amount Amount to transfer in token base units.
- token_id Token identifier to transfer.
Return: Transfer transaction hash on success, or a readiness, balance, or submission error.
function PayDev¶
outcome::result< std::pair< std::string, uint64_t > > PayDev(
uint64_t amount,
TokenID token_id,
std::chrono::milliseconds timeout
)
Transfers funds to the configured developer address and waits for finalization.
Parameters:
- amount Amount to transfer in token base units.
- token_id Token identifier to transfer.
- timeout Maximum time to wait for finalization.
Return: Pair of transaction hash and elapsed milliseconds on success, or a transfer/finalization error.
function WaitForFinalized¶
outcome::result< std::pair< TransactionManager::TransactionStatus, uint64_t > > WaitForFinalized(
const std::string & tx_id,
std::chrono::milliseconds timeout
)
Waits until an outgoing transaction reaches a terminal state.
Parameters:
- tx_id Transaction hash to poll.
- timeout Maximum time to wait.
Return: Pair of terminal status and elapsed milliseconds, or Error::TRANSACTION_NOT_FINALIZED on timeout.
function IsFinalized¶
Checks whether an outgoing transaction has reached a terminal state.
Parameters:
- tx_id Transaction hash to check.
Return: Terminal transaction status when available; otherwise std::nullopt.
function GetPubSub¶
Returns the underlying PubSub service.
Return: Shared PubSub instance used by the node.
function ResetProcessingMembers¶
Releases processing service, core, queue, and result-storage references.
function FormatTokens¶
Formats a fixed-point amount into a human-readable string.
Parameters:
- amount Amount in Minion Tokens (1e-6 GNUS).
- tokenId Optional token identifier: – empty: default (minion to GNUS) formatting – matches DevConfig.TokenID: child-token formatting – otherwise: returns Error::TOKEN_ID_MISMATCH
Return: Outcome result with the formatted string in GNUS or an error.
function ParseTokens¶
Parses a human-readable string into a fixed-point amount.
Parameters:
- str String representation of an amount in GNUS.
- tokenId Optional token identifier: – empty: default (GNUS to minion) parsing – matches DevConfig.TokenID: child-token parsing – otherwise: returns Error::TOKEN_ID_MISMATCH
Return: Outcome result with the parsed amount in Minion Tokens (1e-6 GNUS) or an error.
function PrintDataStore¶
Prints the transaction GlobalDB datastore for debugging.
function StopProcessing¶
Stops the processing service if it is initialized.
function StartProcessing¶
Starts the processing service on the configured processing grid channel.
function GetCoinprice¶
outcome::result< std::map< std::string, double > > GetCoinprice(
const std::vector< std::string > & tokenIds
)
Retrieves current USD prices for token identifiers, using a short local cache.
Parameters:
- tokenIds CoinGecko token identifiers to price.
Return: Map from token identifier to current USD price, or a price-retrieval error.
function GetCoinPriceByDate¶
outcome::result< std::map< std::string, std::map< int64_t, double > > > GetCoinPriceByDate(
const std::vector< std::string > & tokenIds,
const std::vector< int64_t > & timestamps
)
Retrieves historical USD prices for token identifiers at exact timestamps.
Parameters:
- tokenIds CoinGecko token identifiers to price.
- timestamps Unix timestamps to query.
Return: Nested map from token identifier to timestamp to USD price.
function GetCoinPricesByDateRange¶
outcome::result< std::map< std::string, std::map< int64_t, double > > > GetCoinPricesByDateRange(
const std::vector< std::string > & tokenIds,
int64_t from,
int64_t to
)
Retrieves historical USD prices for token identifiers over a date range.
Parameters:
- tokenIds CoinGecko token identifiers to price.
- from Start Unix timestamp for the range.
- to End Unix timestamp for the range.
Return: Nested map from token identifier to timestamp to USD price.
function WaitForTransactionIncoming¶
TransactionManager::TransactionStatus WaitForTransactionIncoming(
const std::string & txId,
std::chrono::milliseconds timeout
)
Waits for an incoming transaction to be processed.
Parameters:
- txId Transaction hash to wait for.
- timeout Maximum time to wait.
Return: Incoming transaction status, or INVALID when transactions are not ready.
function WaitForTransactionOutgoing¶
TransactionManager::TransactionStatus WaitForTransactionOutgoing(
const std::string & txId,
std::chrono::milliseconds timeout
)
Waits for an outgoing transaction to be processed.
Parameters:
- txId Transaction hash to wait for.
- timeout Maximum time to wait.
Return: Outgoing transaction status, or INVALID when transactions are not ready.
function WaitForEscrowRelease¶
TransactionManager::TransactionStatus WaitForEscrowRelease(
const std::string & originalEscrowId,
std::chrono::milliseconds timeout
)
Waits until an escrow hold output is consumed.
Parameters:
- originalEscrowId Hash of the original escrow hold transaction.
- timeout Maximum time to wait.
Return: CONFIRMED when consumed, or INVALID when transactions are not ready or the wait times out.
function GetTransactionManagerState¶
Returns the current transaction manager lifecycle state.
Return: Transaction manager state, or CREATING when the manager is not available.
function GetTransactionManager¶
Returns the transaction manager when initialized.
Return: Shared transaction manager, or Error::TRANSACTIONS_NOT_READY.
function ConfigureRpcEndpoint¶
bool ConfigureRpcEndpoint(
const std::string & chain_id,
std::vector< WeightedRpcEndpoint > endpoints
)
Configures RPC endpoints for a specific EVM chain on the public-chain input validator.
Parameters:
- chain_id Numeric EVM chain ID as a string (e.g. "11155111" for Sepolia).
- endpoints Vector of weighted RPC endpoints for the chain.
Return: True when the endpoints were configured; false when the transaction manager is absent or not READY.
Allows callers (including E2E tests) to register RPC endpoints for chains that are not in the default mainnet set (e.g. Sepolia testnet). The transaction manager must be in READY state.
function SetChainlistFetcher¶
Injects a custom chainlist fetcher for RPC endpoint discovery (test injection point).
Parameters:
- fetcher Callable returning the chainlist JSON string, or std::nullopt on failure.
function GetTransactionStatus¶
Returns a tracked transaction status by transaction hash.
Parameters:
- txId Transaction hash to look up.
Return: Outgoing status when present, then incoming status, or INVALID when unknown/not ready.
function SetAuthorizedFullNodeAddress¶
Sets the authorized full-node address for blockchain genesis verification.
Parameters:
- pub_address Public address authorized to create genesis blocks.
function GetAuthorizedFullNodeAddress¶
Gets the current authorized full-node public address.
Return: Public address authorized to create genesis blocks.
function GetState¶
Returns the current GeniusNode lifecycle state.
Return: Current node state.
Protected Functions Documentation¶
function SendTransactionAndProof¶
void SendTransactionAndProof(
std::shared_ptr< GeniusTransaction > tx,
std::vector< uint8_t > proof
)
Enqueues a transaction and its proof directly through the transaction manager.
Parameters:
- tx Transaction to enqueue.
- proof Serialized proof bytes associated with
tx.
Public Attributes Documentation¶
variable TIMEOUT_ESCROW_PAY¶
Escrow payout timeout.
variable TIMEOUT_TRANSFER¶
Transfer timeout.
variable TIMEOUT_MINT¶
Mint timeout.
Protected Attributes Documentation¶
variable write_base_path_¶
Base path for node databases, logs, and account storage.
variable account_¶
Active account used by node services.
Friends¶
friend TransactionSyncTest¶
friend MultiAccountTestAccess¶
friend GeniusNodeTestAccess¶
Updated on 2026-08-06 at 13:59:17 +0000