purify
C++ Purify implementation with native circuit and BPP support
Loading...
Searching...
No Matches
bppp.hpp File Reference

C++ wrappers for the BPPP functionality used by Purify. More...

#include <array>
#include <cstddef>
#include <memory>
#include <span>
#include <utility>
#include <vector>
#include "purify/api.hpp"

Go to the source code of this file.

Data Structures

struct  purify::bppp::NormArgInputs
 Inputs required to produce a standalone BPPP norm argument. More...
 
struct  purify::bppp::NormArgProof
 Standalone BPPP norm-argument proof bundle with all verifier-side inputs. More...
 
class  purify::bppp::ExperimentalCircuitBackend
 Common interface for reusable experimental BPPP backend state. More...
 
class  purify::bppp::ExperimentalCircuitCacheLine
 Thread-local clone of one warmed experimental BPPP backend-resource line. More...
 
class  purify::bppp::ExperimentalCircuitCache
 Caller-owned cache for reusable experimental circuit reduction and BPPP backend data. More...
 
struct  purify::bppp::ExperimentalCircuitNormArgProof
 Experimental transparent circuit proof backed by the standalone BPPP norm argument. More...
 
struct  purify::bppp::ExperimentalCircuitZkNormArgProof
 Experimental masked circuit proof that hides the reduced witness before the final BPPP argument. More...
 
struct  purify::bppp::CommittedPurifyWitness
 Purify witness bundle together with a Pedersen commitment to the output. More...
 

Namespaces

namespace  purify
 
namespace  purify::bppp
 
namespace  purify::bppp::detail
 Internal access helpers for experimental BPPP backend implementations.
 

Typedefs

using purify::bppp::ScalarBytes = std::array< unsigned char, 32 >
 Big-endian 32-byte scalar encoding.
 
using purify::bppp::PointBytes = std::array< unsigned char, 33 >
 Compressed 33-byte curve-point encoding.
 
using purify::bppp::GeneratorBytes = std::array< unsigned char, 33 >
 Serialized generator encoding used by the BPPP bridge.
 

Functions

GeneratorBytes purify::bppp::base_generator (purify_secp_context *secp_context)
 Returns the serialized secp256k1 base generator used as the blind generator.
 
GeneratorBytes purify::bppp::value_generator_h (purify_secp_context *secp_context)
 Returns the serialized alternate generator used for committed values.
 
Result< std::vector< PointBytes > > purify::bppp::create_generators (std::size_t count, purify_secp_context *secp_context)
 Expands the BPPP generator list.
 
Result< PointBytespurify::bppp::pedersen_commit_char (const ScalarBytes &blind, const ScalarBytes &value, purify_secp_context *secp_context)
 Computes a Pedersen commitment to an arbitrary 32-byte scalar value using Purify's default generators.
 
Result< PointBytespurify::bppp::pedersen_commit_char (const ScalarBytes &blind, const ScalarBytes &value, purify_secp_context *secp_context, const GeneratorBytes &value_gen, const GeneratorBytes &blind_gen)
 Computes a Pedersen commitment to an arbitrary 32-byte scalar value with explicit generators.
 
ScalarBytes purify::bppp::scalar_bytes (const FieldElement &value)
 Serializes a Purify field element into the scalar encoding expected by the BPPP bridge.
 
std::vector< ScalarBytespurify::bppp::scalar_bytes (const std::vector< FieldElement > &values)
 Serializes a vector of Purify field elements into BPPP scalar encodings.
 
Result< PointBytespurify::bppp::commit_norm_arg (const NormArgInputs &inputs, purify_secp_context *secp_context)
 Computes the public BPPP commitment for a standalone norm-argument input bundle.
 
Result< NormArgProofpurify::bppp::prove_norm_arg (const NormArgInputs &inputs, purify_secp_context *secp_context)
 Produces a standalone BPPP norm argument.
 
Result< NormArgProofpurify::bppp::prove_norm_arg (NormArgInputs &&inputs, purify_secp_context *secp_context)
 Produces a standalone BPPP norm argument, moving large inputs into the returned proof when possible.
 
Result< NormArgProofpurify::bppp::prove_norm_arg_to_commitment (const NormArgInputs &inputs, const PointBytes &commitment, purify_secp_context *secp_context)
 Produces a standalone BPPP norm argument anchored to a caller-supplied public commitment.
 
