{"id":47914353,"url":"https://github.com/mw2000/ubt","last_synced_at":"2026-04-04T05:29:23.821Z","repository":{"id":342509408,"uuid":"920897936","full_name":"mw2000/ubt","owner":"mw2000","description":"A reference implementation of a unified binary tree using 32-byte keys and values","archived":false,"fork":false,"pushed_at":"2026-03-06T07:31:44.000Z","size":35,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-06T11:50:33.586Z","etag":null,"topics":["cryptography","ethereum","merkle-tree"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mw2000.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-01-23T00:48:27.000Z","updated_at":"2026-03-06T07:31:51.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/mw2000/ubt","commit_stats":null,"previous_names":["mw2000/ubt"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/mw2000/ubt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mw2000%2Fubt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mw2000%2Fubt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mw2000%2Fubt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mw2000%2Fubt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mw2000","download_url":"https://codeload.github.com/mw2000/ubt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mw2000%2Fubt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31389202,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T04:26:24.776Z","status":"ssl_error","status_checked_at":"2026-04-04T04:23:34.147Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cryptography","ethereum","merkle-tree"],"created_at":"2026-04-04T05:29:23.380Z","updated_at":"2026-04-04T05:29:23.807Z","avatar_url":"https://github.com/mw2000.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Unified Binary Tree (UBT)\n\nA reference implementation of a unified binary tree using 32-byte keys and values, following the proposed EIP to replace Ethereum's hexary Merkle Patricia Trie (MPT) with a binary structure.\n\n## Overview\n\nThis implementation demonstrates a new binary state tree design that aims to:\n\n- Merge account, storage, and code data into a single unified tree structure\n- Use 32-byte keys and values throughout\n- Provide efficient Merkle proofs\n- Support future validity proof systems\n- Maintain post-quantum security through hash-based merkleization\n\n## Key Features\n\n- **Binary Structure**: Uses a binary tree with internal nodes having left/right children\n- **Stem Nodes**: Groups 256 related values together using a 31-byte stem + 1 byte subindex\n- **BLAKE3 Hashing**: Uses BLAKE3 for merkleization (though hash function choice is not final)\n- **Co-location**: Related data (account info, initial storage slots, code chunks) are grouped together\n- **Simple Design**: Avoids complex extension nodes and RLP encoding\n\n## Understanding the EIP Proposal\n\nThe EIP proposes replacing Ethereum's current Merkle Patricia Trie (MPT) with a unified binary tree structure. Key aspects include:\n\n### Motivation\n- Enable blocks to be proved with validity proofs for simpler chain verification\n- Current MPT design isn't friendly for validity proofs due to:\n  - RLP encoding for nodes\n  - Keccak as hashing function\n  - Being a \"tree of trees\"\n  - Not including account code in state\n- Binary structure provides better balance between out-of-circuit and in-circuit proving\n- Smaller Merkle proofs compared to hexary structure\n\n### Key Changes\n1. **Unified Structure**: \n   - Merges account and storage tries into a single tree\n   - Includes chunked contract code in the tree\n   - Removes RLP encoding\n   - Co-locates related data for efficiency\n\n2. **Data Organization**:\n   - Uses 32-byte keys and values\n   - First 31 bytes define the entry stem\n   - Last byte is the subindex in that stem\n   - Groups of 256 keys with same stem are co-located\n\n3. **Node Types**:\n   - InternalNode: Contains left and right hash\n   - StemNode: Has stem and 256 values\n   - LeafNode: Contains 32-byte value or empty\n   - EmptyNode: Represents empty subtrees\n\n## Tree Structure\n\nThe tree consists of three main node types:\n\n1. **Internal Nodes**: Binary branch nodes with left and right children\n2. **Stem Nodes**: Leaf groups containing up to 256 values sharing a common 31-byte prefix\n3. **Empty Nodes**: Represent empty branches/leaves\n\n## Usage\n\n```rust\nuse ubt::{BinaryTree, address_to_32};\nuse alloy_primitives::{Address, B256};\n// Create a new tree\nlet mut tree = BinaryTree::new();\n// Insert a key-value pair\nlet key = [0xAA; 32];\nlet value = B256::from([0xBB; 32]);\ntree.insert(key, value);\n// Get the root hash\nlet root = tree.root_hash();\n```\n\n## Implementation Details\n\nThe implementation provides:\n\n- Basic tree operations (insert, root hash computation)\n- Node type definitions (Internal, Stem)\n- Merkleization rules following the EIP specification\n- Helper functions for Ethereum address conversion\n\n## Contributing\n\nThis is a reference implementation to demonstrate the concepts in the EIP. Contributions and improvements are welcome.\n\n## License\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmw2000%2Fubt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmw2000%2Fubt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmw2000%2Fubt/lists"}