Trying to explain a problem and a use case...

The problem is pretty well described by The Fallacies of Distributed Computing. To repeat the list here: 1. The network is reliable; 2. Latency is zero; 3. Bandwidth is infinite; 4. The network is secure; 5. Topology doesn't change; 6. There is one administrator; 7. Transport cost is zero; 8. The network is homogeneous.

(Remember, those are all fallacies.)

And we, in ActivityPub and Holochain environments, are trying to implement economic networks, including agreements among 2 (and sometimes more than 2) independent agents living in different nodes in distributed networks.

What could go wrong? For example...

  1. The network will go down.
  2. The messages between nodes will time-out.
  3. Not enough bandwidth.
  4. Hostile actors interfere or harvest private info for bad purposes.
  5. The connections between nodes that you used before no longer exist.
  6. There are two or more admins and they disagree.
  7. That conversation ate up your whole budget and your host shuts you down
  8. You're using ActivityPub and they are using their latest invention.

Regardless, we want to implement scenarios like Conversation for Action which involves a somewhat complex distributed state machine:

CfA state machine

That's a conversation between two agents, A and B. Could be more. Regardless, each state change requires agreement among all of the participating agents. Each of those agreements will require a distributed 2-phase commit transaction. Each of those transactional agreements could fail because of any of those problems.

So that's the problem. How do we do that reliably?

One building block is Post Exactly Once for which many implementations can be found via that web search.

But we will need to implement a distributed app that can manage that whole conversation reliably...