bool purify::bppp::verify_norm_arg (const NormArgProof &proof, purify_secp_context *secp_context)
 Verifies a standalone BPPP norm argument.
 
Result< PointBytespurify::bppp::commit_experimental_circuit_witness (const NativeBulletproofCircuit &circuit, const BulletproofAssignmentData &assignment, purify_secp_context *secp_context, std::span< const unsigned char > statement_binding={}, ExperimentalCircuitBackend *cache=nullptr)
 Commits to the reduced witness coordinates used by the experimental circuit-to-BPPP reduction.
 
Result< ExperimentalCircuitNormArgProofpurify::bppp::prove_experimental_circuit_norm_arg (const NativeBulletproofCircuit &circuit, const BulletproofAssignmentData &assignment, purify_secp_context *secp_context, std::span< const unsigned char > statement_binding={}, ExperimentalCircuitBackend *cache=nullptr)
 Produces an anchored transparent circuit proof using the experimental circuit-to-BPPP reduction.
 
Result< ExperimentalCircuitNormArgProofpurify::bppp::prove_experimental_circuit_norm_arg_to_commitment (const NativeBulletproofCircuit &circuit, const BulletproofAssignmentData &assignment, const PointBytes &witness_commitment, purify_secp_context *secp_context, std::span< const unsigned char > statement_binding={}, ExperimentalCircuitBackend *cache=nullptr)
 Produces an anchored transparent circuit proof against a caller-supplied reduced witness commitment.
 
Result< bool > purify::bppp::verify_experimental_circuit_norm_arg (const NativeBulletproofCircuit &circuit, const ExperimentalCircuitNormArgProof &proof, purify_secp_context *secp_context, std::span< const unsigned char > statement_binding={}, ExperimentalCircuitBackend *cache=nullptr)
 Verifies an experimental transparent circuit proof produced by prove_experimental_circuit_norm_arg.
 
Result< ExperimentalCircuitZkNormArgProofpurify::bppp::prove_experimental_circuit_zk_norm_arg (const NativeBulletproofCircuit &circuit, const BulletproofAssignmentData &assignment, const ScalarBytes &nonce, purify_secp_context *secp_context, std::span< const unsigned char > statement_binding={}, ExperimentalCircuitBackend *cache=nullptr)
 Produces an experimental masked circuit proof over the reduced BPPP relation.
 
Result< bool > purify::bppp::verify_experimental_circuit_zk_norm_arg (const NativeBulletproofCircuit &circuit, const ExperimentalCircuitZkNormArgProof &proof, purify_secp_context *secp_context, std::span< const unsigned char > statement_binding={}, ExperimentalCircuitBackend *cache=nullptr)
 Verifies an experimental masked circuit proof produced by prove_experimental_circuit_zk_norm_arg.
 
Result< ExperimentalCircuitZkNormArgProofpurify::bppp::prove_experimental_circuit_zk_norm_arg_with_public_commitments (const NativeBulletproofCircuit &circuit, const BulletproofAssignmentData &assignment, const ScalarBytes &nonce, std::span< const PointBytes > public_commitments, purify_secp_context *secp_context, std::span< const unsigned char > statement_binding={}, ExperimentalCircuitBackend *cache=nullptr)
 Produces an experimental masked circuit proof bound to explicit public commitment points.
 
Result< bool > purify::bppp::verify_experimental_circuit_zk_norm_arg_with_public_commitments (const NativeBulletproofCircuit &circuit, const ExperimentalCircuitZkNormArgProof &proof, std::span< const PointBytes > public_commitments, purify_secp_context *secp_context, std::span< const unsigned char > statement_binding={}, ExperimentalCircuitBackend *cache=nullptr)
 Verifies an experimental masked circuit proof against explicit public commitment points.
 
Result< CommittedPurifyWitnesspurify::bppp::commit_output_witness (const Bytes &message, const SecretKey &secret, const ScalarBytes &blind, purify_secp_context *secp_context)
 Evaluates Purify, derives its witness, and commits to the output using Purify's default generators.
 
Result< CommittedPurifyWitnesspurify::bppp::commit_output_witness (const Bytes &message, const SecretKey &secret, const ScalarBytes &blind, purify_secp_context *secp_context, const GeneratorBytes &value_gen, const GeneratorBytes &blind_gen)
 Evaluates Purify, derives its witness, and commits to the output with explicit generators.