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

Function blake3_verify_output_script

bitvm/src/hash/blake3.rs:369–385  ·  view source on GitHub ↗

Returns a script that verifies the BLAKE3 output on the stack. The script pops the BLAKE3 output and compares it with the given, expected output.

(expected_output: [u8; 32])

Source from the content-addressed store, hash-verified

367///
368/// The script pops the BLAKE3 output and compares it with the given, expected output.
369pub fn blake3_verify_output_script(expected_output: [u8; 32]) -> Script {
370 script! {
371 for (i, byte) in expected_output.into_iter().enumerate() {
372 {byte}
373 if i % 32 == 31 {
374 {U256::transform_limbsize(8,4)}
375 }
376 }
377
378 for i in (2..65).rev() {
379 {i}
380 OP_ROLL
381 OP_EQUALVERIFY
382 }
383 OP_EQUAL
384 }
385}
386
387#[cfg(test)]
388mod tests {

Calls

no outgoing calls

Tested by

no test coverage detected