fn create_metadata_signature(
        value: &MicroTari,
        spending_key: &BlindingFactor,
        script: &TariScript,
        output_features: &OutputFeatures,
        sender_offset_public_key: &PublicKey,
        partial_commitment_nonce: Option<&PublicKey>,
        sender_offset_private_key: Option<&PrivateKey>,
    ) -> Result<ComSignature, TransactionError> {
        let nonce_a = PrivateKey::random(&mut OsRng);
        let nonce_b = PrivateKey::random(&mut OsRng);
        let nonce_commitment = PedersenCommitmentFactory::default().commit(&nonce_b, &nonce_a);
        let nonce_commitment = match partial_commitment_nonce {
            None => nonce_commitment,
            Some(partial_nonce) => &nonce_commitment + partial_nonce,
        };
        let value = PrivateKey::from(value.as_u64());
        let commitment = PedersenCommitmentFactory::default().commit(&spending_key, &value);
        let e = TransactionOutput::build_metadata_signature_challenge(
            &script,
            &output_features,
            &sender_offset_public_key,
            &nonce_commitment,
            &commitment,
        );
        let secret_x = match sender_offset_private_key {
            None => spending_key.clone(),
            Some(key) => &spending_key.clone() + key,
        };
        Ok(ComSignature::sign(
            value,
            secret_x,
            nonce_a,
            nonce_b,
            &e,
            &PedersenCommitmentFactory::default(),
        )?)
    }
// Create commitment signature for the metadata
Create commitment signature for the metadata
Create commitment signature for the metadata
fn create_metadata_signature(
        value: &MicroTari,
        spending_key: &BlindingFactor,
        script: &TariScript,
        output_features: &OutputFeatures,
        sender_offset_public_key: &PublicKey,
        partial_commitment_nonce: Option<&PublicKey>,
        sender_offset_private_key: Option<&PrivateKey>,
    ) -> Result<ComSignature, TransactionError> {
        let nonce_a = PrivateKey::random(&mut OsRng);
        let nonce_b = PrivateKey::random(&mut OsRng);
        let nonce_commitment = PedersenCommitmentFactory::default().commit(&nonce_b, &nonce_a);
        let nonce_commitment = match partial_commitment_nonce {
            None => nonce_commitment,
            Some(partial_nonce) => &nonce_commitment + partial_nonce,
        };
        let value = PrivateKey::from(value.as_u64());
        let commitment = PedersenCommitmentFactory::default().commit(&spending_key, &value);
        let e = TransactionOutput::build_metadata_signature_challenge(
            &script,
            &output_features,
            &sender_offset_public_key,
            &nonce_commitment,
            &commitment,
        );
        let secret_x = match sender_offset_private_key {
            None => spending_key.clone(),
            Some(key) => &spending_key.clone() + key,
        };
        Ok(ComSignature::sign(
            value,
            secret_x,
            nonce_a,
            nonce_b,
            &e,
            &PedersenCommitmentFactory::default(),
        )?)
    }
fn create_metadata_signature ( value : & MicroTari , spending_key : & BlindingFactor , script : & TariScript , output_features : & OutputFeatures , sender_offset_public_key : & PublicKey , partial_commitment_nonce : Option < & PublicKey > , sender_offset_private_key : Option < & PrivateKey > , ) -> Result < ComSignature , TransactionError > { let nonce_a = PrivateKey :: random ( & mut OsRng ) ; let nonce_b = PrivateKey :: random ( & mut OsRng ) ; let nonce_commitment = PedersenCommitmentFactory :: default ( ) . commit ( & nonce_b , & nonce_a ) ; let nonce_commitment = match partial_commitment_nonce { None => nonce_commitment , Some ( partial_nonce ) => & nonce_commitment + partial_nonce , } ; let value = PrivateKey :: from ( value . as_u64 ( ) ) ; let commitment = PedersenCommitmentFactory :: default ( ) . commit ( & spending_key , & value ) ; let e = TransactionOutput :: build_metadata_signature_challenge ( & script , & output_features , & sender_offset_public_key , & nonce_commitment , & commitment , ) ; let secret_x = match sender_offset_private_key { None => spending_key . clone ( ) , Some ( key ) => & spending_key . clone ( ) + key , } ; Ok ( ComSignature :: sign ( value , secret_x , nonce_a , nonce_b , & e , & PedersenCommitmentFactory :: default ( ) , ) ? ) }
Create commitment signature for the metadata
Create commitment signature for the metadata
value
&MicroTari
spending_key
&BlindingFactor
script
&TariScript
output_features
&OutputFeatures
sender_offset_public_key
&PublicKey
partial_commitment_nonce
Option<&PublicKey>
sender_offset_private_key
Option<&PrivateKey>
value
&MicroTari
spending_key
&BlindingFactor
script
&TariScript
output_features
&OutputFeatures
sender_offset_public_key
&PublicKey
partial_commitment_nonce
Option<&PublicKey>
sender_offset_private_key
Option<&PrivateKey>