{"id":13794726,"url":"https://github.com/holochain/holochain-anchors","last_synced_at":"2025-12-12T14:29:28.267Z","repository":{"id":57634410,"uuid":"225789936","full_name":"holochain/holochain-anchors","owner":"holochain","description":"A core pattern for storing AND FINDING data in a Holochain DHT. Anchors are a predictable hash (by using known content) from which you can attach links","archived":true,"fork":false,"pushed_at":"2020-10-02T13:14:18.000Z","size":38,"stargazers_count":38,"open_issues_count":3,"forks_count":6,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-05-06T02:44:46.358Z","etag":null,"topics":["graph-db","holochain","holochain-application","mixin"],"latest_commit_sha":null,"homepage":"","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/holochain.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-12-04T05:52:32.000Z","updated_at":"2025-01-15T13:35:33.000Z","dependencies_parsed_at":"2022-09-16T04:01:39.903Z","dependency_job_id":null,"html_url":"https://github.com/holochain/holochain-anchors","commit_stats":null,"previous_names":["holochain/holochain_anchors"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holochain%2Fholochain-anchors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holochain%2Fholochain-anchors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holochain%2Fholochain-anchors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holochain%2Fholochain-anchors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/holochain","download_url":"https://codeload.github.com/holochain/holochain-anchors/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253825157,"owners_count":21970142,"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":["graph-db","holochain","holochain-application","mixin"],"created_at":"2024-08-03T23:00:46.874Z","updated_at":"2025-12-12T14:29:23.227Z","avatar_url":"https://github.com/holochain.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Holochain Anchors\nNOTE: In [Holochain RSM](https://github.com/holochain/holochain) anchors is has been built into core\n\nThis crate allows a [Holochain-redux](https://github.com/holochain/holochain-rust) project to easily use the anchors pattern for creating links.\n\n## Install\nAdd the following to your zomes cargo toml.\n```\nholochain_anchors = \"0.2.3\"\n```\n\n## Usage\nAdd the anchor entry def to your zome.\n```rust\n #[entry_def]\nfn anchor_def() -\u003e ValidatingEntryType {\n    holochain_anchors::anchor_definition()\n}\n```\nLink from the `ANCHOR_TYPE`\n```rust\nlinks: [\n    from!(\n        holochain_anchors::ANCHOR_TYPE,\n        link_type: \"my_link_type\",\n        validation_package: || {\n            hdk::ValidationPackageDefinition::Entry\n        },\n\n        validation: |_validation_data: hdk::LinkValidationData| {\n            Ok(())\n        }\n    )\n]\n```\nCreate an anchor and link an entry to it.\nIf the anchor already exists then it will use the existing anchor.\n```rust\nlet my_entry = Entry::App(\n    \"my_entry\".into(),\n        MyEntry{\n        content: \"some_content\".into()\n    }.into()\n);\nlet address = hdk::commit_entry(\u0026my_entry)?;\nlet anchor_address = holochain_anchors::anchor(\"my_anchor_type\".into(), \"my_anchor\".into())?;\nhdk::link_entries(\u0026anchor_address, \u0026address, \"my_link_type\", \"my_anchor\")?;\n```\nGet all the links on that anchor.\n```rust\nlet anchor_address = holochain_anchors::anchor(\"my_anchor_type\".into(), \"my_anchor\".into())?;\nhdk::utils::get_links_and_load_type(\u0026anchor_address, LinkMatch::Exactly(\"my_link_type\"), LinkMatch::Any)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholochain%2Fholochain-anchors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fholochain%2Fholochain-anchors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholochain%2Fholochain-anchors/lists"}