include/TransactionValidator.hpp¶
Header file of functions used to validate a transaction. More...
Functions¶
| Name | |
|---|---|
| pallas::template g1_type< nil::crypto3::algebra::curves::coordinates::affine >::value_type | GeneratePointFromSeedAndTotp(pallas::scalar_field_type::value_type seed, pallas::scalar_field_type::value_type provided_totp, typename pallas::template g1_type< nil::crypto3::algebra::curves::coordinates::affine >::value_type generator) Generates a point from the seed, TOTP and generator. |
| bool | ValidateTransactionValues(uint64_t balance, uint64_t amount, pallas::scalar_field_type::value_type balance_scalar, pallas::scalar_field_type::value_type amount_scalar, typename pallas::template g1_type< nil::crypto3::algebra::curves::coordinates::affine >::value_type balance_commitment, typename pallas::template g1_type< nil::crypto3::algebra::curves::coordinates::affine >::value_type amount_commitment, typename pallas::template g1_type< nil::crypto3::algebra::curves::coordinates::affine >::value_type expected_new_balance_commitment, typename pallas::template g1_type< nil::crypto3::algebra::curves::coordinates::affine >::value_type generator, std::array< pallas::scalar_field_type::value_type, MAX_RANGES > ranges) Validates the transaction values. |
Attributes¶
| Name | |
|---|---|
| std::size_t | MAX_RANGES |
Detailed Description¶
Header file of functions used to validate a transaction.
Date: 2025-01-29 Henrique A. Klein ([email protected])
Functions Documentation¶
function GeneratePointFromSeedAndTotp¶
pallas::template g1_type< nil::crypto3::algebra::curves::coordinates::affine >::value_type GeneratePointFromSeedAndTotp(
pallas::scalar_field_type::value_type seed,
pallas::scalar_field_type::value_type provided_totp,
typename pallas::template g1_type< nil::crypto3::algebra::curves::coordinates::affine >::value_type generator
)
Generates a point from the seed, TOTP and generator.
Parameters:
- seed The seed to be used
- provided_totp The TOTP to be used
- generator The generator point to be used
Return: A point that represents the mapping of TOTP and seed combined
function ValidateTransactionValues¶
bool ValidateTransactionValues(
uint64_t balance,
uint64_t amount,
pallas::scalar_field_type::value_type balance_scalar,
pallas::scalar_field_type::value_type amount_scalar,
typename pallas::template g1_type< nil::crypto3::algebra::curves::coordinates::affine >::value_type balance_commitment,
typename pallas::template g1_type< nil::crypto3::algebra::curves::coordinates::affine >::value_type amount_commitment,
typename pallas::template g1_type< nil::crypto3::algebra::curves::coordinates::affine >::value_type expected_new_balance_commitment,
typename pallas::template g1_type< nil::crypto3::algebra::curves::coordinates::affine >::value_type generator,
std::array< pallas::scalar_field_type::value_type, MAX_RANGES > ranges
)
Validates the transaction values.
Parameters:
- balance The raw balance in integer form
- amount The raw amount in integer form
- balance_scalar The raw balance in scalar form
- amount_scalar The raw amount in scalar form
- balance_commitment The balance multiplied by a generator (mapped to a curve)
- amount_commitment The amount multiplied by a generator (mapped to a curve)
- expected_new_balance_commitment The new balance multiplied by a generator (mapped to a curve)
- generator The generator that is used to map values to the curve
- ranges Array of possible ranges of the amount
Return: True if transaction values are valid, false otherwise
Attributes Documentation¶
variable MAX_RANGES¶
Source code¶
#ifndef _TRANSACTION_VALIDATOR_HPP_
#define _TRANSACTION_VALIDATOR_HPP_
#include <nil/crypto3/algebra/curves/pallas.hpp>
#include <nil/crypto3/algebra/random_element.hpp>
#include <cstdint>
#include <array>
static constexpr std::size_t MAX_RANGES = 4;
using namespace nil::crypto3::algebra::curves;
typename pallas::template g1_type<nil::crypto3::algebra::curves::coordinates::affine>::value_type
GeneratePointFromSeedAndTotp( pallas::scalar_field_type::value_type seed, //
pallas::scalar_field_type::value_type provided_totp, //
typename pallas::template g1_type<nil::crypto3::algebra::curves::coordinates::affine>::value_type generator //
);
bool ValidateTransactionValues(
uint64_t balance, //
uint64_t amount, //
pallas::scalar_field_type::value_type balance_scalar, //
pallas::scalar_field_type::value_type amount_scalar, //
typename pallas::template g1_type<nil::crypto3::algebra::curves::coordinates::affine>::value_type balance_commitment, //
typename pallas::template g1_type<nil::crypto3::algebra::curves::coordinates::affine>::value_type amount_commitment, //
typename pallas::template g1_type<nil::crypto3::algebra::curves::coordinates::affine>::value_type expected_new_balance_commitment, //
typename pallas::template g1_type<nil::crypto3::algebra::curves::coordinates::affine>::value_type generator, //
std::array<pallas::scalar_field_type::value_type, MAX_RANGES> ranges //
);
#endif //_TRANSACTION_VALIDATOR_HPP_
Updated on 2026-04-13 at 23:22:46 -0700