sg_client/super_genius_client.hpp¶
Client for SuperGenius blockchain compute network dispatch via GeniusSDK. More...
Namespaces¶
| Name |
|---|
| sgns |
| sgns::neoswarm |
| sgns::neoswarm::network |
Classes¶
| Name | |
|---|---|
| struct | sgns::neoswarm::network::GeniusNodeConfig Runtime configuration values used to bootstrap a Genius node instance. |
| class | sgns::neoswarm::network::SGClient |
| struct | sgns::neoswarm::network::SGClient::Config |
Attributes¶
| Name | |
|---|---|
| constexpr const char * | kDefaultDevAddr |
| constexpr const char * | kDefaultDevCut |
| constexpr const char * | kDefaultDevTokenValue |
| constexpr unsigned int | kDefaultResultTimeoutSeconds 5 minutes (WR-02) |
Detailed Description¶
Client for SuperGenius blockchain compute network dispatch via GeniusSDK.
Date: 2026-05-28
GeniusSDK runs in-process via direct linking — every swarm node has the SDK compiled in. No remote endpoint, no gRPC channel management. Initialize() starts the SDK node; SubmitJob() dispatches through GeniusSDKProcess(); Disconnect() calls GeniusSDKShutdown().
SDK identity is managed internally — GeniusSDKInit() generates its own keypair. NEO-SWARM does NOT derive SDK keys from NodeIdentity (they serve different purposes: NodeIdentity = P2P swarm identity, SDK identity = blockchain node identity).
Attributes Documentation¶
variable kDefaultDevAddr¶
variable kDefaultDevCut¶
variable kDefaultDevTokenValue¶
variable kDefaultResultTimeoutSeconds¶
5 minutes (WR-02)
Source code¶
#ifndef NEOSWARM_NETWORK_SG_CLIENT_SUPERGENIUSCLIENT_HPP
#define NEOSWARM_NETWORK_SG_CLIENT_SUPERGENIUSCLIENT_HPP
#include "common/error.hpp"
#include "account/TokenID.hpp"
#include <chrono>
#include <cstdint>
#include <memory>
#include <string>
#include <vector>
namespace sgns::neoswarm::network
{
struct GeniusNodeConfig
{
std::string Addr;
std::string Cut;
std::string TokenValueInGNUS;
// Default TokenID{} is intentionally all-zero = the GNUS token.
// ToHex() emits 64 zeros, which GeniusSDK's ParseDevConfig accepts and
// IsGNUS() reports as the GNUS token (IN-02).
sgns::TokenID TokenID;
std::string BaseWritePath;
};
// Dev-config defaults — match GeniusSDK/example/dev_config.json (WR-01).
// kDefaultDevAddr is a placeholder only; a production deployment MUST
// override it with a real payout address ("0x" + 40 hex chars).
inline constexpr const char* kDefaultDevAddr = "0xcafe";
inline constexpr const char* kDefaultDevCut = "0.65";
inline constexpr const char* kDefaultDevTokenValue = "1.0";
inline constexpr unsigned int kDefaultResultTimeoutSeconds = 300;
class SGClient
{
public:
struct Config
{
GeniusNodeConfig m_geniusNodeConfig{ kDefaultDevAddr, kDefaultDevCut, kDefaultDevTokenValue,
sgns::TokenID{}, "./sdk" };
std::chrono::seconds m_resultTimeout{ kDefaultResultTimeoutSeconds };
};
explicit SGClient( Config cfg );
~SGClient();
SGClient( const SGClient& ) = delete;
SGClient& operator=( const SGClient& ) = delete;
SGClient( SGClient&& ) noexcept;
SGClient& operator=( SGClient&& ) noexcept;
outcome::result<void> Initialize();
outcome::result<std::vector<uint8_t>> SubmitJob( const std::string& gnusSchemaJson );
void Disconnect();
bool IsConnected() const noexcept;
private:
struct Impl;
std::unique_ptr<Impl> m_impl;
};
} // namespace sgns::neoswarm::network
#endif // NEOSWARM_NETWORK_SG_CLIENT_SUPERGENIUSCLIENT_HPP
Updated on 2026-10-09 at 03:59:42 +0000