MCPcopy Create free account
hub / github.com/BitVM/BitVM / get_pubkeys

Function get_pubkeys

bitvm/src/chunk/api_runtime_utils.rs:713–737  ·  view source on GitHub ↗
(secret_key: Vec<String>)

Source from the content-addressed store, hash-verified

711
712#[allow(clippy::needless_range_loop)]
713pub(crate) fn get_pubkeys(secret_key: Vec<String>) -> PublicKeys {
714 let mut pubins = vec![];
715 for i in 0..NUM_PUBS {
716 let secret = Wots32::secret_from_str(secret_key[i].as_str());
717 pubins.push(Wots32::generate_public_key(&secret));
718 }
719 let mut fq_arr = vec![];
720 for i in 0..NUM_U256 {
721 let secret = Wots32::secret_from_str(secret_key[i + NUM_PUBS].as_str());
722 let p256 = Wots32::generate_public_key(&secret);
723 fq_arr.push(p256);
724 }
725 let mut h_arr = vec![];
726 for i in 0..NUM_HASH {
727 let secret = Wots16::secret_from_str(secret_key[i + NUM_PUBS + NUM_U256].as_str());
728 let phash = Wots16::generate_public_key(&secret);
729 h_arr.push(phash);
730 }
731 let wotspubkey: PublicKeys = (
732 pubins.try_into().unwrap(),
733 fq_arr.try_into().unwrap(),
734 h_arr.try_into().unwrap(),
735 );
736 wotspubkey
737}
738
739#[cfg(test)]
740mod test {

Calls 2

generate_public_keyFunction · 0.85
pushMethod · 0.45

Tested by 6

test_largest_chunksFunction · 0.68
full_e2e_executionFunction · 0.68