sgns::TransferProof¶
A class for generating and verifying transfer proofs. More...
#include <TransferProof.hpp>
Inherits from sgns::IBasicProof
Inherited by sgns::RecursiveTransferProof
Public Functions¶
| 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. |
|
| virtual std::string | GetProofType() const override Retrieves the type of proof for transfers. |
| 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 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. |
Protected Attributes¶
| 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. |
Additional inherited members¶
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¶
A class for generating and verifying transfer proofs.
TransferProof is a derived class from IBasicProof, providing the specific
implementation for handling transfer of funds proof generation and verification.
Public Functions Documentation¶
function TransferProof¶
explicit TransferProof(
uint64_t balance,
uint64_t amount,
std::optional< std::string > bytecode =std::nullopt
)
Constructor for the TransferProof class.
Parameters:
- balance The balance of the account for the transfer.
- amount The amount to be transferred.
- bytecode Optional bytecode override for proof verification.
function ~TransferProof¶
Destructor for the TransferProof class.
function GetProofType¶
Retrieves the type of proof for transfers.
Return: A string representing the type of the proof.
Reimplements: sgns::IBasicProof::GetProofType
function GenerateCurveParameter¶
boost::json::object GenerateCurveParameter(
pallas::template g1_type< coordinates::affine >::value_type value
)
function GenerateCurveParameter¶
Generates a JSON object for a curve parameter.
Parameters:
- value The curve value to be converted to a JSON object.
Template Parameters:
- T The type of the curve parameter.
Return: A JSON object containing the curve parameter.
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¶
Generates the parameters in JSON array form.
Return: A pair of public and private JSON arrays, respectively.
Reimplements: sgns::IBasicProof::GenerateJsonParameters
Protected Attributes Documentation¶
variable generator_X_point¶
X coordinate of the generator point.
variable generator_Y_point¶
Y coordinate of the generator point.
variable base_seed¶
Base seed.
variable provided_totp¶
Provided TOTP.
variable ranges¶
Array of range values used in transfer proofs.
Updated on 2026-03-04 at 13:10:43 -0800