91 std::span<const FieldElement> values) {
92 std::vector<ScalarBytes> out(values.size());
93 for (std::size_t i = 0; i < values.size(); ++i) {
143 [[nodiscard]] virtual std::shared_ptr<const
void> find_public_data_impl(
144 const std::array<
unsigned char, 32>& key) const = 0;
145 virtual
void insert_public_data_impl(std::array<
unsigned char, 32> key,
146 std::shared_ptr<const
void> value) = 0;
157 const std::array<unsigned char, 32>& key);
159 std::array<unsigned char, 32> key,
160 std::shared_ptr<const void> value);
163 std::span<const PointBytes> generators,
178 [[nodiscard]]
bool empty() const noexcept;
182 std::unique_ptr<
Impl> impl_;
184 [[nodiscard]] std::shared_ptr<const
void> find_public_data_impl(
185 const std::array<
unsigned char, 32>& key) const override;
186 void insert_public_data_impl(std::array<
unsigned char, 32> key,
187 std::shared_ptr<const
void> value) override;
206 [[nodiscard]] std::size_t
size() const noexcept;
218 std::span<const
PointBytes> generators) const;
220 [[nodiscard]] std::shared_ptr<const
void>
find_public_data(const std::array<
unsigned char, 32>& key) const;
222 void insert_public_data(std::array<
unsigned char, 32> key, std::shared_ptr<const
void> value);
230 std::unique_ptr<
Impl> impl_;
232 [[nodiscard]] std::shared_ptr<const
void> find_public_data_impl(
233 const std::array<
unsigned char, 32>& key) const override;
234 void insert_public_data_impl(std::array<
unsigned char, 32> key,
235 std::shared_ptr<const
void> value) override;
303 std::span<const unsigned char> statement_binding = {},
304 ExperimentalCircuitBackend* cache =
nullptr);
317 const PointBytes& witness_commitment,
319 std::span<const unsigned char> statement_binding = {},
320 ExperimentalCircuitBackend* cache =
nullptr);
329Result<bool> verify_experimental_circuit_norm_arg(
330 const NativeBulletproofCircuit& circuit,
331 const ExperimentalCircuitNormArgProof& proof,
333 std::span<const unsigned char> statement_binding = {},
334 ExperimentalCircuitBackend* cache =
nullptr);
359 const NativeBulletproofCircuit& circuit,
360 const BulletproofAssignmentData& assignment,
361 const ScalarBytes& secret_prover_seed,
363 std::span<const unsigned char> statement_binding = {},
364 ExperimentalCircuitBackend* cache =
nullptr);
374 const NativeBulletproofCircuit& circuit,
375 const ExperimentalCircuitZkNormArgProof& proof,
377 std::span<const unsigned char> statement_binding = {},
378 ExperimentalCircuitBackend* cache =
nullptr);
396 const NativeBulletproofCircuit& circuit,
397 const BulletproofAssignmentData& assignment,
398 const ScalarBytes& secret_prover_seed,
399 std::span<const PointBytes> public_commitments,
401 std::span<const unsigned char> statement_binding = {},
402 ExperimentalCircuitBackend* cache =
nullptr);
414 const NativeBulletproofCircuit& circuit,
415 const ExperimentalCircuitZkNormArgProof& proof,
416 std::span<const PointBytes> public_commitments,
418 std::span<const unsigned char> statement_binding = {},
419 ExperimentalCircuitBackend* cache =
nullptr);
High-level Purify key generation, evaluation, witness generation, and circuit helpers.
Field element modulo the backend scalar field used by this implementation.
Move-only packed Purify secret stored in dedicated heap memory.
Common interface for reusable experimental BPPP backend state.
ExperimentalCircuitBackend(const ExperimentalCircuitBackend &)=delete
ExperimentalCircuitBackend & operator=(const ExperimentalCircuitBackend &)=delete
ExperimentalCircuitBackend(ExperimentalCircuitBackend &&) noexcept=default
friend struct detail::ExperimentalCircuitBackendAccess
Thread-local clone of one warmed experimental BPPP backend-resource line.
bool empty() const noexcept
ExperimentalCircuitCacheLine & operator=(const ExperimentalCircuitCacheLine &)=delete
~ExperimentalCircuitCacheLine() override
ExperimentalCircuitCacheLine(const ExperimentalCircuitCacheLine &)=delete
ExperimentalCircuitCacheLine & operator=(ExperimentalCircuitCacheLine &&other) noexcept
friend class ExperimentalCircuitCache
ExperimentalCircuitCacheLine(ExperimentalCircuitCacheLine &&other) noexcept
ExperimentalCircuitCacheLine()
ExperimentalCircuitCache & operator=(const ExperimentalCircuitCache &)=delete
ExperimentalCircuitCache(ExperimentalCircuitCache &&other) noexcept
Result< ExperimentalCircuitCacheLine > clone_line_for_thread(std::span< const PointBytes > generators) const
Clones one warmed backend-resource line for thread-local use.
ExperimentalCircuitCache()
std::shared_ptr< const void > find_public_data(const std::array< unsigned char, 32 > &key) const
Looks up opaque cached reduction data by digest key.
void insert_public_data(std::array< unsigned char, 32 > key, std::shared_ptr< const void > value)
Stores opaque cached reduction data by digest key.
purify_bppp_backend_resources * get_or_create_backend_resources(std::span< const PointBytes > generators, purify_secp_context *secp_context)
Returns cached backend resources for this generator set, creating them on first use.
ExperimentalCircuitCache & operator=(ExperimentalCircuitCache &&other) noexcept
std::size_t size() const noexcept
ExperimentalCircuitCache(const ExperimentalCircuitCache &)=delete
~ExperimentalCircuitCache()
Internal access helpers for experimental BPPP backend implementations.
Result< NormArgProof > 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.
Result< PointBytes > commit_norm_arg(const NormArgInputs &inputs, purify_secp_context *secp_context)
Computes the public BPPP commitment for a standalone norm-argument input bundle.
GeneratorBytes base_generator(purify_secp_context *secp_context)
Returns the serialized secp256k1 base generator used as the blind generator.
Result< PointBytes > commit_experimental_circuit_witness(const NativeBulletproofCircuit &circuit, const BulletproofAssignmentData &assignment, purify_secp_context *secp_context, ExperimentalCircuitBackend *cache=nullptr)
Commits to raw circuit coordinates before reduction challenges exist.
Result< bool > 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< ExperimentalCircuitZkNormArgProof > prove_experimental_circuit_zk_norm_arg(const NativeBulletproofCircuit &circuit, const BulletproofAssignmentData &assignment, const ScalarBytes &secret_prover_seed, 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< ExperimentalCircuitZkNormArgProof > prove_experimental_circuit_zk_norm_arg_with_public_commitments(const NativeBulletproofCircuit &circuit, const BulletproofAssignmentData &assignment, const ScalarBytes &secret_prover_seed, 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.
bool verify_norm_arg(const NormArgProof &proof, purify_secp_context *secp_context)
Verifies a standalone BPPP norm argument.
Result< ExperimentalCircuitNormArgProof > 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.
GeneratorBytes value_generator_h(purify_secp_context *secp_context)
Returns the serialized alternate generator used for committed values.
Result< CommittedPurifyWitness > 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< NormArgProof > prove_norm_arg(const NormArgInputs &inputs, purify_secp_context *secp_context)
Produces a standalone BPPP norm argument.
Result< std::vector< PointBytes > > create_generators(std::size_t count, purify_secp_context *secp_context)
Expands the BPPP generator list.
std::array< unsigned char, 33 > PointBytes
Compressed 33-byte curve-point encoding.
Result< bool > 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.
std::array< unsigned char, 33 > GeneratorBytes
Serialized generator encoding used by the BPPP bridge.
Result< PointBytes > 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...
ScalarBytes scalar_bytes(const FieldElement &value)
Serializes a Purify field element into the scalar encoding expected by the BPPP bridge.
std::array< unsigned char, 32 > ScalarBytes
Big-endian 32-byte scalar encoding.
BigUInt< 8 > UInt512
512-bit unsigned integer used for private and packed public keys.
Expected< T, Error > Result
Expected-returning convenience alias for Purify value-producing APIs.
std::vector< unsigned char > Bytes
Dynamically sized byte string used for messages, serialized witnesses, and proofs.
void purify_scalar_get_b32(unsigned char output32[32], const purify_scalar *value)
Serializes a scalar as 32 big-endian bytes.
struct purify_secp_context purify_secp_context
Caller-owned reusable secp256k1 context handle shared across Purify C and C++ APIs.
Columnar witness assignment compatible with the native Bulletproof circuit layout.
Native in-memory representation of a Bulletproof-style arithmetic circuit.
Purify witness bundle together with a Pedersen commitment to the output.
BulletproofAssignmentData assignment
Experimental transparent circuit proof backed by the standalone BPPP norm argument.
PointBytes witness_commitment
Masked circuit proof with a pre-challenge raw-coordinate commitment.
std::array< unsigned char, 32 > public_commitment_dlog_nonce
Even-Y Schnorr nonce x-coordinate for the batched public-commitment DLog proof.
PointBytes a_commitment
Raw-coordinate commitment made before reduction challenges.
ScalarBytes public_commitment_dlog_response
Schnorr response for the batched public-commitment DLog proof.
Standalone BPPP norm-argument proof bundle with all verifier-side inputs.
std::vector< PointBytes > generators
std::vector< ScalarBytes > c_vec
PointBytes commitment
Finite compressed initial point; infinity is not accepted.
static purify_bppp_backend_resources * get_or_create_backend_resources(ExperimentalCircuitBackend *backend, std::span< const PointBytes > generators, purify_secp_context *secp_context)
static std::shared_ptr< const void > find_public_data(const ExperimentalCircuitBackend *backend, const std::array< unsigned char, 32 > &key)
static void insert_public_data(ExperimentalCircuitBackend *backend, std::array< unsigned char, 32 > key, std::shared_ptr< const void > value)
static const purify_scalar & raw(const FieldElement &value) noexcept