Crypto API
The crypto API is available from the full node via websockets.

Blinding and Un-Blinding

blind

Get signed blocks.
Generates a Pedersen Commitment: *commit = blind * G + value * G2. The commitment is 33 bytes, the blinding factor is 32 bytes.
Tip: For more information about Pedersen Commitment see: Commitment Scheme
1
commitment_type graphene::app::crypto_api::blind(
2
const fc::ecc::blind_factor_type &blind,
3
uint64_t value)
Copied!
Parameters
Return
  • blind: Sha-256 blind factor type
  • value: Positive 64-bit integer value
A 33-byte Pedersen Commitment: commit = blind G + value * G2

blind_sum

Get SHA-256 blind factor type.
1
blind_factor_type graphene::app::crypto_api::blind_sum(
2
const std::vector<blind_factor_type> &blinds_in,
3
uint32_t non_neg)
Copied!
Parameters
Return
  • blinds_in: List of SHA-256 blind factor types
  • non_neg: 32-bit integer value
A blind factor type.

Range Proofs

range_get_info

Gets “range proof” information.
The cli_wallet includes functionality for sending blind transfers in which the values of the input and output amounts are “blinded.”
Note: In the case where a transaction produces two or more outputs, (e.g. an amount to the intended recipient plus “charge” back to the sender), a “range proof” must be supplied to prove that none of the outputs commit to a negative value.
1
range_proof_info graphene::app::crypto_api::range_get_info(
2
const std::vector<char> &proof)
Copied!
Parameters
Return
proof: List of proof’s characters
A range proof info structure with exponent, mantissa, min and max values.

range_proof_sign

Proves with respect to min_value the range for Pedersen Commitment which has the provided blinding factor and value.
1
std::vector<char> graphene::app::crypto_api::range_proof_sign(
2
uint64_t min_value,
3
const commitment_type &commit,
4
const blind_factor_type &commit_blind,
5
const blind_factor_type &nonce,
6
int8_t base10_exp,
7
uint8_t min_bits,
8
uint64_t actual_value
Copied!
Parameters
Return
  • min_value: Positive 64-bit integer value
  • commit: 33-byte pedersen commitment
  • commit_blind: Sha-256 blind factor type for the correct digits
  • nonce: Sha-256 blind factor type for our non-forged signatures
  • base10_exp: Exponents base 10 in range [-1 ; 18] inclusively
  • min_bits: 8-bit positive integer, must be in range [0 ; 64] inclusively
  • actual_value: 64-bit positive integer, must be greater or equal min_value
A list of characters as proof in proof.

Verification

verify_sum

Verifies that commits + neg_commits + excess == 0.
1
bool graphene::app::crypto_api::verify_sum(
2
const std::vector<commitment_type> &commits_in,
3
const std::vector<commitment_type> &neg_commits_in,
4
int64_t excess)
Copied!
Parameters
Return
  • commits_in: List of 33-byte Pedersen Commitments
  • neg_commits_in: List of 33-byte Pedersen Commitments
  • excess: Sum of two list of 33-byte Pedersen Commitments where sums the first set and subtracts the second
(Boolean) True in event of commits + neg_commits + excess == 0, otherwise false

verify_range

Verifies range proof for 33-byte Pedersen Commitment.
1
verify_range_result graphene::app::crypto_api::verify_range(
2
const fc::ecc::commitment_type &commit,
3
const std::vector<char> &proof)
Copied!
Parameters
Return
  • commit: 33-byte pedersen commitment
  • proof: List of characters
A structure with success, min and max values

verify_range_proof_rewind

Verifies range proof rewind for 33-byte Pedersen Commitment.
1
verify_range_proof_rewind_result graphene::app::crypto_api::verify_range_proof_rewind(
2
const blind_factor_type &nonce,
3
const fc::ecc::commitment_type &commit,
4
const std::vector<char> &proof)
Copied!
Parameters
Return
  • nonce: Sha-256 blind refactor type
  • commit: 33-byte pedersen commitment
  • proof: List of characters
A structure with success, min, max, value_out, blind_out and message_out values.