Skip to content

sgns

Namespaces

Name
sgns::input_validator_constants
sgns::utxo_merkle
Utilities for building deterministic Merkle roots over ordered UTXO payloads.
sgns::utxo_address
sgns::api
sgns::base
sgns::version
sgns::crdt
sgns::storage
sgns::crypto
sgns::processing
sgns::sgprocessing
sgns::face
sgns::subscription
sgns::evmwatcher
sgns::watcher
sgns::sgprocmanager
sgns::sgprocmanagersha

Classes

Name
class sgns::AccountMessenger
class sgns::BridgeRelayer
Registers a BridgeSourceBurned watch on a shared EthWatchService and calls MintFunds when burns are detected.
struct sgns::ChainRpcProviderConfig
Platform-agnostic configuration passed to ChainRpcEndpointProvider.
class sgns::ChainRpcEndpointProvider
Encapsulates ChainList RPC endpoint loading and validator wiring.
class sgns::EscrowTransaction
Transaction that reserves funds for a job escrow while tracking peer payout metadata.
class sgns::GeniusAccount
class sgns::GeniusInputValidator
Validator for native Genius-chain transactions.
class sgns::GeniusNode
High-level facade that initializes and coordinates account, networking, transaction, blockchain, and processing subsystems.
class sgns::GeniusTransaction
Base class of the GeniusTransaction.
struct sgns::OutPoint
Unique identifier for a transaction output.
class sgns::GeniusUTXO
Immutable-style UTXO value object containing ownership, token, amount, and outpoint metadata.
class sgns::IMigrationStep
Interface for a migration step between two schema versions.
class sgns::IInputValidator
Strategy interface for validating transaction inputs and their witness data.
class sgns::Migration0_2_0To1_0_0
Migration step for version 0.2.0 to 1.0.0.
class sgns::Migration1_0_0To3_4_0
Migration step for version 1.0.0 to 3.4.0. Changes the full node topic from CRDT heads.
class sgns::Migration3_4_0To3_5_0
Migration step for version 3.4.0 to 3.5.0. Updates persisted data required by the 3.5.0 node layout.
class sgns::Migration3_5_0To3_6_0
Executes the storage migration from database version 3.5.1 to 3.6.0.
class sgns::Migration3_6_0To3_7_0
Executes the 3.6.0 to 3.7.0 migration, including legacy balance recovery.
class sgns::MigrationAllowList
Stores observed legacy balances and validates migration claim eligibility.
class sgns::MigrationManager
Executes a sequence of migration steps to update a CRDT store.
class sgns::MigrationTransaction
class sgns::MintTransaction
Transaction that mints tokens after proving a corresponding source-chain event.
class sgns::MintTransactionV2
Implements a Mint Version 2 transaction.
class sgns::ProcessingTransaction
struct sgns::WeightedRpcEndpoint
Weighted RPC endpoint used for multi-provider consensus verification.
class sgns::PublicChainInputValidator
Validator for transactions that reference external public-chain proofs.
class sgns::TokenAmount
Utility for GNUS token fixed-point parsing, formatting and cost calculation.
class sgns::TokenID
Represents a 32-byte token identifier while preserving legacy GNUS semantics.
class sgns::TransactionManager
Coordinates transaction creation, CRDT propagation, verification, and status tracking.
class sgns::TransferTransaction
Transaction for transferring funds between UTXO inputs and outputs.
struct sgns::OutPointHash
Hash functor for using OutPoint keys in unordered containers.
class sgns::UTXOManager
Owns the local UTXO set, supports coin selection, validation, persistence, reservations, and deterministic snapshot hashing.
struct sgns::InputUTXOInfo
Raw UTXO input data included in a spend request.
struct sgns::OutputDestInfo
Single UTXO output destination entry.
class sgns::ScaledInteger
Represents a decimal value using an integer scaled by 10^precision.
struct sgns::Unused
struct sgns::lambda_visitor
struct sgns::lambda_visitor< Lambda, Lambdas... >
struct sgns::lambda_visitor< Lambda >
class sgns::Blockchain
Manages genesis/account-creation blocks and consensus integration.
class sgns::ConsensusManager
Implements Consensus with weighted voting.
class sgns::ValidatorRegistry
Maintains validator registry state and applies certificate-driven updates.
class sgns::CoinGeckoPriceRetriever
class sgns::AndroidSecureStorage
class sgns::AppleSecureStorage
class sgns::JSONSecureStorage
class sgns::JSONBackend
class sgns::LinuxSecureStorage
class sgns::MemorySecureStorage
In-memory JSON backend for tests. Stores data in a map — no OS keychain access, no password prompts, no cleanup needed.
class sgns::WindowsSecureStorage
class sgns::ISecureStorage
class sgns::GeniusAssigner
class sgns::GeniusProver
Prover class of SuperGenius.
class sgns::IBasicProof
Base proof class header file.
class sgns::NilFileHelper
class sgns::ProcessingProof
A class for generating and verifying processing proofs.
class sgns::RecursiveTransferProof
A class for generating a recursive Transfer Proof.
class sgns::TransferProof
A class for generating and verifying transfer proofs.
class sgns::IpfsDHT

