Skip to main content

Simplified DevX

Polymer's cross-chain proof system works in just 4 steps. Here are code snippets showing the complete end-to-end flow using our State Sync example:

The Flow: App Emit event (App Contract) → Request proof (Prove API) → Submit to destination (App Contract) → Get validated data (Prover Contract)

Process Overview

  1. Application emits event - Application emits event as per their custom struct for example ValueSet event emission with both indexed and non-indexed parameters

  2. Request proof from API - Demonstrates the API request/polling pattern with actual parameters

  3. Submit proof to destination - Shows the single method call i.e validateEvent that takes the proof as input and in called in application's execution flow

  4. Validate & extract data - Highlights how the complete event data is extracted along with other validation params like source chain and contract address

4-Step Process in Action: State Sync Example

// Application function called by user that emits source event
function setValue(string calldata key, bytes calldata value) external {
// ... logic ...

emit ValueSet(
msg.sender, // indexed (topic)
key, // not indexed (data)
value, // not indexed (data)
currentNonce, // not indexed (data)
hashedKey, // indexed (topic)
newVersion // not indexed (data)
);
}
info

Real Impact: This enables apps to set a key-value pair on Optimism and automatically sync it across multiple chains in seconds, eliminating the need for costly cross-chain messaging.