Skip to content

sgns::RecursiveTransferProof

A class for generating a recursive Transfer Proof. More...

#include <RecursiveTransferProof.hpp>

Inherits from sgns::TransferProof, sgns::IBasicProof

Public Functions

Name
RecursiveTransferProof(uint64_t balance, uint64_t amount, GeniusProver::ProofSnarkType snark)
Constructor for the RecursiveTransferProof class.
~RecursiveTransferProof() =default
Destructor for the RecursiveTransferProof class.
virtual std::string GetProofType() const override
Retrieves the type of proof for recursive transfers.

Protected Functions

Name
virtual outcome::result< std::vector< uint8_t > > SerializeFullProof(const SGProof::BaseProofData & base_proof_data) override
Serializes the full proof data and parameters.
virtual std::pair< boost::json::array, boost::json::array > GenerateJsonParameters() override
Generates the parameters in JSON array form.

Additional inherited members

Public Functions inherited from sgns::TransferProof

Name
TransferProof(uint64_t balance, uint64_t amount, std::optional< std::string > bytecode =std::nullopt)
Constructor for the TransferProof class.
~TransferProof() =default
Destructor for the TransferProof class.
boost::json::object GenerateCurveParameter(pallas::template g1_type< coordinates::affine >::value_type value)
template <typename T >
boost::json::object
GenerateCurveParameter(T value)
Generates a JSON object for a curve parameter.

Protected Attributes inherited from sgns::TransferProof

Name
uint64_t generator_X_point
X coordinate of the generator point.
uint64_t generator_Y_point
Y coordinate of the generator point.
uint64_t base_seed
Base seed.
uint64_t provided_totp
Provided TOTP.
std::array< uint64_t, 4 > ranges
Array of range values used in transfer proofs.

Public Types inherited from sgns::IBasicProof

Name
enum class Error { INSUFFICIENT_FUNDS, INVALID_PROOF, BYTECODE_NOT_FOUND, INVALID_CIRCUIT, INVALID_PROTO_PROOF, INVALID_PROOF_TYPE, UNEXPECTED_PROOF_TYPE, INVALID_PUBLIC_PARAMETERS}
Enumeration of error codes used in the proof classes.
using std::function< outcome::result< std::pair< boost::json::array, boost::json::array > >(const std::vector< uint8_t > &)> PublicParamDeserializeFn
Alias for the de-serializer method type to be implemented in derived classes.

Public Functions inherited from sgns::IBasicProof

Name
IBasicProof(std::string bytecode_payload)
Constructs a proof and informs the bytecode that will be used.
virtual ~IBasicProof() =default
Virtual destructor for IBasicProof.
outcome::result< std::vector< uint8_t > > GenerateFullProof()
Generates a full proof using the internal class values.
outcome::result< bool > VerifyFullProof(const std::vector< uint8_t > & full_proof_data)
Verifies the proof with the public parameters.
outcome::result< bool > VerifyFullProof(const std::pair< boost::json::array, boost::json::array > & parameters, const SGProof::BaseProofData & proof_data, std::string proof_bytecode)
Verifies the proof with parameters and bytecode.
boost::json::object GenerateIntParameter(uint64_t value)
Generates a JSON object for an integer parameter.
template <std::size_t N>
boost::json::object
GenerateArrayParameter(const std::array< uint64_t, N > & values)
Generates a JSON object for an array parameter.
boost::json::object GenerateFieldParameter(uint64_t value)
Generates a JSON object for a field parameter.

Protected Functions inherited from sgns::IBasicProof

Name
void RegisterDeserializer(const std::string & proof_type, PublicParamDeserializeFn fn)
Registers a deserializer function for a specific proof type.
void RegisterBytecode(const std::string & proof_type, std::string bytecode)
Registers a bytecode for a specific proof type.
outcome::result< SGProof::BaseProofProto > DeSerializeBaseProof(const std::vector< uint8_t > & proof_data)
Deserializes a BaseProofProto from the provided proof data.

Protected Attributes inherited from sgns::IBasicProof

Name
std::map< std::string, PublicParamDeserializeFn > PublicParamDeSerializers
A map of deserialization functions for public parameters by proof type.
std::map< std::string, std::string > ByteCodeMap
A map of bytecodes associated with each proof type.

Detailed Description

class sgns::RecursiveTransferProof;

A class for generating a recursive Transfer Proof.

         RecursiveTransferProof is a derived class from IBasicProof, providing the specific
         implementation for generating the parameters to create a recursive snark

Public Functions Documentation

function RecursiveTransferProof

explicit RecursiveTransferProof(
    uint64_t balance,
    uint64_t amount,
    GeniusProver::ProofSnarkType snark
)

Constructor for the RecursiveTransferProof class.

Parameters:

  • balance The balance of the account for the transfer.
  • amount The amount to be transferred.
  • snark The inner proof to be recursively wrapped.

function ~RecursiveTransferProof

~RecursiveTransferProof() =default

Destructor for the RecursiveTransferProof class.

function GetProofType

inline virtual std::string GetProofType() const override

Retrieves the type of proof for recursive transfers.

Return: A string representing the type of the proof.

Reimplements: sgns::IBasicProof::GetProofType

Protected Functions Documentation

function SerializeFullProof

virtual outcome::result< std::vector< uint8_t > > SerializeFullProof(
    const SGProof::BaseProofData & base_proof_data
) override

Serializes the full proof data and parameters.

Parameters:

  • base_proof_data The base proof data to be appended to the public parameters

Return: A result containing the serialized full proof in bytes.

Reimplements: sgns::IBasicProof::SerializeFullProof

function GenerateJsonParameters

virtual std::pair< boost::json::array, boost::json::array > GenerateJsonParameters() override

Generates the parameters in JSON array form.

Return: A pair of public and private JSON arrays, respectively.

Reimplements: sgns::IBasicProof::GenerateJsonParameters


Updated on 2026-03-04 at 13:10:43 -0800