Types

Name
using std::pair< std::string, base::Buffer > EscrowDataPair
using std::pair< std::vector< InputUTXOInfo >, std::vector< OutputDestInfo > > UTXOTxParameters
Pair of signed inputs and destination outputs that make up a UTXO transaction payload.

Functions

Name
base::Logger BridgeRelayerLogger()
Returns a new instance of the BridgeRelayer logger.
base::Logger InputValidatorLogger()
base::Logger GeniusNodeLogger()
std::string generate_uuid_with_ipfs_id(const std::string & ipfs_id)
base::Logger TransactionManagerLogger()
template <size_t N,class Stream >
Stream &
operator<<(Stream & s, const Unused< N > & )
template <size_t N,class Stream >
Stream &
operator>>(Stream & s, Unused< N > & )
std::string to_string(const std::vector< unsigned char > & bytes)
Convert a byte array to a hexadecimal string.
bool isLittleEndian()
Checks if the architecture is little endian.
template <typename T >
T
Vector2Num(const std::vector< uint8_t > & bytes)
Converts a little-endian byte vector into a number.
uint128_t Vector2Num(const std::vector< uint8_t > & bytes)
uint256_t Vector2Num(const std::vector< uint8_t > & bytes)
template <typename T >
std::vector< uint8_t >
Num2Vector(const T & num, std::size_t num_bytes_resolution =sizeof(T))
Converts a number into a byte vector (little-endian).
template <typename T >
T
HexASCII2Num(const char * p_char, std::size_t num_nibbles_resolution =sizeof(T) *2)
Converts a hexadecimal ASCII char array into a number.
template <typename T >
std::vector< T >
HexASCII2NumStr(const char * p_char, std::size_t char_ptr_size)
Converts a hexadecimal ASCII char array into a vector of numbers.
template <typename T >
std::enable_if_t< std::is_same_v< typename T::value_type, uint8_t > >
AdjustEndianess(T & data, std::optional< typename T::iterator > start =std::nullopt, std::optional< typename T::iterator > finish =std::nullopt)
Adjust endianess if needed.
std::string Uint256ToString(const uint256_t & value)
template <class... Fs>
auto
make_visitor(Fs &&... fs)
Creates a compile-time visitor from a set of lambdas.
template <typename TVariant ,typename... TVisitors>
decltype(auto)
visit_in_place(TVariant && variant, TVisitors &&... visitors)
Applies an in-place visitor to a boost::variant.
template <typename T ,typename Matcher >
decltype(auto)
match(T && t, Matcher && m)
apply Matcher to optional T
template <typename T ,typename... Fs>
decltype(auto)
match_in_place(T && t, Fs &&... fs)
construct visitor from Fs and apply it to optional T
base::Logger ConsensusManagerLogger()
outcome::result< std::vector< uint8_t > > ProposalSigningBytes(const ConsensusProposal & proposal)
Builds canonical bytes used to sign a consensus proposal.
outcome::result< std::vector< uint8_t > > VoteSigningBytes(const ConsensusVote & vote)
Builds canonical bytes used to sign a consensus vote.
outcome::result< std::vector< uint8_t > > VoteBundleSigningBytes(const ConsensusVoteBundle & bundle)
Builds canonical bytes used to sign a consensus vote bundle.
outcome::result< std::string > ComputeProposalId(const ConsensusProposal & proposal)
Computes deterministic proposal id from proposal content.
bool ValidateProposal(const ConsensusProposal & proposal)
Validates proposal basic shape, signature, and computed id.
std::string decodeChunkedTransfer(const std::string & chunkedData)
GeniusProver::ProofType GetSnarkFromProto(const SGProof::BaseProofData & proof_proto_data)
base::Hash256 HashLeaf(const std::vector< uint8_t > & payload)
Hashes a serialized UTXO leaf payload with the leaf domain separator.
base::Hash256 HashNode(const base::Hash256 & left, const base::Hash256 & right)
Hashes two child nodes with the internal-node domain separator.
std::string OutPointKey(const base::Hash256 & txid, uint32_t idx)
Generates a canonical key for a UTXO outpoint, used for deterministic ordering in Merkle tree construction.
void AppendUInt32BE(std::vector< uint8_t > & out, uint32_t value)
Appends a 32-bit unsigned integer in big-endian order.
void AppendUInt64BE(std::vector< uint8_t > & out, uint64_t value)
Appends a 64-bit unsigned integer in big-endian order.
uint32_t ReadUInt32BE(const uint8_t * data)
Reads a 32-bit unsigned integer from big-endian bytes.
uint64_t ReadUInt64BE(const uint8_t * data)
Reads a 64-bit unsigned integer from big-endian bytes.
base::Hash256 HashLeaf(const std::vector< uint8_t > & payload)
Hashes a serialized UTXO leaf payload with the leaf domain separator.
base::Hash256 HashNode(const base::Hash256 & left, const base::Hash256 & right)
Hashes two child nodes with the internal-node domain separator.
std::string OutPointKey(const base::Hash256 & txid, uint32_t idx)
Generates a canonical key for a UTXO outpoint, used for deterministic ordering in Merkle tree construction.
uint32_t ReadUInt32BE(const uint8_t * data)
Reads a 32-bit unsigned integer from big-endian bytes.
uint64_t ReadUInt64BE(const uint8_t * data)
Reads a 64-bit unsigned integer from big-endian bytes.
std::vector< uint8_t > SerializeUTXOLeafPayload(const GeniusUTXO & utxo)
Serializes a UTXO into the canonical leaf payload used for Merkle hashing.

