Skip to content

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
class sgns::neoswarm::network::SGClient
struct sgns::neoswarm::network::SGClient::Config

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).

Source code

#ifndef NEOSWARM_NETWORK_SG_CLIENT_SUPERGENIUSCLIENT_HPP
#define NEOSWARM_NETWORK_SG_CLIENT_SUPERGENIUSCLIENT_HPP

#include "common/error.hpp"
#include <chrono>
#include <cstdint>
#include <memory>
#include <string>
#include <vector>

namespace sgns::neoswarm::network
{
    class SGClient
    {
        public:
        struct Config
        {
            std::string m_sdkBasePath = "./sdk";           
            uint16_t m_basePort = 40001;                   
            bool m_autoDht = true;                         
            bool m_enableProcessing = true;                
            std::chrono::seconds m_resultTimeout{ 300 };   
        };

        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-07-25 at 22:56:57 +0000