blvm-muhash
MuHash3072 for Bitcoin UTXO set hashing. Matches Bitcoin Core gettxoutsetinfo muhash output for AssumeUTXO compatibility.
Features
- Core-compatible — Produces identical hashes to Bitcoin Core's MuHash3072
- Incremental — Insert and remove elements without full recomputation
- Mergeable — Combine hashes for parallel processing
- No bitcoin- deps* — Pure Rust with sha2, chacha20, cipher
Installation
Add to your Cargo.toml:
[]
= "0.1"
Usage
use ;
// Serialize a UTXO for hashing (matches Core TxOutSer format)
let txid = ;
let vout = 0u32;
let height = 100u32;
let is_coinbase = true;
let amount = 50_0000_0000i64; // 50 BTC in satoshis
let script_pubkey = vec!; // P2PKH prefix
let serialized = serialize_coin_for_muhash;
// Hash the UTXO set (iterate in lexicographic order by outpoint)
let hash = new
.insert
.finalize;
assert_eq!;
API
| Item | Description |
|---|---|
MuHash3072::new() |
Empty set |
insert(self, data) |
Add element |
remove(self, data) |
Remove element |
multiply(self, other) |
Union of sets |
divide(self, other) |
Difference of sets |
finalize(self) |
Produce 32-byte hash |
serialize_coin_for_muhash(...) |
Serialize (outpoint, coin) for insertion |
License
MIT