Attributes

Name
size_t MAX_PUBSUB_TX_BYTES
std::string_view NONCE_SUBJECT_TYPE
std::string_view TASK_RESULT_SUBJECT_TYPE
std::string_view REGISTRY_BATCH_SUBJECT_TYPE
std::string_view FILE_NAME
size_t HASH256_BYTES
size_t SERIALIZED_UINT32_BYTES

Types Documentation

using EscrowDataPair

using sgns::EscrowDataPair = std::pair<std::string, base::Buffer>;

using UTXOTxParameters

using sgns::UTXOTxParameters = std::pair<std::vector<InputUTXOInfo>, std::vector<OutputDestInfo>>;

Pair of signed inputs and destination outputs that make up a UTXO transaction payload.

Functions Documentation

function BridgeRelayerLogger

base::Logger BridgeRelayerLogger()

Returns a new instance of the BridgeRelayer logger.

Return: Logger instance for BridgeRelayer.

Note: This is used for 2 reasons: (1) to enable logging on static methods, and (2) to avoid static initialization order issues when its created before the one with the same name on GeniusNode, which can have the output configured to file. If we initialize this logger statically it could end up outputing to console instead.

function InputValidatorLogger

base::Logger InputValidatorLogger()

function GeniusNodeLogger

base::Logger GeniusNodeLogger()

