ERC-8309 Gateway mesh synchronization protocol (Gateway Mesh Sync Protocol for CCIP-Read)
Draft · Other · created 2026-06-13
A standard that lets CCIP-Read gateways periodically replicate each other's signed records, so that if one gateway goes down, another gateway can still serve the same data.
Why it is needed
CCIP-Read (ERC-3668) lets a contract point to an off-chain gateway, but the data ultimately lives on only that one gateway. If the single gateway holding the record goes down, the lookup itself fails even though the same data could in principle be reconstructed. Operators have patched around this with their own replication or centralized failover, but there was no standardized way to share signed records between different operators or implementations. As a result, it was impossible for multiple gateways to form a single mesh that replicated each other's data; trust (signature verification) had already been solved, but availability (whether the data is still alive) remained unresolved.
What to implement
event NodeRegistered(address indexed signer, string url);: An event emitted when a key is registered, recording the signer address and the URL the key claims.event NodeUpdated(address indexed signer, string url);: An event emitted when an already-registered key updates its URL.function register(string calldata url, bytes calldata signature) external returns (address signer);: Registers or updates the key that signed with signature, together with a URL, and returns the recovered signer address.function getNode(address signer) external view returns (string memory url, uint256 registeredAt);: Returns the URL registered by the given signer and the timestamp (block timestamp) of the last registration. Returns ("", 0) if never registered.function nodeCount() external view returns (uint256);: Returns the number of unique keys registered so far.function getNodes(uint256 offset, uint256 limit) external view returns (address[] memory signers, string[] memory urls, uint256[] memory timestamps);: Returns the list of keys in registration order, along with each one's URL and registration time, paginated by offset and limit.
In depth
The /records endpoint and queries
Each node serves records in the form GET /records?namespace=&since=&limit=&cursor=&protocol=. namespace is required, and since is compared not against the record's own timestamp but against the ingest time, the time the node received and stored that record. This is because a relayed record keeps its original timestamp, so filtering by timestamp could cause records that passed through a multi-hop path to be missed. Records are sorted by ascending ingest time, with ties broken by ascending inputHash and value, so that cursor pagination behaves reliably. limit cannot exceed the cap set by the node, and cursor is null when there are no more records to fetch. A polling interval of 30 seconds to 5 minutes is recommended, and since should be set with a margin (at least 60 seconds recommended) subtracted to cover clock skew between the two nodes.
Record commitment and signing
The object signed for a record is commitment = keccak256(abi.encodePacked(inputHash, namespace, keccak256(value), timestamp)). Since namespace is the only variable-length field and it sits between fixed-length fields, even abi.encodePacked cannot let two different combinations produce the same byte sequence. The signature uses ERC-191's personal_sign (version 0x45): 65 bytes (r||s||v, with v being 27 or 28) produced over keccak256("\x19Ethereum Signed Message:\n32" || commitment). The record itself carries no identifier of which node created it; the address recovered from the signature is the only evidence pointing to the origin node.
Deduplication and divergence
Deduplication merges only records that are completely identical across all three values: (inputHash, namespace, value). signature, timestamp, and sourcePeer are auxiliary information rather than part of a record's identity, so records signed by different signers over the same value are still merged (the one received first is kept). On the other hand, if there are two or more records with the same (inputHash, namespace) but different values, this is treated as a divergence: all of them must be preserved and all of them must be served via /records. A node's stored state for each (inputHash, namespace) is exactly one of three cases: a single value, a divergence, or none, and a node must not silently drop a divergence or present it as if consensus had been reached. A separate interpretation policy may be applied to the node's own query responses, but it cannot be applied to /records output.
Node identity and key rotation
A node maintains two kinds of keys: a long-term identity key, which never signs records and can be kept cold, and a signer key, which signs both records and the /vni document. The node's identity is fixed as nodeId = keccak256(identityKeyAddress), and peers pin this identity key. The identity key delegates the signer key by signing (nodeId, signerAddress, validFrom), and this delegation and the /vni document are exposed via GET /vni. To change the signer, the identity key simply issues a new delegation; since the nodeId does not change, existing peer pins are not broken. A node using a single key is treated as a special case where identityKey and signerAddress are the same and the delegation is empty (0x).
validFrom Monotonicity Check
For a given nodeId, a peer must only accept a new delegation if its validFrom is greater than the largest validFrom it has accepted so far, and this check applies equally to delegations re-fetched during rotation propagation. The peer must also reject any validFrom that lies in the future beyond the node's allowed clock skew tolerance. Without this lower bound, a race condition where two delegations are issued nearly simultaneously would leave it ambiguous which one is newer, a retired signer could be revived, and the re-fetch path would lose the guarantee that the pinned identity key's current signer is the most recently approved one.
Peer Discovery and NodeRegistry
A node can expose the list of peers it knows via GET /peers (URL, signerAddress, status, last sync time). However, since both the /peers contents and a record's sourcePeer are self-reported, a node must not trust a peer based solely on a self-reported URL or signerAddress, and must always verify the signer first via that peer's /vni document. The on-chain NodeRegistry is an optional discovery mechanism, a simple directory holding the URL a key claims, not a path for resolving delegations. Nodes found through the registry must also be verified via /vni before being pinned.
Protocol Versioning
The protocol field is a monotonically increasing integer included in every /records response, and this standard defines version 1. Versioning is declarative rather than negotiated: a node must first check whether a peer's protocol value matches a version it has implemented before accepting records, and if the version is unknown, it skips that peer without raising an error, logs it, and continues the next sync cycle. A node can advertise the versions it can handle via a supported_protocols array, letting peers select a compatible version without trial and error.
Proposal status
This ERC-8309 is in Draft status, written in June 2026. It has not yet undergone community review or reached consensus, so details such as the endpoint format, key structure, and registry interface may change going forward, or discussion may stall.
Things to watch out for
- Signer Pinning and Rotation: Peers pin the identity key (nodeId), not the signer, as the anchor. This means an attacker cannot covertly swap the signer, and rotation can only happen through a new delegation signed by the pinned identity key.
- Preventing Replay of Stale Rotations: A strict lower bound on validFrom per nodeId prevents replay attacks that would revert to a retired signer. This check also applies on the re-fetch path during rotation propagation. It also rejects a validFrom set too far in the future, preventing a situation where, if the identity key were compromised, a single future-dated delegation could block all subsequent rotations.
- Identity Key Compromise: An attacker holding the identity key can delegate to any signer. This standard does not define a recovery procedure for a compromised identity key; such a node must generate a new identity key (i.e., a new nodeId), and peers must manually re-pin it off-chain.
- Record Flooding and DoS: Since /records is a public endpoint, implementations must apply rate limiting, caps on limit values, and per-peer intake limits per cycle to prevent someone from flooding the mesh with useless records. Records without a valid signature are not verified, so they are also not propagated beyond the first hop.
- Registry Registration Replay: The NodeRegistry's registration signature covers only the URL and does not include the chain ID, contract address, or a nonce, so anyone can reuse a past signature to roll back a URL or copy it directly into another chain's registry. However, since the registry is merely a discovery hint and peers always verify via /vni before pinning, this replay cannot cause a forged record to be accepted.