The event graph represents sequential events in an asynchronous environment.
Events can form small forks which should be quickly reconciled as new nodes are added to the structure and pull them in.
Ties are broken using the timestamps inside the events.
The main purpose of the graph is synchronization. This allows nodes in the network maintain a fully synced store of objects. How those objects are interpreted is up to the application.
We add a little more information about the objects which is that they are events with a timestamp, which allows our algorithm to be more intelligent.
Each node is read-only and this is an append-only data structure. However the application may wish to prune old data from the store to conserve memory.
Nodes in the event graph are active, whereas nodes not yet in the graph are orphans.
When node A receives an event from node B, it will check whether all parents are in the active pool. If there are missing parents then:
Once a node is successfully added to the active pool, and linked in the event graph, then
we call reorganize(). This function loops through all the orphans, and tries to relink
them with the active pool. If there are any missing parents, then they are added back to
the orphan pool.
In this example A creates a new event. Since the event is new, it is impossible for
any nodes in the network to possess it, so A does not need to send an inv.
event to $B_1, \dots, B_n$inv representing the event.p2p.broadcast(inv).inv confirming they received it.inv confirms, it will wait for 1 minute and then
resend the event message.Upon receiving an inv:
getevent.getevent, and sends event back.So in this diagram, A will send event to $B_1, \dots, B_6$. Each $B_i$ will respond
back to A with inv, and A will stop sending event. Each one of $C_1, \dots, C_3$
also receive inv, and since they don't have the event, they will send back to $B_3$,
a getevent message. $B_3$ will send them the event.
All nodes start with a single hardcoded genesis event in their graph. The application layer should ignore this event. This serves as the origin event for synchronization.