function generate_uuid_with_ipfs_id

std::string generate_uuid_with_ipfs_id(
    const std::string & ipfs_id
)

function TransactionManagerLogger

base::Logger TransactionManagerLogger()

function operator<<

template <size_t N,
class Stream >
Stream & operator<<(
    Stream & s,
    const Unused< N > & 
)

function operator>>

template <size_t N,
class Stream >
Stream & operator>>(
    Stream & s,
    Unused< N > & 
)

function to_string

static std::string to_string(
    const std::vector< unsigned char > & bytes
)

Convert a byte array to a hexadecimal string.

Parameters:

  • bytes A vector of bytes to be converted.

Return: A hexadecimal string representation of the bytes.

function isLittleEndian

static bool isLittleEndian()

Checks if the architecture is little endian.

Return: true if little endian, false otherwise

function Vector2Num

template <typename T >
static T Vector2Num(
    const std::vector< uint8_t > & bytes
)

Converts a little-endian byte vector into a number.

Parameters:

  • bytes Byte vector to convert.

Template Parameters:

  • T uint8_t, uint16_t, uint32_t, uint64_t, or supported multiprecision integer types.

Return: The converted number.

function Vector2Num

uint128_t Vector2Num(
    const std::vector< uint8_t > & bytes
)

function Vector2Num

uint256_t Vector2Num(
    const std::vector< uint8_t > & bytes
)

function Num2Vector

template <typename T >
static std::vector< uint8_t > Num2Vector(
    const T & num,
    std::size_t num_bytes_resolution =sizeof(T)
)

Converts a number into a byte vector (little-endian).

Parameters:

  • num Number to convert.
  • num_bytes_resolution Optional byte resolution (defaults to sizeof(T)).

Template Parameters:

  • T uint8_t, uint16_t, uint32_t or uint64_t

Return: The converted byte vector.

function HexASCII2Num

template <typename T >
static T HexASCII2Num(
    const char * p_char,
    std::size_t num_nibbles_resolution =sizeof(T) *2
)

Converts a hexadecimal ASCII char array into a number.

Parameters:

  • p_char Hexadecimal ASCII char array
  • num_nibbles_resolution How many nibbles will constitute a number

Template Parameters:

  • T uint8_t, uint16_t, uint32_t or uint64_t

Return: The converted number (8-64 bit variable)

function HexASCII2NumStr

template <typename T >
static std::vector< T > HexASCII2NumStr(
    const char * p_char,
    std::size_t char_ptr_size
)

Converts a hexadecimal ASCII char array into a vector of numbers.

Parameters:

  • p_char Hexadecimal ASCII char array
  • char_ptr_size Size of the char array

Template Parameters:

  • T uint8_t, uint16_t, uint32_t or uint64_t

Return: The vector of converted numbers

function AdjustEndianess

template <typename T >
static std::enable_if_t< std::is_same_v< typename T::value_type, uint8_t > > AdjustEndianess(
    T & data,
    std::optional< typename T::iterator > start =std::nullopt,
    std::optional< typename T::iterator > finish =std::nullopt
)

Adjust endianess if needed.

Parameters:

  • data The container of data (vector/array)
  • start Optional beginning of the valid data
  • finish Optional ending of the valid data

Template Parameters:

  • T std::vector or std::array

function Uint256ToString

static std::string Uint256ToString(
    const uint256_t & value
)

function make_visitor

template <class... Fs>
auto make_visitor(
    Fs &&... fs
)

Creates a compile-time visitor from a set of lambdas.

Return: Visitor instance that dispatches to the provided lambdas.

Example: ```cpp

make_visitor(, { return 2; });

This is essentially the same as: ```cpp

struct visitor : public boost::static_visitor<int> {
  int operator()(int a) { return 1; }
  int operator()(std::string b) { return 2; }
};

