sgns::GeniusNode¶
#include <GeniusNode.hpp>
Inherits from IComponent, std::enable_shared_from_this< GeniusNode >
Public Types¶
| Name | |
|---|---|
| enum class uint8_t | NodeState |
| 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} GeniusNodeError class. |
Public Functions¶
| Name | |
|---|---|
| std::shared_ptr< GeniusNode > | New(const DevConfig_st & dev_config, bool autodht =true, bool isprocessor =true, uint16_t base_port =40001, bool is_full_node =false, bool use_upnp =true) |
| std::shared_ptr< GeniusNode > | New(const DevConfig_st & dev_config, const char * eth_private_key, bool autodht =true, bool isprocessor =true, uint16_t base_port =40001, bool is_full_node =false, bool use_upnp =true) |
| std::shared_ptr< GeniusNode > | New(const DevConfig_st & dev_config, const GeniusAccount::Credentials & credentials, bool autodht =true, bool isprocessor =true, uint16_t base_port =40001, bool is_full_node =false, bool use_upnp =true) |
| ~GeniusNode() override | |
| outcome::result< std::string > | ProcessImage(const std::string & jsondata) |
| uint64_t | GetProcessCost(std::shared_ptr< sgns::sgprocessing::ProcessingManager > & procmgr) |
| outcome::result< double > | GetGNUSPrice() |
| virtual std::string | GetName() override |
| std::string | GetVersion() |
| outcome::result< std::pair< std::string, uint64_t > > | MintTokens(uint64_t amount, const std::string & transaction_hash, const std::string & chainid, TokenID tokenid, std::chrono::milliseconds timeout =std::chrono::milliseconds(TIMEOUT_MINT)) Mints tokens by converting a string amount to fixed-point representation. |
| void | AddPeer(const std::string & peer) |
| void | RefreshUPNP(uint16_t pubsubport) |
| uint64_t | GetBalance() |
| uint64_t | GetBalance(TokenID token_id) |
| uint64_t | GetBalance(const std::string & address) |
| uint64_t | GetBalance(TokenID token_id, const std::string & address) |
| const std::vector< std::vector< uint8_t > > | GetInTransactions() const |
| const std::vector< std::vector< uint8_t > > | GetOutTransactions() const |
| std::string | GetAddress() const |
| TokenID | GetTokenID() const |
| processing::ProcessingServiceImpl::ProcessingStatus | GetProcessingStatus() const |
| outcome::result< std::pair< std::string, uint64_t > > | TransferFunds(uint64_t amount, const std::string & destination, TokenID token_id, std::chrono::milliseconds timeout) |
| outcome::result< std::string > | TransferFunds(uint64_t amount, const std::string & destination, TokenID token_id) |
| outcome::result< std::pair< std::string, uint64_t > > | PayDev(uint64_t amount, TokenID token_id, std::chrono::milliseconds timeout =std::chrono::milliseconds(TIMEOUT_TRANSFER)) |
| std::shared_ptr< ipfs_pubsub::GossipPubSub > | GetPubSub() |
| outcome::result< std::string > | FormatTokens(uint64_t amount, const TokenID tokenId) Formats a fixed-point amount into a human-readable string. |
| outcome::result< uint64_t > | ParseTokens(const std::string & str, const TokenID tokenId) Parses a human-readable string into a fixed-point amount. |
| void | PrintDataStore() const |
| void | StopProcessing() |
| void | StartProcessing() |
| outcome::result< std::map< std::string, double > > | GetCoinprice(const std::vector< std::string > & tokenIds) |
| outcome::result< std::map< std::string, std::map< int64_t, double > > > | GetCoinPriceByDate(const std::vector< std::string > & tokenIds, const std::vector< int64_t > & 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) |
| TransactionManager::TransactionStatus | WaitForTransactionIncoming(const std::string & txId, std::chrono::milliseconds timeout) |
| TransactionManager::TransactionStatus | WaitForTransactionOutgoing(const std::string & txId, std::chrono::milliseconds timeout) |
| TransactionManager::TransactionStatus | WaitForEscrowRelease(const std::string & originalEscrowId, std::chrono::milliseconds timeout) |
| TransactionManager::State | GetTransactionManagerState() const |
| TransactionManager::TransactionStatus | GetTransactionStatus(const std::string & txId) const |
| void | SetAuthorizedFullNodeAddress(const std::string & pub_address) Set the authorized full node address for blockchain genesis verification. |
| const std::string & | GetAuthorizedFullNodeAddress() const Get the current authorized full node public address. |
| NodeState | GetState() const |
Protected Functions¶
| Name | |
|---|---|
| void | SendTransactionAndProof(std::shared_ptr< IGeniusTransactions > tx, std::vector< uint8_t > proof) |
| void | ConfigureTransactionFilterTimeoutsMs(uint64_t timeframe_limit_ms, uint64_t mutability_window_ms) |
Public Attributes¶
| Name | |
|---|---|
| uint64_t | TIMEOUT_ESCROW_PAY |
| uint64_t | TIMEOUT_TRANSFER |
| uint64_t | TIMEOUT_MINT |
Protected Attributes¶
| Name | |
|---|---|
| std::string | write_base_path_ |
| std::shared_ptr< GeniusAccount > | account_ |
| UTXOManager | utxo_manager_ |
Friends¶
| Name | |
|---|---|
| class | TransactionSyncTest |
Additional inherited members¶
Public Functions inherited from IComponent
| Name | |
|---|---|
| virtual | ~IComponent() =default |
Public Types Documentation¶
enum NodeState¶
| Enumerator | Value | Description |
|---|---|---|
| CREATING | 0 | |
| MIGRATING_DATABASE | ||
| INITIALIZING_DATABASE | ||
| INITIALIZING_PROCESSING | ||
| INITIALIZING_BLOCKCHAIN | ||
| INITIALIZING_TRANSACTIONS | ||
| INITIALIZING_DHT | ||
| READY |
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 | Informed Token ID doesn't match initialized ID. |
| PROCESS_COST_ERROR | 7 | The calculated Processing cost was negative. |
| PROCESS_INFO_MISSING | 8 | Processing information missing on JSON file. |
| INVALID_JSON | 9 | JSON cannot be parsed>. |
| INVALID_BLOCK_PARAMETERS | 10 | JSON params for blocks incorrect or missing>. |
| NO_PROCESSOR | 11 | No processor for this type. |
| NO_PRICE | 12 | Couldn't get price of gnus. |
| TRANSACTIONS_NOT_READY | 13 | Transactions aren't ready. |
GeniusNodeError class.
Public Functions Documentation¶
function New¶
static std::shared_ptr< GeniusNode > New(
const DevConfig_st & dev_config,
bool autodht =true,
bool isprocessor =true,
uint16_t base_port =40001,
bool is_full_node =false,
bool use_upnp =true
)
function New¶
static std::shared_ptr< GeniusNode > New(
const DevConfig_st & dev_config,
const char * eth_private_key,
bool autodht =true,
bool isprocessor =true,
uint16_t base_port =40001,
bool is_full_node =false,
bool use_upnp =true
)
function New¶
static std::shared_ptr< GeniusNode > New(
const DevConfig_st & dev_config,
const GeniusAccount::Credentials & credentials,
bool autodht =true,
bool isprocessor =true,
uint16_t base_port =40001,
bool is_full_node =false,
bool use_upnp =true
)
function ~GeniusNode¶
function ProcessImage¶
function GetProcessCost¶
function GetGNUSPrice¶
function GetName¶
Reimplements: IComponent::GetName
function GetVersion¶
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::chrono::milliseconds timeout =std::chrono::milliseconds(TIMEOUT_MINT)
)
Mints tokens by converting a string amount to fixed-point representation.
Parameters:
- amount Numeric value with amount in Minion Tokens (1e-6 GNUS Token)
- transaction_hash Transaction hash on the source chain.
- chainid Source chain identifier.
- tokenid Token identifier to mint.
- timeout Timeout for the mint operation.
Return: Outcome of mint token operation
function AddPeer¶
function RefreshUPNP¶
function GetBalance¶
function GetBalance¶
function GetBalance¶
function GetBalance¶
function GetInTransactions¶
function GetOutTransactions¶
function GetAddress¶
function GetTokenID¶
function GetProcessingStatus¶
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
)
function TransferFunds¶
outcome::result< std::string > TransferFunds(
uint64_t amount,
const std::string & destination,
TokenID token_id
)
function PayDev¶
outcome::result< std::pair< std::string, uint64_t > > PayDev(
uint64_t amount,
TokenID token_id,
std::chrono::milliseconds timeout =std::chrono::milliseconds(TIMEOUT_TRANSFER)
)
function GetPubSub¶
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¶
function StopProcessing¶
function StartProcessing¶
function GetCoinprice¶
outcome::result< std::map< std::string, double > > GetCoinprice(
const std::vector< std::string > & tokenIds
)
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
)
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
)
function WaitForTransactionIncoming¶
TransactionManager::TransactionStatus WaitForTransactionIncoming(
const std::string & txId,
std::chrono::milliseconds timeout
)
function WaitForTransactionOutgoing¶
TransactionManager::TransactionStatus WaitForTransactionOutgoing(
const std::string & txId,
std::chrono::milliseconds timeout
)
function WaitForEscrowRelease¶
TransactionManager::TransactionStatus WaitForEscrowRelease(
const std::string & originalEscrowId,
std::chrono::milliseconds timeout
)
function GetTransactionManagerState¶
function GetTransactionStatus¶
function SetAuthorizedFullNodeAddress¶
Set the authorized full node address for blockchain genesis verification.
Parameters:
- pub_address The public address that is authorized to create genesis blocks
function GetAuthorizedFullNodeAddress¶
Get the current authorized full node public address.
Return: The authorized full node public address
function GetState¶
Protected Functions Documentation¶
function SendTransactionAndProof¶
void SendTransactionAndProof(
std::shared_ptr< IGeniusTransactions > tx,
std::vector< uint8_t > proof
)
function ConfigureTransactionFilterTimeoutsMs¶
void ConfigureTransactionFilterTimeoutsMs(
uint64_t timeframe_limit_ms,
uint64_t mutability_window_ms
)
Public Attributes Documentation¶
variable TIMEOUT_ESCROW_PAY¶
variable TIMEOUT_TRANSFER¶
variable TIMEOUT_MINT¶
Protected Attributes Documentation¶
variable write_base_path_¶
variable account_¶
variable utxo_manager_¶
Friends¶
friend TransactionSyncTest¶
Updated on 2026-03-04 at 13:10:43 -0800