{"id":13531655,"url":"https://github.com/gballet/multiproof-rs","last_synced_at":"2025-04-15T05:55:14.186Z","repository":{"id":57641997,"uuid":"198460323","full_name":"gballet/multiproof-rs","owner":"gballet","description":"A rust implementation of Alexey Akhunov's multiproof algorithm","archived":false,"fork":false,"pushed_at":"2020-09-17T12:57:25.000Z","size":282,"stargazers_count":33,"open_issues_count":12,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-15T05:55:07.916Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gballet.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}},"created_at":"2019-07-23T15:40:13.000Z","updated_at":"2025-02-06T13:42:05.000Z","dependencies_parsed_at":"2022-09-07T08:02:08.665Z","dependency_job_id":null,"html_url":"https://github.com/gballet/multiproof-rs","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gballet%2Fmultiproof-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gballet%2Fmultiproof-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gballet%2Fmultiproof-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gballet%2Fmultiproof-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gballet","download_url":"https://codeload.github.com/gballet/multiproof-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249016320,"owners_count":21198832,"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-08-01T07:01:04.665Z","updated_at":"2025-04-15T05:55:14.171Z","avatar_url":"https://github.com/gballet.png","language":"Rust","funding_links":[],"categories":["Cryptography"],"sub_categories":["Digital Signature"],"readme":"[![CircleCI](https://circleci.com/gh/gballet/multiproof-rs.svg?style=svg)](https://circleci.com/gh/gballet/multiproof-rs)\n[![Crates.io](https://img.shields.io/crates/v/multiproof-rs.svg)](https://crates.io/crates/multiproof-rs)\n\n# multiproof.rs\nA rust implementation of Alexey Akhunov's [multiproof algorithm](https://github.com/ledgerwatch/turbo-geth/blob/master/docs/programmers_guide/guide.md).\n\nAt the time of creation, multiproof is still a work in progress and this code makes a series of assumptions that are to be discussed and updated in order to achieve complete compatibility. Here is a non-exhaustive list of assumptions:\n\n  * The initial `LEAF`, `BRANCH`, `ADD`, `HASHER` and `EXTENSION` model is still in use,\n  * `HASHER` always has a parameter of `0`. This is clearly and issue with this code as several distrinct trees end up having the same hash.\n\n## Installation\n\n**This code uses features from rust nightly.** Install it by typing:\n\n```\nrustup install nightly\n```\n\nYou can then run the tests with:\n\n```\ncargo +nightly test\n```\n\n## Usage\n\n### Creating trees\n\nStart with an empty tree:\n\n```rust\nlet mut tree_root = Node::default();\n```\n\nThis creates a mutable tree root, which is a node with 16 (currently empty) children.\n\nYou can use `insert_leaf` to add a `(key,value)` pair to that tree. This example adds `(0x11111..111, 0x22222..222)` to the tree that was created above:\n\n```rust\nnew_root.insert(\u0026NibbleKey::from(vec![1u8; 32]), vec![2u8; 32]).unwrap();\n```\n\nNote that the key format is `\u0026NibbleKey`, and no longer `Vec\u003cu8\u003e`.\n\n### Calculating hashes\n\nThe `hash` function will walk the tree and calculate the hash representation.\n\n```rust\nlet hash = new_root.hash();\n```\n\n### Creating the proof\n\nCall `make_multiproof` with the root of the tree and the list of keys to be changed. It returns a `Multiproof` object, which can be sent to the verifier over the network; The example below will create a proof for leaf `0x11...11`:\n\n```rust\nlet proof = make_multiproof(\u0026new_root, vec![NibbleKey::from(vec![1u8; 32])]).unwrap();\n```\n\n### Verifying proof\n\nCall the `rebuild` function on the output of `make_multiproof`:\n\n```rust\nlet root = proof.rebuild().unwrap();\n```\n\n### Examples\n\nSee unit tests.\n\n## Changelog\n\n### 0.1.9\n\n  * Add the `Hashable` trait and use methods M2 and M3 (see https://ethresear.ch/t/binary-trie-format/7621/6)\n  * Implement `From\u003cVec\u003cbool\u003e\u003e` and `Into\u003cVec\u003cbool\u003e\u003e`\n  * Binary keys use `bool` as a key type\n  * Use extensions for binary tries\n  * Bugfix: check that keys have the same length in insert.\n  * Fuzzing: introduce tests for nibblekey and Node::inset.\n\n### 0.1.8\n\n  * `keys` method on `Node` in order to get the list of keys present in the tree.\n  * Fixes #61 - if several keys have the same prefix leading to a `Leaf` object,\n    don't return an error; instead, add that key to the proof, as a proof that\n    all the extra keys are missing.\n\n### 0.1.7\n\n  * Accept the insertion of empty keys\n\n### 0.1.6\n\n  * Fix a bug in even-length hex prefix calculations\n\n### 0.1.5\n\n  * Export ByteKey to Vec\u003cu8\u003e\n  * Implement `fmt::Display` for `NibbleKey`\n\n### 0.1.4\n\n  * Support for binary trees\n  * CBOR encoding of proofs\n\n### 0.1.3\n\n  * Allow `insert`s to overwrite existing leaves\n  * Make `has_key` part of the tree trait\n  * Bugfix in `NibbleKey` index calculation\n  * README updates\n\n### 0.1.2\n\n  * Export all submodules\n\n### 0.1.1\n\n  * Export `node::*` from crate\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgballet%2Fmultiproof-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgballet%2Fmultiproof-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgballet%2Fmultiproof-rs/lists"}