{"id":18369113,"url":"https://github.com/bitfancy/partial-merkle-patricia-trie","last_synced_at":"2025-04-10T19:39:41.940Z","repository":{"id":237689792,"uuid":"760144278","full_name":"BitFancy/partial-merkle-patricia-trie","owner":"BitFancy","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-19T21:36:44.000Z","size":57,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-15T20:54:18.807Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BitFancy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-19T21:35:11.000Z","updated_at":"2024-11-24T11:49:11.000Z","dependencies_parsed_at":"2024-05-03T01:21:05.220Z","dependency_job_id":null,"html_url":"https://github.com/BitFancy/partial-merkle-patricia-trie","commit_stats":null,"previous_names":["bitfancy/partial-merkle-patricia-trie"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BitFancy%2Fpartial-merkle-patricia-trie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BitFancy%2Fpartial-merkle-patricia-trie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BitFancy%2Fpartial-merkle-patricia-trie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BitFancy%2Fpartial-merkle-patricia-trie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BitFancy","download_url":"https://codeload.github.com/BitFancy/partial-merkle-patricia-trie/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248281423,"owners_count":21077423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T23:28:29.740Z","updated_at":"2025-04-10T19:39:41.916Z","avatar_url":"https://github.com/BitFancy.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# partial merkle patricia trie\n\nhelps to calculate new root of a huge trie after changing few nodes without loading the entire trie.\n\n## usage\n\n```rust\nuse partial_mpt::StateTrie;\n\n// create a new trie\nlet mut state_trie = StateTrie::from_root(block.state_root);\n\n// load proofs for keys to change\nstate_trie.load_proof(provider.get_proof(address, vec![slot], block.num))\n\n// set value for the key, would give error if proof is not loaded already\nstate_trie.set_storage_value(address, slot, new_value)\n\n// new root\nstate_trie.root()\n```\n\n## examples\n\n- [eth burn](./examples/eth-burn.rs)\n- [mainnet block](./examples/mainnet-block-1000008.rs)\n\nto run the example, clone this project and `cargo run --example eth-burn`.\n\n## tests\n\n- to run local tests use `cargo test` \n- to run specific tests e.g. `cargo test trie::tests::test_node_data`\n- to run all tests including [live mainnet block tests](./src/state_trie/mod.rs#209) use `RPC=\"https://eth-mainnet.url\" cargo test --features test-live`\n\n## rationale\n\nmainnet fork clients do not calculate state root since it's hardly required in smart contract development. but in a recent [hackathon](https://github.com/zemse/zk-proof-of-evm-challenge), i had to write a chunk of this code in a hurry. just seperating it out for convenience along with some bug fixes and more tests.\n\n## license\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitfancy%2Fpartial-merkle-patricia-trie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitfancy%2Fpartial-merkle-patricia-trie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitfancy%2Fpartial-merkle-patricia-trie/lists"}