Holochain Forum

Entity Content

Problem

How do I figure out what content to include in my Entity? How do I figure out when larger things need to be broken into multiple entities and not mixup what should be stored as links?

Solution

From @artbrock: Holochain DHT and chain entries are Content Addressable Spaces. The key MUST be the hash of the content. This is part of what ensures tamper-proof data integrity, and so you always know you got back the unaltered content that you requested – Self-integrity check. If you want to address something by name, you make an Anchor.

This still leaves lots of room for flexibility based on your specific use cases. A larger entity can be made smaller by breaking it into multiple entities with relationships between them, but you must then include these foreign keys in the entity so that it will be unique. Since the entire entity must be added, updated, or deleted as a single operation, try to design the data structure to minimize the net total of entries to the DHT.

Implementation

Warnings

What about data that isn’t necessary to uniquely identify an entity? Should this always be stored separately?

Related Patterns

Use the Anchor to find your entities.