Registry / crypto / sp-trie

sp-trie

JSON →
library43.0.0rscratesunverified

Patricia trie implementation using parity-scale-codec node format for Substrate-based chains.

# Cargo.toml [dependencies] sp-trie = "43.0.0"
INSTALL
IMPORT
SIG · SP-TRIE
S
sp-trie
cryptorustv43.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TrieDBMut
use sp_trie::TrieDBMut;

Insert a key-value pair into a Patricia trie

use sp_trie::{TrieDBMut, TrieMut, LayoutV0}; use sp_core::Blake2Hasher; fn main() { let mut db = sp_trie::MemoryDB::<Blake2Hasher>::default(); let mut root = Default::default(); let mut trie = TrieDBMut::<LayoutV0<Blake2Hasher>>::new(&mut db, &mut root); trie.insert(b"key", b"value").unwrap(); println!("Root hash: {:?}", root); }
Debug
Known issues
gotchaRequires specific hasher and layout types from Substrate ecosystem
fix
Use LayoutV0 or LayoutV1 with Blake2Hasher or KeccakHasher as appropriate
affects: >= 20.0.0
Upgrade
Version history
43.0.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
12
Resources
sp-trie — cargo add sp-trie · libregistry