Thanks to visit codestin.com
Credit goes to lib.rs

Cargo Features

[dependencies]
blvm-consensus = { version = "0.1.25", default-features = false, features = ["bolero", "local-spec-lock", "production", "rayon", "benchmarking", "utxo-commitments", "utxo-proof-verification", "parallel-verification", "property-tests", "test-utils", "runtime-invariants", "ctv", "profile", "csfs", "blvm-secp256k1", "secp256k1-fallback"] }

Local monorepo: sibling paths override the blvm-* version pins above.

default = blvm-secp256k1, production

Production (batch verification, fast paths) is default; blvm-secp256k1 is default crypto backend

bolero

Enable fuzzing tests (Bolero framework)
Note: bolero is a dev-dependency, this feature is just for conditional compilation Users should use: cargo test --features bolero

local-spec-lock

Local development: Use local filesystem path for blvm-spec-lock Only enable this when developing locally (not in CI)
Usage: cargo build --features local-spec-lock
Note: When enabled, [patch.crates-io] section overrides the crate dependency

production default = blvm-secp256k1, crossbeam-queue, lru, rayon, rustc-hash, siphasher, smallvec

Production performance optimizations
This feature enables runtime optimizations like caching and context reuse blvm-secp256k1: pure Rust crypto backend (ECDSA, Schnorr, Taproot) — default for profile/production

Enables production of blvm-primitives

Foundational types, serialization, crypto, config (shared with blvm-protocol)
crates.io: allow any 0.x >=0.1 without editing Cargo.toml for each patch/minor

Affects bip348::SchnorrSignatureCollector, bip348::batch_verify_signatures_from_stack, bip348::verify_tapscript_schnorr_signature, bip_validation::Bip30Index, block::UtxoDelta, checkqueue::TxScriptContext.bip143, checkqueue::TxScriptContext.sighash_midstate_cache, checkqueue::BlockSessionContext.ecdsa_sub_counters, checkqueue::BlockSessionContext.schnorr_collector, checkqueue::BlockSessionContext.precomputed_sighashes, checkqueue::BlockSessionContext.precomputed_p2pkh_hashes, optimizations::precomputed_constants, optimizations::prefetch, optimizations::constant_folding, optimizations::dead_code_elimination, optimizations::simd_vectorization, optimizations::proven_bounds, optimizations::optimized_access, optimizations::reference_implementations, pow::batch_check_proof_of_work

rayon parallel-verification? production

Enable rayon for parallelization (optional, can be enabled independently)

Enables rayon

Affects config::init_rayon_for_script_verification, blvm-consensus::checkqueue

benchmarking

Benchmarking utilities
Enables cache clearing and state reset functions for reproducible benchmarks

Affects config::set_assume_valid_height, config::reset_assume_valid_height, script::clear_script_cache, script::clear_hash_cache, script::clear_all_caches, script::clear_stack_pool, script::reset_benchmarking_state, transaction_hash::clear_sighash_templates

utxo-commitments

UTXO commitments (implementation in blvm-protocol; integration tests are in blvm-protocol)

Affects orange_paper_property_helpers::expected_verifyconsensuscommitment_from_orange_paper, orange_paper_property_helpers::expected_verifyconsensuscommitment_from_orange_paper_impl

utxo-proof-verification

Verify UTXO proofs during initial sync (optional, for coin-freeze attack mitigation)

parallel-verification = rayon

Parallel UTXO proof verification (requires rayon)

property-tests

Property test strategies (transaction_with_witness_strategy, etc.) for spec-lock generated tests Required for integration tests in tests/spec_property_tests.rs

Enables proptest =1.5.0

#[spec_locked] is metadata for cargo-spec-lock / Orange Paper verification; no separate blvm-spec-macros crate is wired. Property-based strategies in src/test_utils.rs (must be a normal optional dep when property-tests is on — dev-deps are not linked for cargo build --all-features on the library).

test-utils

Shared test fixtures (create_coinbase_tx, create_test_utxo_set_two_outputs).
Enable for integration tests that use test_utils: cargo test --features test-utils

runtime-invariants

Note: spec-lock feature removed - constants and #[spec_locked] attributes are always available Property tests can use constants directly without any feature flag The #[spec_locked] attributes are just metadata for formal verification tools
Runtime invariant checks in production builds
Enables runtime verification of mathematical invariants (supply, UTXO consistency, etc.)
Can be enabled in production for additional safety at performance cost

Affects optimizations::runtime_assertions

ctv

CTV (BIP119 CheckTemplateVerify) - proposed soft fork Enables OP_CHECKTEMPLATEVERIFY opcode support

Affects blvm-consensus::bip119

profile

Profiling: eprintln! timing logs (PERF, BATCH, FAST_PATH). NOT for production.

Affects blvm-consensus::profile_log, blvm-consensus::script_profile

csfs

CSFS (BIP348 CHECKSIGFROMSTACK) - proposed soft fork Enables OP_CHECKSIGFROMSTACK opcode support (Tapscript only)

Affects blvm-consensus::bip348

blvm-secp256k1 default production

Use blvm-secp256k1 for Taproot tweak (correct BIP 341 tagged hash)
When disabled, uses crates.io secp256k1 (plain SHA256 - non-BIP341)

Enables blvm-secp256k1

blvm-secp256k1: pure Rust, BIP 341 correct TapTweak (use for Taproot path)

Affects secp256k1_backend::verify_ecdsa_direct

secp256k1-fallback

Fallback crypto backend: crates.io secp256k1 0.28 (libsecp256k1 FFI, no batch Schnorr).
Use when blvm-secp256k1 is not desired. Mutually exclusive with blvm-secp256k1.

Enables secp256k1 ^0.28

Consensus-critical cryptography - EXACT VERSIONS
Default backend: blvm-secp256k1 (batch Schnorr, BIP-341 correct TapTweak, no FFI).
Fallback: enable the "secp256k1-fallback" feature to use crates.io secp256k1 0.28 (libsecp256k1 FFI).
Both deps are optional so only one is compiled at a time. NO secp256k1-fork.

Features from optional dependencies

In crates that don't use the dep: syntax, optional dependencies automatically become Cargo features. These features may have been created by mistake, and this functionality may be removed in the future.

smallvec production
rustc-hash production

Enables rustc-hash =2.1.1

Fast hash map for UTXO lookups (2-3x faster than std HashMap for fixed-size keys)
Must match blvm-node (=2.1.1) so monorepo graphs (e.g. blvm-sdk) resolve one version.

siphasher production

Enables siphasher ^0.3

SipHash for sig cache keys (Bitcoin Core uses SipHash; ~10x faster than SHA-256 for 133-byte input)

crossbeam-queue production
lru production

Enables lru ^0.16