When people ask about consensus, what they really want to know is how users can agree on the “facts” of their interactions, technically known as data integrity. Holochain applications (hApps) maintain data integrity without the need for blockchain-style global consensus.
Things in the real world—atoms, cells, bodies—maintain the integrity of their individual and collective state just fine without consensus on a global ledger. In the same way, Holochain’s approach to data-integrity is agent-centric, rather than data-centric, with each node being like a cell that maintains its own state while remaining bound to the physical and biological constraints of the ecosystem in which it lives.
The “biological constraints” of a hApp are encoded in its validation rules—the DNA of the application. These rules are the only things nodes in a hApp need to maintain global consensus. With these rules as the foundation, each user keeps an immutable record of their own actions on a local hash-chain, DNA being the first entry on the chain. Each tweet, vote on a poll, or currency transaction (depending on the hApp) would be an additional entry on the agent’s chain for that application.
Keep in mind that Holochain is not a platform like Ethereum, where every dApp runs on the same network. Each hApp has its own validation rules and its own separate network. If an agent tries to cheat by tampering with their copy of the validation rules, they fork themselves off into a separate, lonely hApp just for them.
Each hash-chain entry is cryptographically signed to prove authorship and ensure accountability. Multi-party interactions (e.g., transactions) are mutually countersigned to each party’s chain, and peers are able to audit each other’s chains before agreeing to an interaction or transaction.
Nodes can then share data with each other via a distributed hash-table (DHT), the same technology underlying BitTorrent’s peer-to-peer file sharing protocol. What’s different about Holochain’s DHT is that it also ensures that the shared data follows validation rules.
To share data, an agent’s device sends it to a subset of random peers (randomness defends against collusion) based on the similarity of their public key hashes to the hash of the data being shared. These random devices check that the shared data follows the rules of the application. The data is rejected if it breaks the rules. If it follows the rules, the validator marks it valid, signs that statement, and propagates the data by gossiping to the network.
If a node is found to be propagating or validating bad data, that node is blocked and a warning is sent to others via gossip. This effectively blacklists bad actors from participating in the app.
Additional measures to defend against flooding the network with fake validators are customizable for each application. A messaging app may only need basic protections, such as using email verification, whereas a supply chain handling million-dollar transactions may require vouching from industry peers, an invitation code, and government ID verification to join the network.
It’s worth noting that consensus algorithms can be built on Holochain if desired, though they would have the same unnecessary wastefulness and inflexibility of blockchains. We have been able to map an alternate approach for every situation that seemed to need an absolute sequence of events or global consensus. We found solutions that do not have those requirements.