Пример #1
0
 def bullet_proof_multisig_3(self, value: int, blind: SecretKey,
                             commit: Commitment, common_nonce: SecretKey,
                             nonce: SecretKey, t_1: PublicKey,
                             t_2: PublicKey, tau_x: SecretKey,
                             extra_data: bytearray) -> RangeProof:
     scratch = lib.secp256k1_scratch_space_create(self.ctx, 256 * MAX_WIDTH)
     proof_ptr = ffi.new("char []", MAX_PROOF_SIZE)
     proof_len_ptr = ffi.new("size_t *", MAX_PROOF_SIZE)
     tau_x_ptr = ffi.new("char []", bytes(tau_x.to_bytearray()))
     blind_key = ffi.new("char []", bytes(blind.key))
     res = lib.secp256k1_bulletproof_rangeproof_prove(
         self.ctx, scratch, self.gens, proof_ptr, proof_len_ptr, tau_x_ptr,
         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)
     obj = RangeProof.from_bytearray(
         bytearray(ffi.buffer(proof_ptr, proof_len_ptr[0])))
     lib.secp256k1_scratch_space_destroy(scratch)
     assert res, "Unable to generate multisig bulletproof"
     return obj
 def from_secret_key(key: SecretKey):
     return BlindingFactor.from_bytearray(key.to_bytearray())