pub fn generate_commitments(
    tx_context: TransactionContext<UnsignedTransaction>,
    state_context: &ErgoStateContext,
    public_keys: &[SigmaBoolean],
) -> Result<TransactionHintsBag, TxSigningError> {
    let tx = tx_context.spending_tx.clone();
    let mut hints_bag = TransactionHintsBag::empty();
    for (i, input) in tx.inputs.iter().enumerate() {
        let input_box = tx_context
            .get_boxes_to_spend()
            .find(|b| b.box_id() == input.box_id)
            .ok_or(TxSigningError::InputBoxNotFound(i))?;
        let ctx = Rc::new(make_context(state_context, &tx_context, i)?);
        let tree = input_box.ergo_tree.clone();
        let exp = tree
            .proposition()
            .map_err(ProverError::ErgoTreeError)
            .map_err(|e| TxSigningError::ProverError(e, i))?;
        let reduction_result = reduce_to_crypto(&exp, &Env::empty(), ctx)
            .map_err(ProverError::EvalError)
            .map_err(|e| TxSigningError::ProverError(e, i))?;

        let sigma_tree = reduction_result.sigma_prop;
        hints_bag.add_hints_for_input(i, generate_commitments_for(sigma_tree, public_keys));
    }
    Ok(hints_bag)
}
/// A method which is generating commitments to randomness. A commitment is about a first step
/// of a zero-knowledge proof-of-knowledge knowledge protocol.
/// the commitments are generated for every input box of transaction
/// and return as `TransactionHintsBag`.
/// generated commitments corresponds to `public_keys` that prepared in function input
A method which is generating commitments to randomness. A commitment is about a first step
of a zero-knowledge proof-of-knowledge knowledge protocol.
the commitments are generated for every input box of transaction
and return as `TransactionHintsBag`.
generated commitments corresponds to `public_keys` that prepared in function input
A method which is generating commitments to randomness . A commitment is about a first step of a zero - knowledge proof - of - knowledge knowledge protocol . the commitments are generated for every input box of transaction and return as ` TransactionHintsBag ` . generated commitments corresponds to ` public_keys ` that prepared in function input
pub fn generate_commitments(
    tx_context: TransactionContext<UnsignedTransaction>,
    state_context: &ErgoStateContext,
    public_keys: &[SigmaBoolean],
) -> Result<TransactionHintsBag, TxSigningError> {
    let tx = tx_context.spending_tx.clone();
    let mut hints_bag = TransactionHintsBag::empty();
    for (i, input) in tx.inputs.iter().enumerate() {
        let input_box = tx_context
            .get_boxes_to_spend()
            .find(|b| b.box_id() == input.box_id)
            .ok_or(TxSigningError::InputBoxNotFound(i))?;
        let ctx = Rc::new(make_context(state_context, &tx_context, i)?);
        let tree = input_box.ergo_tree.clone();
        let exp = tree
            .proposition()
            .map_err(ProverError::ErgoTreeError)
            .map_err(|e| TxSigningError::ProverError(e, i))?;
        let reduction_result = reduce_to_crypto(&exp, &Env::empty(), ctx)
            .map_err(ProverError::EvalError)
            .map_err(|e| TxSigningError::ProverError(e, i))?;
        let sigma_tree = reduction_result.sigma_prop;
        hints_bag.add_hints_for_input(i, generate_commitments_for(sigma_tree, public_keys));
    }
    Ok(hints_bag)
}
pub fn generate_commitments ( tx_context : TransactionContext < UnsignedTransaction > , state_context : & ErgoStateContext , public_keys : & [ SigmaBoolean ] , ) -> Result < TransactionHintsBag , TxSigningError > { let tx = tx_context . spending_tx . clone ( ) ; let mut hints_bag = TransactionHintsBag :: empty ( ) ; for ( i , input ) in tx . inputs . iter ( ) . enumerate ( ) { let input_box = tx_context . get_boxes_to_spend ( ) . find ( | b | b . box_id ( ) == input . box_id ) . ok_or ( TxSigningError :: InputBoxNotFound ( i ) ) ? ; let ctx = Rc :: new ( make_context ( state_context , & tx_context , i ) ? ) ; let tree = input_box . ergo_tree . clone ( ) ; let exp = tree . proposition ( ) . map_err ( ProverError :: ErgoTreeError ) . map_err ( | e | TxSigningError :: ProverError ( e , i ) ) ? ; let reduction_result = reduce_to_crypto ( & exp , & Env :: empty ( ) , ctx ) . map_err ( ProverError :: EvalError ) . map_err ( | e | TxSigningError :: ProverError ( e , i ) ) ? ; let sigma_tree = reduction_result . sigma_prop ; hints_bag . add_hints_for_input ( i , generate_commitments_for ( sigma_tree , public_keys ) ) ; } Ok ( hints_bag ) }
A method which is generating commitments to randomness.
A method which is generating commitments to randomness .
tx_context
TransactionContext<UnsignedTransaction>
state_context
&ErgoStateContext
public_keys
&[SigmaBoolean]
tx_context
TransactionContext<UnsignedTransaction>
state_context
&ErgoStateContext
public_keys
&[SigmaBoolean]