Module hdk::entry[][src]

Working with app and system entries.

Most holochain applications will define their own app entry types.

App entries are all entries that are not system entries. They are defined in the entry_defs callback and then the application can call CRUD functions with them.

CRUD in holochain is represented as a graph/tree of Elements referencing each other (via Header hashes) representing new states of a shared identity. Because the network is always subject to the possibility of partitions, there is no way to assert an objective truth about the ‘current’ or ‘real’ value that all participants will agree on. This is a key difference between holochain and blockchains. Where blockchains define a consensus algorithm that brings all participants as close as possible to a single value while holochain lets each participant discover their own truth.

The practical implication of this is that agents fetch as much information as they can from the network then follow an algorithm to ‘walk’ or ‘reduce’ the revisions and discover ‘current’ for themselves.

In holochain terms, blockchain consensus is walking all the known ‘updates’ (blocks) that pass validation then walking/reducing down them to disover the ‘chain with the most work’ or similar. For example, to implement a blockchain in holochain, attach a proof of work to each update and then follow the updates with the most work to the end.

There are many other ways to discover the correct path through updates, for example a friendly game of chess between two players could involve consensual re-orgs or ‘undos’ of moves by countersigning a different update higher up the tree, to branch out a new revision history.

Two agents with the same information may even disagree on the ‘correct’ path through updates and this may be valid for a particular application. For example, an agent could choose to ‘block’ another agent and ignore all their updates.



Trait for binding static EntryDef property access for a type. See register_entry



General function that can create any entry type.


Create an app entry.


General function that can delete any entry type.


Alias to delete


Gets an element for a given entry or header hash.


Get an element from the hash AND the details for the entry or header hash passed in. Returns None if the entry/header does not exist. The details returned are a contextual mix of elements and header hashes, see below.


Hash anything that that implements TryInto<Entry> .


Update any entry type.


Thin wrapper around update for app entries. The hash is the HeaderHash of the deleted element, the input is a TryInto<EntryWithDefId> .