{"id":58723,"library":"sp-trie","title":"SP Trie","description":"Patricia trie implementation using parity-scale-codec node format for Substrate-based chains.","status":"active","version":"43.0.0","language":"rust","source_language":null,"source_url":"https://github.com/paritytech/polkadot-sdk","tags":["trie","patricia","merkle","substrate","polkadot"],"install":[{"cmd":"# Cargo.toml\n[dependencies]\nsp-trie = \"43.0.0\"","lang":"toml","label":"Cargo.toml"},{"cmd":"cargo add sp-trie","lang":"bash","label":"cargo add"}],"dependencies":[],"imports":[{"symbol":"TrieDBMut","correct":"use sp_trie::TrieDBMut;"}],"quickstart":{"code":"use sp_trie::{TrieDBMut, TrieMut, LayoutV0};\nuse sp_core::Blake2Hasher;\n\nfn main() {\n    let mut db = sp_trie::MemoryDB::<Blake2Hasher>::default();\n    let mut root = Default::default();\n    let mut trie = TrieDBMut::<LayoutV0<Blake2Hasher>>::new(&mut db, &mut root);\n    trie.insert(b\"key\", b\"value\").unwrap();\n    println!(\"Root hash: {:?}\", root);\n}","lang":"rust","description":"Insert a key-value pair into a Patricia trie"},"warnings":[{"fix":"Use LayoutV0 or LayoutV1 with Blake2Hasher or KeccakHasher as appropriate","message":"Requires specific hasher and layout types from Substrate ecosystem","severity":"gotcha","affected_versions":">= 20.0.0"}],"env_vars":null,"search_vec":"'base':16 'chain':17 'codec':10 'format':12 'implement':5 'merkl':20 'node':11 'pariti':8 'parity-scale-codec':7 'patricia':3,19 'polkadot':22 'scale':9 'sp':1 'substrat':15,21 'substrate-bas':14 'trie':2,4,18 'use':6","created_at":"2026-06-16T16:36:12.867625+00:00","updated_at":"2026-06-16T16:36:12.867625+00:00","problems":[],"ecosystem":"crates","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://paritytech.github.io/polkadot-sdk/","github":"https://github.com/paritytech/polkadot-sdk","docs":"https://docs.rs/sp-trie/","changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["crypto"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-16","next_check":"2026-12-13","install_tag":null}}