function visit_in_place

template <typename TVariant ,
typename... TVisitors>
decltype(auto) visit_in_place(
    TVariant && variant,
    TVisitors &&... visitors
)

Applies an in-place visitor to a boost::variant.

Example: ```cpp

boost::variant value = "1234";

visit_in_place(value, { std::cout << "(int)" << v; }, { std::cout << "(string)" << v; });

### function match

```cpp
template <typename T ,
typename Matcher >
decltype(auto) match(
    T && t,
    Matcher && m
)

apply Matcher to optional T

function match_in_place

template <typename T ,
typename... Fs>
decltype(auto) match_in_place(
    T && t,
    Fs &&... fs
)

construct visitor from Fs and apply it to optional T

function ConsensusManagerLogger

base::Logger ConsensusManagerLogger()

function ProposalSigningBytes

inline outcome::result< std::vector< uint8_t > > ProposalSigningBytes(
    const ConsensusProposal & proposal
)

Builds canonical bytes used to sign a consensus proposal.

Parameters:

  • proposal Proposal object to serialize for signing.

Return: Serialized signing bytes on success, or std::errc::invalid_argument when protobuf serialization fails.

The signature field is cleared before serialization so signatures are never part of their own signing payload.

function VoteSigningBytes

inline outcome::result< std::vector< uint8_t > > VoteSigningBytes(
    const ConsensusVote & vote
)

Builds canonical bytes used to sign a consensus vote.

Parameters:

  • vote Vote object to serialize for signing.

Return: Serialized signing bytes on success, or std::errc::invalid_argument when protobuf serialization fails.

The signature field is cleared before serialization so signatures are never part of their own signing payload.

function VoteBundleSigningBytes

inline outcome::result< std::vector< uint8_t > > VoteBundleSigningBytes(
    const ConsensusVoteBundle & bundle
)

Builds canonical bytes used to sign a consensus vote bundle.

Parameters:

  • bundle Vote bundle to serialize for signing.

Return: Serialized signing bytes on success, or std::errc::invalid_argument when protobuf serialization fails.

The signature field is cleared before serialization so signatures are never part of their own signing payload.

function ComputeProposalId

inline outcome::result< std::string > ComputeProposalId(
    const ConsensusProposal & proposal
)

Computes deterministic proposal id from proposal content.

Parameters:

  • proposal Proposal used to derive the identifier.

Return: Lowercase hex SHA-256 proposal id on success, or propagated error when signing bytes cannot be produced.

The proposal id field is cleared before hashing to guarantee stable id derivation from the signed payload content only.

function ValidateProposal

inline bool ValidateProposal(
    const ConsensusProposal & proposal
)

Validates proposal basic shape, signature, and computed id.

Parameters:

  • proposal Proposal to validate.

Return: true when proposer id/signature/id are present, signature is valid, and computed proposal id matches; otherwise false.

function decodeChunkedTransfer

std::string decodeChunkedTransfer(
    const std::string & chunkedData
)

function GetSnarkFromProto

static GeniusProver::ProofType GetSnarkFromProto(
    const SGProof::BaseProofData & proof_proto_data
)

function HashLeaf

inline base::Hash256 HashLeaf(
    const std::vector< uint8_t > & payload
)

Hashes a serialized UTXO leaf payload with the leaf domain separator.

Parameters:

  • payload The payload to hash

Return: The hash of the payload as a leaf node in the Merkle tree

function HashNode

inline base::Hash256 HashNode(
    const base::Hash256 & left,
    const base::Hash256 & right
)

Hashes two child nodes with the internal-node domain separator.

Parameters:

  • left The hash of the left child node
  • right The hash of the right child node

Return: The hash of the parent node

function OutPointKey

inline std::string OutPointKey(
    const base::Hash256 & txid,
    uint32_t idx
)

Generates a canonical key for a UTXO outpoint, used for deterministic ordering in Merkle tree construction.

Parameters:

  • txid The transaction hash that created the UTXO
  • idx The output index of the UTXO within the transaction

