blvm-primitives
Foundational types, serialization, crypto, and config for Bitcoin consensus and protocol layers.
Part of Bitcoin Commons BLVM. This crate is the shared foundation that blvm-consensus and blvm-protocol depend on, enabling parallel compilation and a clear split between consensus rules and protocol abstraction.
Contents
- Types —
Hash,ByteString,Witness,Natural,Integer,Transaction,TransactionInput,TransactionOutput,Block,BlockHeader,OutPoint,UTXO, network enum, and related structs. - Serialization — block/transaction encoding and decoding, varint handling.
- Crypto — SHA-256 (with optional asm/SHA-NI), hash comparison helpers, consensus-critical crypto using pinned versions.
- Opcodes — script opcode constants and helpers.
- Constants — consensus and tuning constants (e.g. IBD).
- Config — shared config types used by node and consensus.
- spec_types — optional spec-aware wrappers (
SpecVec,SpecHashMap,spec_wrap!) for formal verification / Orange Paper alignment with blvm-spec-lock.
Usage
Add to your Cargo.toml:
[]
= { = "../blvm-primitives" }
# or from git:
# blvm-primitives = { git = "https://github.com/BTCDecoded/blvm-primitives" }
Optional features:
production— enablessmallvecandrustc-hashfor lower-allocation, production-oriented builds (used by blvm-consensus when built withproduction).
Building
License
MIT. See LICENSE if present.
Links
- Bitcoin Commons
- blvm-consensus — depends on this crate
- blvm-protocol — depends on this crate