15 const secp256k1_context* ctx,
16 unsigned char* privkey,
17 secp256k1_pubkey* pubkey
24 const secp256k1_context* ctx,
27 const secp256k1_pubkey* pubkey_Q,
29 const unsigned char* blinding_factor
36 const secp256k1_context* ctx,
38 const secp256k1_pubkey* c1,
39 const secp256k1_pubkey* c2,
40 const unsigned char* privkey
47 const secp256k1_context* ctx,
48 secp256k1_pubkey* sum_c1,
49 secp256k1_pubkey* sum_c2,
50 const secp256k1_pubkey* a_c1,
51 const secp256k1_pubkey* a_c2,
52 const secp256k1_pubkey* b_c1,
53 const secp256k1_pubkey* b_c2
60 const secp256k1_context* ctx,
61 secp256k1_pubkey* diff_c1,
62 secp256k1_pubkey* diff_c2,
63 const secp256k1_pubkey* a_c1,
64 const secp256k1_pubkey* a_c2,
65 const secp256k1_pubkey* b_c1,
66 const secp256k1_pubkey* b_c2
86 const secp256k1_context* ctx,
87 secp256k1_pubkey* enc_zero_c1,
88 secp256k1_pubkey* enc_zero_c2,
89 const secp256k1_pubkey* pubkey,
90 const unsigned char* account_id,
91 const unsigned char* mpt_issuance_id
123 const secp256k1_context* ctx,
124 unsigned char* proof,
125 const secp256k1_pubkey* c1,
126 const secp256k1_pubkey* c2,
127 const secp256k1_pubkey* pk_recipient,
129 const unsigned char* randomness_r,
130 const unsigned char* tx_context_id
151 const secp256k1_context* ctx,
152 const unsigned char* proof,
153 const secp256k1_pubkey* c1,
154 const secp256k1_pubkey* c2,
155 const secp256k1_pubkey* pk_recipient,
157 const unsigned char* tx_context_id
187 const secp256k1_context* ctx,
188 unsigned char* proof_out,
189 const secp256k1_pubkey* R1,
const secp256k1_pubkey* S1,
const secp256k1_pubkey* P1,
190 const secp256k1_pubkey* R2,
const secp256k1_pubkey* S2,
const secp256k1_pubkey* P2,
192 const unsigned char* randomness_r1,
193 const unsigned char* randomness_r2,
194 const unsigned char* tx_context_id
209 const secp256k1_context* ctx,
210 const unsigned char* proof,
211 const secp256k1_pubkey* R1,
const secp256k1_pubkey* S1,
const secp256k1_pubkey* P1,
212 const secp256k1_pubkey* R2,
const secp256k1_pubkey* S2,
const secp256k1_pubkey* P2,
213 const unsigned char* tx_context_id
240 const secp256k1_context* ctx,
241 unsigned char* proof_out,
244 size_t n_ciphertexts,
245 const secp256k1_pubkey* R_array,
246 const secp256k1_pubkey* S_array,
247 const secp256k1_pubkey* Pk_array,
248 const unsigned char* r_array,
249 const unsigned char* tx_context_id
256 const secp256k1_context* ctx,
257 const unsigned char* proof,
259 size_t n_ciphertexts,
260 const secp256k1_pubkey* R_array,
261 const secp256k1_pubkey* S_array,
262 const secp256k1_pubkey* Pk_array,
263 const unsigned char* tx_context_id
282 const secp256k1_context* ctx,
283 secp256k1_pubkey* commitment_C,
285 const unsigned char* blinding_factor,
286 const secp256k1_pubkey* pk_base
291 const secp256k1_context* ctx,
292 unsigned char* proof_out,
295 const unsigned char* blinding_factor,
296 const secp256k1_pubkey* pk_base,
297 const unsigned char* context_id,
298 unsigned int proof_type
303 const secp256k1_context* ctx,
304 const secp256k1_pubkey* G_vec,
305 const secp256k1_pubkey* H_vec,
306 const unsigned char* proof,
308 const secp256k1_pubkey* commitment_C,
309 const secp256k1_pubkey* pk_base,
310 const unsigned char* context_id
329 const secp256k1_context* ctx,
330 unsigned char* proof,
331 const secp256k1_pubkey* c1,
332 const secp256k1_pubkey* c2,
333 const secp256k1_pubkey* pk,
334 const secp256k1_pubkey* pcm,
336 const unsigned char* r,
337 const unsigned char* rho,
338 const unsigned char* context_id);
345 const secp256k1_context* ctx,
346 const unsigned char* proof,
347 const secp256k1_pubkey* c1,
348 const secp256k1_pubkey* c2,
349 const secp256k1_pubkey* pk,
350 const secp256k1_pubkey* pcm,
351 const unsigned char* context_id);
358 const secp256k1_context* ctx,
359 const secp256k1_pubkey* c1,
360 const secp256k1_pubkey* c2,
361 const secp256k1_pubkey* pubkey_Q,
363 const unsigned char* blinding_factor
368 const secp256k1_context* ctx,
369 unsigned char* proof,
370 const secp256k1_pubkey* pk,
371 const unsigned char* sk,
372 const unsigned char* context_id
376 const secp256k1_context* ctx,
377 const unsigned char* proof,
378 const secp256k1_pubkey* pk,
379 const unsigned char* context_id
387 const secp256k1_context* ctx,
388 secp256k1_pubkey* commitment,
390 const unsigned char* blinding_factor_rho
400 const secp256k1_context* ctx,
401 secp256k1_pubkey* vec,
403 const unsigned char* label,
425 const secp256k1_context* ctx,
426 unsigned char* proof_out,
428 const unsigned char* r_shared,
430 const secp256k1_pubkey* C1,
431 const secp256k1_pubkey* C2_vec,
432 const secp256k1_pubkey* Pk_vec,
433 const unsigned char* context_id
440 const secp256k1_context* ctx,
441 const unsigned char* proof,
443 const secp256k1_pubkey* C1,
444 const secp256k1_pubkey* C2_vec,
445 const secp256k1_pubkey* Pk_vec,
446 const unsigned char* context_id
450 const secp256k1_context* ctx,
451 unsigned char* proof_out,
453 const uint64_t* values,
454 const unsigned char* blindings_flat,
456 const secp256k1_pubkey* pk_base,
457 const unsigned char* context_id
460 const secp256k1_context* ctx,
461 const secp256k1_pubkey* G_vec,
462 const secp256k1_pubkey* H_vec,
463 const unsigned char* proof,
465 const secp256k1_pubkey* commitment_C_vec,
467 const secp256k1_pubkey* pk_base,
468 const unsigned char* context_id
SECP256K1_API int secp256k1_elgamal_generate_keypair(const secp256k1_context *ctx, unsigned char *privkey, secp256k1_pubkey *pubkey)
Generates a new secp256k1 key pair.
size_t secp256k1_mpt_proof_equality_shared_r_size(size_t n)
int secp256k1_bulletproof_verify_agg(const secp256k1_context *ctx, const secp256k1_pubkey *G_vec, const secp256k1_pubkey *H_vec, const unsigned char *proof, size_t proof_len, const secp256k1_pubkey *commitment_C_vec, size_t m, const secp256k1_pubkey *pk_base, const unsigned char *context_id)
int secp256k1_elgamal_verify_encryption(const secp256k1_context *ctx, const secp256k1_pubkey *c1, const secp256k1_pubkey *c2, const secp256k1_pubkey *pubkey_Q, uint64_t amount, const unsigned char *blinding_factor)
void secp256k1_mpt_scalar_negate(unsigned char *res, const unsigned char *in)
int secp256k1_bulletproof_verify(const secp256k1_context *ctx, const secp256k1_pubkey *G_vec, const secp256k1_pubkey *H_vec, const unsigned char *proof, size_t proof_len, const secp256k1_pubkey *commitment_C, const secp256k1_pubkey *pk_base, const unsigned char *context_id)
SECP256K1_API int secp256k1_equality_plaintext_prove(const secp256k1_context *ctx, unsigned char *proof, const secp256k1_pubkey *c1, const secp256k1_pubkey *c2, const secp256k1_pubkey *pk_recipient, uint64_t amount, const unsigned char *randomness_r, const unsigned char *tx_context_id)
Generates a proof that an ElGamal ciphertext correctly encrypts a known plaintext m and that the prov...
SECP256K1_API size_t secp256k1_mpt_prove_same_plaintext_multi_size(size_t n_ciphertexts)
Calculates the expected proof size for a given number of ciphertexts.
int secp256k1_mpt_pok_sk_prove(const secp256k1_context *ctx, unsigned char *proof, const secp256k1_pubkey *pk, const unsigned char *sk, const unsigned char *context_id)
SECP256K1_API int secp256k1_mpt_verify_same_plaintext_multi(const secp256k1_context *ctx, const unsigned char *proof, size_t proof_len, size_t n_ciphertexts, const secp256k1_pubkey *R_array, const secp256k1_pubkey *S_array, const secp256k1_pubkey *Pk_array, const unsigned char *tx_context_id)
Verifies a proof that N ciphertexts encrypt the same secret amount.
int secp256k1_mpt_get_generator_vector(const secp256k1_context *ctx, secp256k1_pubkey *vec, size_t n, const unsigned char *label, size_t label_len)
Generates a vector of N independent NUMS generators.
SECP256K1_API int secp256k1_elgamal_decrypt(const secp256k1_context *ctx, uint64_t *amount, const secp256k1_pubkey *c1, const secp256k1_pubkey *c2, const unsigned char *privkey)
Decrypts an ElGamal ciphertext to recover the amount.
int secp256k1_mpt_get_h_generator(const secp256k1_context *ctx, secp256k1_pubkey *h)
Derives the secondary base point (H) for Pedersen commitments.
int secp256k1_mpt_pedersen_commit(const secp256k1_context *ctx, secp256k1_pubkey *commitment, uint64_t amount, const unsigned char *blinding_factor_rho)
Creates a Pedersen Commitment C = amount*G + rho*H.
SECP256K1_API int generate_canonical_encrypted_zero(const secp256k1_context *ctx, secp256k1_pubkey *enc_zero_c1, secp256k1_pubkey *enc_zero_c2, const secp256k1_pubkey *pubkey, const unsigned char *account_id, const unsigned char *mpt_issuance_id)
Generates the canonical encrypted zero for a given MPT token instance.
void secp256k1_mpt_scalar_mul(unsigned char *res, const unsigned char *a, const unsigned char *b)
int secp256k1_mpt_pok_sk_verify(const secp256k1_context *ctx, const unsigned char *proof, const secp256k1_pubkey *pk, const unsigned char *context_id)
int secp256k1_bulletproof_prove_agg(const secp256k1_context *ctx, unsigned char *proof_out, size_t *proof_len, const uint64_t *values, const unsigned char *blindings_flat, size_t m, const secp256k1_pubkey *pk_base, const unsigned char *context_id)
SECP256K1_API int secp256k1_mpt_prove_same_plaintext_multi(const secp256k1_context *ctx, unsigned char *proof_out, size_t *proof_len, uint64_t amount_m, size_t n_ciphertexts, const secp256k1_pubkey *R_array, const secp256k1_pubkey *S_array, const secp256k1_pubkey *Pk_array, const unsigned char *r_array, const unsigned char *tx_context_id)
Generates a proof that N ciphertexts encrypt the same secret amount 'm'.
SECP256K1_API int secp256k1_elgamal_add(const secp256k1_context *ctx, secp256k1_pubkey *sum_c1, secp256k1_pubkey *sum_c2, const secp256k1_pubkey *a_c1, const secp256k1_pubkey *a_c2, const secp256k1_pubkey *b_c1, const secp256k1_pubkey *b_c2)
Homomorphically adds two ElGamal ciphertexts.
SECP256K1_API int secp256k1_mpt_prove_same_plaintext(const secp256k1_context *ctx, unsigned char *proof_out, const secp256k1_pubkey *R1, const secp256k1_pubkey *S1, const secp256k1_pubkey *P1, const secp256k1_pubkey *R2, const secp256k1_pubkey *S2, const secp256k1_pubkey *P2, uint64_t amount_m, const unsigned char *randomness_r1, const unsigned char *randomness_r2, const unsigned char *tx_context_id)
Generates a proof that two ciphertexts (under different keys) encrypt the same secret amount 'm'.
SECP256K1_API int secp256k1_elgamal_subtract(const secp256k1_context *ctx, secp256k1_pubkey *diff_c1, secp256k1_pubkey *diff_c2, const secp256k1_pubkey *a_c1, const secp256k1_pubkey *a_c2, const secp256k1_pubkey *b_c1, const secp256k1_pubkey *b_c2)
Homomorphically subtracts two ElGamal ciphertexts.
int secp256k1_mpt_prove_equality_shared_r(const secp256k1_context *ctx, unsigned char *proof_out, uint64_t amount, const unsigned char *r_shared, size_t n, const secp256k1_pubkey *C1, const secp256k1_pubkey *C2_vec, const secp256k1_pubkey *Pk_vec, const unsigned char *context_id)
void secp256k1_mpt_scalar_reduce32(unsigned char out32[32], const unsigned char in32[32])
SECP256K1_API int secp256k1_elgamal_encrypt(const secp256k1_context *ctx, secp256k1_pubkey *c1, secp256k1_pubkey *c2, const secp256k1_pubkey *pubkey_Q, uint64_t amount, const unsigned char *blinding_factor)
Encrypts a 64-bit amount using ElGamal.
SECP256K1_API int secp256k1_mpt_verify_same_plaintext(const secp256k1_context *ctx, const unsigned char *proof, const secp256k1_pubkey *R1, const secp256k1_pubkey *S1, const secp256k1_pubkey *P1, const secp256k1_pubkey *R2, const secp256k1_pubkey *S2, const secp256k1_pubkey *P2, const unsigned char *tx_context_id)
Verifies a proof that two ciphertexts encrypt the same secret amount.
void secp256k1_mpt_scalar_add(unsigned char *res, const unsigned char *a, const unsigned char *b)
SECP256K1_API int secp256k1_equality_plaintext_verify(const secp256k1_context *ctx, const unsigned char *proof, const secp256k1_pubkey *c1, const secp256k1_pubkey *c2, const secp256k1_pubkey *pk_recipient, uint64_t amount, const unsigned char *tx_context_id)
Verifies a proof of knowledge of plaintext and randomness.
int secp256k1_elgamal_pedersen_link_prove(const secp256k1_context *ctx, unsigned char *proof, const secp256k1_pubkey *c1, const secp256k1_pubkey *c2, const secp256k1_pubkey *pk, const secp256k1_pubkey *pcm, uint64_t amount, const unsigned char *r, const unsigned char *rho, const unsigned char *context_id)
Proves the link between an ElGamal ciphertext and a Pedersen commitment.
int secp256k1_bulletproof_prove(const secp256k1_context *ctx, unsigned char *proof_out, size_t *proof_len, uint64_t value, const unsigned char *blinding_factor, const secp256k1_pubkey *pk_base, const unsigned char *context_id, unsigned int proof_type)
int secp256k1_mpt_verify_equality_shared_r(const secp256k1_context *ctx, const unsigned char *proof, size_t n, const secp256k1_pubkey *C1, const secp256k1_pubkey *C2_vec, const secp256k1_pubkey *Pk_vec, const unsigned char *context_id)
int secp256k1_elgamal_pedersen_link_verify(const secp256k1_context *ctx, const unsigned char *proof, const secp256k1_pubkey *c1, const secp256k1_pubkey *c2, const secp256k1_pubkey *pk, const secp256k1_pubkey *pcm, const unsigned char *context_id)
Verifies the link proof between ElGamal and Pedersen commitments.
void secp256k1_mpt_scalar_inverse(unsigned char *res, const unsigned char *in)
SECP256K1_API int secp256k1_bulletproof_create_commitment(const secp256k1_context *ctx, secp256k1_pubkey *commitment_C, uint64_t value, const unsigned char *blinding_factor, const secp256k1_pubkey *pk_base)
Computes a Pedersen Commitment: C = value*G + blinding_factor*Pk_base.