Pure Rust implementation of Bitcoin's bitcoinconsensus verification surface (historically exposed as libbitcoinconsensus).
- Legacy, P2SH, SegWit v0, and Taproot/Tapscript validation are implemented.
- Differential checks against Bitcoin Core are available with the
core-difffeature. - Core vectors are vendored in
tests/data/. - Large script-assets corpus support is available via upstream minimizer artifacts.
Main entrypoints in src/lib.rs:
verifyverify_with_flagsverify_with_detailsverify_with_flags_detailed
std(default)external-secp(impliesstd)core-diff(enables Core runtime differential tests/benchmarks)
cargo testcargo test --features core-diffFixture integrity check:
cargo test --test core_fixture_hashesCore runtime differential (local Core checkout required):
BITCOIN_CORE_REPO=/path/to/bitcoin \
CORE_CPP_DIFF_BUILD_HELPER=1 \
cargo test --features core-diff --test core_cpp_runtime_diff -- --nocaptureStrict parity mode:
BITCOIN_CORE_REPO=/path/to/bitcoin \
CORE_CPP_DIFF_BUILD_HELPER=1 \
CORE_CPP_DIFF_REQUIRED=1 \
CORE_CPP_DIFF_STRICT=1 \
CORE_CPP_DIFF_ACCEPTED_SKIPS=noncanonical_flags,placeholder_vectors \
cargo test --features core-diff --test core_cpp_runtime_diff -- --nocaptureScript-assets parity profile:
SCRIPT_ASSETS_PARITY_PROFILE=1 \
SCRIPT_ASSETS_REQUIRE_UPSTREAM=1 \
SCRIPT_ASSETS_UPSTREAM_JSON=/path/to/script_assets_test.json \
SCRIPT_ASSETS_UPSTREAM_METADATA_JSON=/path/to/script_assets_test.metadata.json \
cargo test --test script_assets -- --nocapturecargo bench --bench verificationcargo bench --bench verification --features core-diffsrc/lib.rs: public API and verification flowsrc/script.rs: script interpretersrc/tx.rs: transaction parsing and sighash helperstests/: vectors, corpus checks, and differential suites
docs/integration-roadmap.md: parity roadmap and findingsdocs/github-ci.md: CI and GitHub setup details
- Taproot checksig/sighash paths require prevout context (
spent_outputs). - Under
VERIFY_TAPROOT, non-taproot execution paths do not fail early when prevouts are absent. - Amount semantics follow Core runtime: explicit
amountis authoritative for checksig/sighash.