{"id":22915072,"url":"https://github.com/stratisproject/stratispatricia","last_synced_at":"2025-07-05T06:01:43.270Z","repository":{"id":95902260,"uuid":"134223547","full_name":"stratisproject/StratisPatricia","owner":"stratisproject","description":"An implementation of a merkle patricia trie in C#.","archived":false,"fork":false,"pushed_at":"2020-04-24T05:10:16.000Z","size":23,"stargazers_count":15,"open_issues_count":1,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-31T22:41:27.891Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","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/stratisproject.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":"2018-05-21T05:45:04.000Z","updated_at":"2025-02-05T07:24:49.000Z","dependencies_parsed_at":"2023-09-01T04:30:53.827Z","dependency_job_id":null,"html_url":"https://github.com/stratisproject/StratisPatricia","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stratisproject%2FStratisPatricia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stratisproject%2FStratisPatricia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stratisproject%2FStratisPatricia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stratisproject%2FStratisPatricia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stratisproject","download_url":"https://codeload.github.com/stratisproject/StratisPatricia/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253749917,"owners_count":21958214,"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-12-14T05:18:38.832Z","updated_at":"2025-05-12T13:45:21.021Z","avatar_url":"https://github.com/stratisproject.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stratis.Patricia\n\nMerkle Patricia Tries are a tree structure in which each node is stored as a value in a key/value store by its hash. The hash of the root node can thus be used to represent the entire set of data in the trie.\n\nThey are particularly useful in smart contract-enabled blockchains as they allow the entire world state to be represented by a single 32-byte hash. Rolling back the internal state to any point in time using patricia tries is trivial. Provided the root node is set to a previously valid state, the internal state will always be able to be resolved via the underlying key/value store.\n\nUsage\n-----\n\nStratis.Patricia is available on [NuGet](https://www.nuget.org/packages/Stratis.Patricia/).\n\n```c#\nvar key1 = new byte[] {1, 2, 3};\nvar value1 = new byte[] {4, 5, 6};\nvar key2 = new byte[] { 7, 8, 9 };\nvar value2 = new byte[] { 10, 11, 12 };\n\n// Create any data store you like that implements ISource, or use the included MemoryDictionarySource\nvar underlyingSource = new MemoryDictionarySource();\nvar trie = new PatriciaTrie(underlyingSource);\n\n// Insert your data into the trie and flush to the underlying data store.\ntrie.Put(key1, value1);\ntrie.Put(key2, value2);\ntrie.Flush();\n\n// Get a 32-byte hash that represents all the data in your trie\nbyte[] root = trie.GetRootHash();\n\n// So long as you use the same underlying data store, access all the same data\nvar trie2 = new PatriciaTrie(underlyingSource);\ntrie2.SetRoot(root);\nbyte[] equivalentToValue1 = trie2.Get(key1);\n```\n\nYou can use any data store or hashing algorithm that you like - just implement `ISource` or `IHasher` and pass them into the PatriciaTrie constructor.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstratisproject%2Fstratispatricia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstratisproject%2Fstratispatricia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstratisproject%2Fstratispatricia/lists"}