Exemple #1
0
 def to_public_key(self, secp) -> PublicKey:
     assert isinstance(secp, Secp256k1)
     obj = PublicKey(secp)
     res = lib.secp256k1_pedersen_commitment_to_pubkey(
         secp.ctx, obj.key, self.commitment)
     assert res, "Unable to convert to public key"
     return obj
Exemple #2
0
 def bullet_proof_multisig_1(
         self, value: int, blind: SecretKey, commit: Commitment,
         common_nonce: SecretKey, nonce: SecretKey,
         extra_data: bytearray) -> (PublicKey, PublicKey):
     scratch = lib.secp256k1_scratch_space_create(self.ctx, 256 * MAX_WIDTH)
     t_1 = PublicKey(self)
     t_2 = PublicKey(self)
     blind_key = ffi.new("char []", bytes(blind.key))
     res = lib.secp256k1_bulletproof_rangeproof_prove(
         self.ctx, scratch, self.gens, ffi.NULL, ffi.NULL, ffi.NULL,
         t_1.key, t_2.key, [value], ffi.NULL, [blind_key],
         [commit.commitment], 1, self.GENERATOR_H, 64,
         bytes(common_nonce.key), bytes(nonce.key), bytes(extra_data),
         len(extra_data), ffi.NULL)
     lib.secp256k1_scratch_space_destroy(scratch)
     assert res, "Unable to generate multisig bulletproof"
     return t_1, t_2