87inline std::vector<ScalarBytes>
scalar_bytes(
const std::vector<FieldElement>& values) {
88 std::vector<ScalarBytes> out;
89 out.reserve(values.size());
138 [[nodiscard]] virtual std::shared_ptr<const
void> find_public_data_impl(
139 const std::array<
unsigned char, 32>& key) const = 0;
140 virtual
void insert_public_data_impl(std::array<
unsigned char, 32> key,
141 std::shared_ptr<const
void> value) = 0;
152 const std::array<unsigned char, 32>& key);
154 std::array<unsigned char, 32> key,
155 std::shared_ptr<const void> value);
158 std::span<const PointBytes> generators,
173 [[nodiscard]]
bool empty() const noexcept;
177 std::unique_ptr<
Impl> impl_;
179 [[nodiscard]] std::shared_ptr<const
void> find_public_data_impl(
180 const std::array<
unsigned char, 32>& key) const override;
181 void insert_public_data_impl(std::array<
unsigned char, 32> key,
182 std::shared_ptr<const
void> value) override;
201 [[nodiscard]] std::size_t
size() const noexcept;
213 std::span<const
PointBytes> generators) const;
215 [[nodiscard]] std::shared_ptr<const
void>
find_public_data(const std::array<
unsigned char, 32>& key) const;
217 void insert_public_data(std::array<
unsigned char, 32> key, std::shared_ptr<const
void> value);
225 std::unique_ptr<
Impl> impl_;
227 [[nodiscard]] std::shared_ptr<const
void> find_public_data_impl(
228 const std::array<
unsigned char, 32>& key) const override;
229 void insert_public_data_impl(std::array<
unsigned char, 32> key,
230 std::shared_ptr<const
void> value) override;
282 std::span<const unsigned char> statement_binding = {},
283 ExperimentalCircuitBackend* cache =
nullptr);
296 std::span<const unsigned char> statement_binding = {},
297 ExperimentalCircuitBackend* cache =
nullptr);
307Result<ExperimentalCircuitNormArgProof> prove_experimental_circuit_norm_arg_to_commitment(
308 const NativeBulletproofCircuit& circuit,
309 const BulletproofAssignmentData& assignment,
310 const PointBytes& witness_commitment,
312 std::span<const unsigned char> statement_binding = {},
313 ExperimentalCircuitBackend* cache =
nullptr);
323 const NativeBulletproofCircuit& circuit,
324 const ExperimentalCircuitNormArgProof& proof,
326 std::span<const unsigned char> statement_binding = {},
327 ExperimentalCircuitBackend* cache =
nullptr);
344 const NativeBulletproofCircuit& circuit,
345 const BulletproofAssignmentData& assignment,
346 const ScalarBytes& nonce,
348 std::span<const unsigned char> statement_binding = {},
349 ExperimentalCircuitBackend* cache =
nullptr);
359 const NativeBulletproofCircuit& circuit,
360 const ExperimentalCircuitZkNormArgProof& proof,
362 std::span<const unsigned char> statement_binding = {},
363 ExperimentalCircuitBackend* cache =
nullptr);
373 const NativeBulletproofCircuit& circuit,
374 const BulletproofAssignmentData& assignment,
375 const ScalarBytes& nonce,
376 std::span<const PointBytes> public_commitments,
378 std::span<const unsigned char> statement_binding = {},
379 ExperimentalCircuitBackend* cache =
nullptr);
388 const NativeBulletproofCircuit& circuit,
389 const ExperimentalCircuitZkNormArgProof& proof,
390 std::span<const PointBytes> public_commitments,
392 std::span<const unsigned char> statement_binding = {},
393 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.
std::array< unsigned char, 32 > to_bytes_be() const
Serializes the field element in big-endian form.
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_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< PointBytes > commit_norm_arg(const NormArgInputs &inputs, purify_secp_context *secp_context)
Computes the public BPPP commitment for a standalone norm-argument input bundle.
Result< bool > 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.
GeneratorBytes base_generator(purify_secp_context *secp_context)
Returns the serialized secp256k1 base generator used as the blind generator.
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.
bool verify_norm_arg(const NormArgProof &proof, purify_secp_context *secp_context)
Verifies a standalone BPPP norm argument.
Result< ExperimentalCircuitZkNormArgProof > 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.
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.
Result< ExperimentalCircuitZkNormArgProof > 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.
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.
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
Experimental masked circuit proof that hides the reduced witness before the final BPPP argument.
PointBytes a_commitment
Witness-only outer A commitment; verifiers re-anchor it to the public statement.
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)