BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
Classes | Public Member Functions | List of all members
graphene::app::crypto_api Class Reference

The crypto_api class allows computations related to blinded transfers. More...

#include <api.hpp>

Classes

struct  verify_range_proof_rewind_result
 
struct  verify_range_result
 

Public Member Functions

fc::ecc::commitment_type blind (const fc::ecc::blind_factor_type &blind, uint64_t value) const
 Generates a pedersen commitment: *commit = blind * G + value * G2. The commitment is 33 bytes, the blinding factor is 32 bytes. For more information about pederson commitment check url https://en.wikipedia.org/wiki/Commitment_scheme. More...
 
fc::ecc::blind_factor_type blind_sum (const std::vector< blind_factor_type > &blinds_in, uint32_t non_neg) const
 Get sha-256 blind factor type. More...
 
bool verify_sum (const std::vector< commitment_type > &commits_in, const std::vector< commitment_type > &neg_commits_in, int64_t excess) const
 Verifies that commits + neg_commits + excess == 0. More...
 
verify_range_result verify_range (const fc::ecc::commitment_type &commit, const std::vector< char > &proof) const
 Verifies range proof for 33-byte pedersen commitment. More...
 
std::vector< char > range_proof_sign (uint64_t min_value, const commitment_type &commit, const blind_factor_type &commit_blind, const blind_factor_type &nonce, int8_t base10_exp, uint8_t min_bits, uint64_t actual_value) const
 Proves with respect to min_value the range for pedersen commitment which has the provided blinding factor and value. More...
 
verify_range_proof_rewind_result verify_range_proof_rewind (const blind_factor_type &nonce, const fc::ecc::commitment_type &commit, const std::vector< char > &proof) const
 Verifies range proof rewind for 33-byte pedersen commitment. More...
 
fc::ecc::range_proof_info range_get_info (const std::vector< char > &proof) const
 Gets "range proof" info. The cli_wallet includes functionality for sending blind transfers in which the values of the input and outputs amounts are “blinded.” In the case where a transaction produces two or more outputs, (e.g. an amount to the intended recipient plus “change” back to the sender), a "range proof" must be supplied to prove that none of the outputs commit to a negative value. More...
 

Detailed Description

The crypto_api class allows computations related to blinded transfers.

Definition at line 439 of file api.hpp.

Member Function Documentation

◆ blind()

fc::ecc::commitment_type graphene::app::crypto_api::blind ( const fc::ecc::blind_factor_type blind,
uint64_t  value 
) const

Generates a pedersen commitment: *commit = blind * G + value * G2. The commitment is 33 bytes, the blinding factor is 32 bytes. For more information about pederson commitment check url https://en.wikipedia.org/wiki/Commitment_scheme.

Parameters
blindSha-256 blind factor type
valuePositive 64-bit integer value
Returns
A 33-byte pedersen commitment: *commit = blind * G + value * G2

Definition at line 825 of file api.cpp.

◆ blind_sum()

fc::ecc::blind_factor_type graphene::app::crypto_api::blind_sum ( const std::vector< blind_factor_type > &  blinds_in,
uint32_t  non_neg 
) const

Get sha-256 blind factor type.

Parameters
blinds_inList of sha-256 blind factor types
non_neg32-bit integer value
Returns
A blind factor type

Definition at line 830 of file api.cpp.

◆ range_get_info()

fc::ecc::range_proof_info graphene::app::crypto_api::range_get_info ( const std::vector< char > &  proof) const

Gets "range proof" info. The cli_wallet includes functionality for sending blind transfers in which the values of the input and outputs amounts are “blinded.” In the case where a transaction produces two or more outputs, (e.g. an amount to the intended recipient plus “change” back to the sender), a "range proof" must be supplied to prove that none of the outputs commit to a negative value.

Parameters
proofList of proof's characters
Returns
A range proof info structure with exponent, mantissa, min and max values

Definition at line 879 of file api.cpp.

◆ range_proof_sign()

std::vector< char > graphene::app::crypto_api::range_proof_sign ( uint64_t  min_value,
const commitment_type &  commit,
const blind_factor_type &  commit_blind,
const blind_factor_type &  nonce,
int8_t  base10_exp,
uint8_t  min_bits,
uint64_t  actual_value 
) const

Proves with respect to min_value the range for pedersen commitment which has the provided blinding factor and value.

Parameters
min_valuePositive 64-bit integer value
commit33-byte pedersen commitment
commit_blindSha-256 blind factor type for the correct digits
nonceSha-256 blind factor type for our non-forged signatures
base10_expExponents base 10 in range [-1 ; 18] inclusively
min_bits8-bit positive integer, must be in range [0 ; 64] inclusively
actual_value64-bit positive integer, must be greater or equal min_value
Returns
A list of characters as proof in proof

Definition at line 851 of file api.cpp.

◆ verify_range()

crypto_api::verify_range_result graphene::app::crypto_api::verify_range ( const fc::ecc::commitment_type commit,
const std::vector< char > &  proof 
) const

Verifies range proof for 33-byte pedersen commitment.

Parameters
commit33-byte pedersen commitment
proofList of characters
Returns
A structure with success, min and max values

Definition at line 843 of file api.cpp.

◆ verify_range_proof_rewind()

crypto_api::verify_range_proof_rewind_result graphene::app::crypto_api::verify_range_proof_rewind ( const blind_factor_type &  nonce,
const fc::ecc::commitment_type commit,
const std::vector< char > &  proof 
) const

Verifies range proof rewind for 33-byte pedersen commitment.

Parameters
nonceSha-256 blind refactor type
commit33-byte pedersen commitment
proofList of characters
Returns
A structure with success, min, max, value_out, blind_out and message_out values

Definition at line 862 of file api.cpp.

◆ verify_sum()

bool graphene::app::crypto_api::verify_sum ( const std::vector< commitment_type > &  commits_in,
const std::vector< commitment_type > &  neg_commits_in,
int64_t  excess 
) const

Verifies that commits + neg_commits + excess == 0.

Parameters
commits_inList of 33-byte pedersen commitments
neg_commits_inList of 33-byte pedersen commitments
excessSum of two list of 33-byte pedersen commitments where sums the first set and subtracts the second
Returns
Boolean - true in event of commits + neg_commits + excess == 0, otherwise false

Definition at line 836 of file api.cpp.


The documentation for this class was generated from the following files: