{"id":22271193,"url":"https://github.com/gunh0/merkle-tree","last_synced_at":"2025-07-07T07:38:49.601Z","repository":{"id":207878066,"uuid":"622101955","full_name":"gunh0/merkle-tree","owner":"gunh0","description":"🌲 Merkle Tree in Go","archived":false,"fork":false,"pushed_at":"2023-11-18T06:06:01.000Z","size":7,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-30T14:18:24.747Z","etag":null,"topics":["cryptography","golang","hash"],"latest_commit_sha":null,"homepage":"","language":"Go","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/gunh0.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}},"created_at":"2023-04-01T05:55:04.000Z","updated_at":"2024-04-03T01:48:02.000Z","dependencies_parsed_at":"2023-11-18T07:23:38.181Z","dependency_job_id":"40c43a01-7935-464c-850d-e5d7915436b0","html_url":"https://github.com/gunh0/merkle-tree","commit_stats":null,"previous_names":["gunh0/merkle-tree"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gunh0%2Fmerkle-tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gunh0%2Fmerkle-tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gunh0%2Fmerkle-tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gunh0%2Fmerkle-tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gunh0","download_url":"https://codeload.github.com/gunh0/merkle-tree/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245495378,"owners_count":20624805,"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":["cryptography","golang","hash"],"created_at":"2024-12-03T12:11:02.671Z","updated_at":"2025-03-25T15:51:29.380Z","avatar_url":"https://github.com/gunh0.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Merkle Tree Implementation in Go\n\nThis is a simple implementation of a Merkle tree in Go, based on the SHA-256 hash function.\n\n\u003cbr/\u003e\n\n### Overview\n\nThe Merkle tree is a tree structure used in cryptography and computer science to efficiently verify the contents of large data sets. It allows the efficient and secure verification of the contents of a large data set by dividing it into smaller chunks and creating a hash tree out of them.\n\nIn this implementation, the tree is created by first hashing all the data elements using SHA-256, and then building the tree recursively by hashing pairs of nodes until a single root node is produced. Each non-leaf node in the tree is the hash of its two child nodes, and the root node is the hash of all the data elements.\n\n### Usage\n\nThe main function in the main.go file provides an example of how to use this implementation. It creates a Merkle tree from a slice of byte arrays, and then prints out the entire tree using the printTree function.\n\nTo use this implementation in your own code, you can import the merkle package and use the NewTree function to create a Merkle tree from a slice of byte arrays. The NewTree function returns the root node of the tree, which you can then use to traverse the tree and verify the contents of the data set.\n\n\u003cbr/\u003e\n\n### Output\n\n```bash\ngo run main.go\n└── 2846362fb3dce03001286fe9a997206a0ade591d5bddbfed0a7a9901bac798cc\n    ├── 7305db9b2abccd706c256db3d97e5ff48d677cfe4d3a5904afb7da0e3950e1e2\n    │   ├── 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824\n    │   └── 486ea46224d1bb4fb680f34f7c9ad96a8f24ec88be73ea8e5a6c65260e9cb8a7\n    └── 487e8e3fb58ea5fc6855763fe7a918bda75f564dd0649d8c6b7aefb6f23bd094\n        ├── 7975edd9e7393c229e744913fe0d0bb86fb4cf46906e2e51152137e20ad15590\n        └── dc9c5edb8b2d479e697b4b0b8ab874f32b325138598ce9e7b759eb8292110622\n```\n\n```bash\n# docker-compose up\n\n...\n\n[+] Building 0.0s (0/0)                                                                                                                                                                                                            docker:desktop-linux\n[+] Running 2/2\n ✔ Network merkle-tree_default  Created                                                                                                                                                                                                            0.0s\n ✔ Container merkle-tree        Created                                                                                                                                                                                                            0.4s\nAttaching to merkle-tree\nmerkle-tree  | └── 2846362fb3dce03001286fe9a997206a0ade591d5bddbfed0a7a9901bac798cc\nmerkle-tree  |     ├── 7305db9b2abccd706c256db3d97e5ff48d677cfe4d3a5904afb7da0e3950e1e2\nmerkle-tree  |     │   ├── 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824\nmerkle-tree  |     │   └── 486ea46224d1bb4fb680f34f7c9ad96a8f24ec88be73ea8e5a6c65260e9cb8a7\nmerkle-tree  |     └── 487e8e3fb58ea5fc6855763fe7a918bda75f564dd0649d8c6b7aefb6f23bd094\nmerkle-tree  |         ├── 7975edd9e7393c229e744913fe0d0bb86fb4cf46906e2e51152137e20ad15590\nmerkle-tree  |         └── dc9c5edb8b2d479e697b4b0b8ab874f32b325138598ce9e7b759eb8292110622\nmerkle-tree exited with code 0\n```\n\n\u003cbr/\u003e\n\n### Dependencies\n\nThis implementation uses the crypto/sha256 package to compute SHA-256 hashes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgunh0%2Fmerkle-tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgunh0%2Fmerkle-tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgunh0%2Fmerkle-tree/lists"}