Skip to main content

Module scanner

Module scanner 

Source
Expand description

WASM-compatible parallel note scanner for Orchard

This module provides trial decryption of Orchard notes using PreparedIncomingViewingKey from orchard 0.7. It’s designed to work in both native and WASM environments:

  • Native: Uses rayon for parallel scanning across CPU cores
  • WASM: Uses wasm-bindgen-rayon for multi-threaded scanning via Web Workers (requires SharedArrayBuffer + CORS headers)

Performance characteristics:

  • Trial decryption: ~3μs per action (invalid), ~50μs per action (valid)
  • Full chain scan (1.46M blocks): ~5-15 min single-threaded
  • With parallelism: scales linearly with cores (8 cores = 8x speedup)

Build for WASM with parallelism:

RUSTFLAGS='-C target-feature=+atomics,+bulk-memory,+mutable-globals' \
  cargo build --target wasm32-unknown-unknown --features wasm-parallel --no-default-features

Usage:

let ivk = fvk.to_ivk(Scope::External);
let scanner = Scanner::new(&ivk);
let results = scanner.scan_actions(&compact_actions);

Structs§

BatchScanner
batch scanner for processing multiple blocks efficiently
DecryptedNote
successfully decrypted note
DetectionHint
detection hint for fast filtering (optional FMD-like optimization) Server can compute these without knowing the viewing key
HintGenerator
hint generator from viewing key
ScanAction
compact action for scanning (matches proto/zidecar wire format)
Scanner
scanner for trial decryption of Orchard notes