Return: Canonical string key in the format "txid:idx" where txid is the readable hex representation of the transaction hash

function AppendUInt32BE

inline void AppendUInt32BE(
    std::vector< uint8_t > & out,
    uint32_t value
)

Appends a 32-bit unsigned integer in big-endian order.

Parameters:

  • out The vector to append to
  • value the value to append

function AppendUInt64BE

inline void AppendUInt64BE(
    std::vector< uint8_t > & out,
    uint64_t value
)

Appends a 64-bit unsigned integer in big-endian order.

Parameters:

  • out The vector to append to
  • value the value to append

function ReadUInt32BE

inline uint32_t ReadUInt32BE(
    const uint8_t * data
)

Reads a 32-bit unsigned integer from big-endian bytes.

Parameters:

  • data A pointer to the byte array

Return: the 32 bit unsigned integer represented by the bytes

function ReadUInt64BE

inline uint64_t ReadUInt64BE(
    const uint8_t * data
)

Reads a 64-bit unsigned integer from big-endian bytes.

Parameters:

  • data A pointer to the byte array

Return: the 64 bit unsigned integer represented by the bytes

function HashLeaf

inline base::Hash256 HashLeaf(
    const std::vector< uint8_t > & payload
)

Hashes a serialized UTXO leaf payload with the leaf domain separator.

Parameters:

  • payload The payload to hash

Return: The hash of the payload as a leaf node in the Merkle tree

function HashNode

inline base::Hash256 HashNode(
    const base::Hash256 & left,
    const base::Hash256 & right
)

Hashes two child nodes with the internal-node domain separator.

Parameters:

  • left The hash of the left child node
  • right The hash of the right child node

Return: The hash of the parent node

function OutPointKey

inline std::string OutPointKey(
    const base::Hash256 & txid,
    uint32_t idx
)

Generates a canonical key for a UTXO outpoint, used for deterministic ordering in Merkle tree construction.

Parameters:

  • txid The transaction hash that created the UTXO
  • idx The output index of the UTXO within the transaction

Return: Canonical string key in the format "txid:idx" where txid is the readable hex representation of the transaction hash

function ReadUInt32BE

inline uint32_t ReadUInt32BE(
    const uint8_t * data
)

Reads a 32-bit unsigned integer from big-endian bytes.

Parameters:

  • data A pointer to the byte array

Return: the 32 bit unsigned integer represented by the bytes

function ReadUInt64BE

inline uint64_t ReadUInt64BE(
    const uint8_t * data
)

Reads a 64-bit unsigned integer from big-endian bytes.

Parameters:

  • data A pointer to the byte array

Return: the 64 bit unsigned integer represented by the bytes

function SerializeUTXOLeafPayload

inline std::vector< uint8_t > SerializeUTXOLeafPayload(
    const GeniusUTXO & utxo
)

Serializes a UTXO into the canonical leaf payload used for Merkle hashing.

Parameters:

  • utxo The UTXO to serialize

Return: The serialized leaf payload

Attributes Documentation

variable MAX_PUBSUB_TX_BYTES

static size_t MAX_PUBSUB_TX_BYTES = 64 * 1024;

variable NONCE_SUBJECT_TYPE

static std::string_view NONCE_SUBJECT_TYPE = "sgns.nonce.v1";

variable TASK_RESULT_SUBJECT_TYPE

static std::string_view TASK_RESULT_SUBJECT_TYPE = "sgns.task_result.v1";

variable REGISTRY_BATCH_SUBJECT_TYPE

static std::string_view REGISTRY_BATCH_SUBJECT_TYPE = "sgns.registry_batch.v1";

variable FILE_NAME

std::string_view FILE_NAME = "secure_storage.json";

variable HASH256_BYTES

size_t HASH256_BYTES;

variable SERIALIZED_UINT32_BYTES

size_t SERIALIZED_UINT32_BYTES;

Updated on 2026-06-05 at 17:22:18 -0700