Skip to content

Commit

Permalink
creates method for taking commitments from participants and creating …
Browse files Browse the repository at this point in the history
…a signing package (#4562)
  • Loading branch information
jowparks authored Jan 19, 2024
1 parent 4f44aae commit 8583028
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ironfish-rust-nodejs/src/structs/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */

use std::cell::RefCell;

use std::convert::TryInto;

use ironfish::assets::asset_identifier::AssetIdentifier;
Expand Down Expand Up @@ -174,7 +175,6 @@ impl NativeTransaction {
pub fn new(version: u8) -> Result<Self> {
let tx_version = version.try_into().map_err(to_napi_err)?;
let transaction = ProposedTransaction::new(tx_version);

Ok(NativeTransaction { transaction })
}

Expand Down
18 changes: 17 additions & 1 deletion ironfish-rust/src/transaction/unsigned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@

use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use group::GroupEncoding;
use ironfish_frost::frost::{round1::SigningCommitments, Identifier, SigningPackage};

use ironfish_zkp::redjubjub::{self, Signature};
use std::io::{self, Write};
use std::{
collections::BTreeMap,
io::{self, Write},
};

use crate::{
errors::IronfishError, serializing::read_scalar, transaction::Blake2b, OutputDescription,
Expand Down Expand Up @@ -209,4 +214,15 @@ impl UnsignedTransaction {
randomized_public_key: self.randomized_public_key.clone(),
})
}

// Creates frost signing package for use in round two of FROST multisig protocol
// only applicable for multisig transactions
pub fn signing_package(
&self,
commitments: BTreeMap<Identifier, SigningCommitments>,
) -> Result<SigningPackage, IronfishError> {
// Create the transaction signature hash
let data_to_sign = self.transaction_signature_hash()?;
Ok(SigningPackage::new(commitments, &data_to_sign))
}
}

0 comments on commit 8583028

Please sign in to comment.