Skip to content

Peer sync

ConsensusCore connects a Chronicle to an INetworkConnection. On a local state change it calls generateSyncMessage() and sends a base64-encoded Automerge sync message to peers. A received sync message is validated, passed to receiveSyncMessage(), and may produce an acknowledgement. The Chronicles converge through Automerge semantics; the transport does not interpret game rules.

The relay-assisted path is therefore not server-authoritative:

Engine → Chronicle → ConsensusCore → transport → peer Chronicle

Messages are sent to peers other than the source of a change to avoid an echo loop. net:message exposes application messages; sync-message validation is owned by ConsensusCore, and handlers must use the transport-assigned fromPeerId, not an application-supplied sender field.

Relay peer IDs are connection-scoped identifiers. They can change after a reconnect and are not durable authenticated identities. Establish a separate identity and authentication scheme when that distinction matters.