Skip to content

Commit a6f7d62

Browse files
Peolite1Peolite001
andauthored
docs: add cross-chain announcement format spec (#102)
Co-authored-by: Peolite001 <peolite001@gmail.com>
1 parent 154f05a commit a6f7d62

1 file changed

Lines changed: 85 additions & 0 deletions

File tree

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
title: "Cross-Chain Announcement Format"
3+
description: "Normative specification for cross-chain announcements emitted by Wraith Protocol."
4+
---
5+
6+
# Cross-Chain Announcement Format Specification
7+
8+
**Status**: Normative
9+
**Reviewed By**: SDK Maintainer
10+
11+
This document specifies the normative announcement format for Wraith Protocol across all supported chains. Third-party indexers MUST adhere to this specification to correctly parse and process cross-chain events.
12+
13+
## Common Canonical Form (JSON)
14+
15+
The SDK normalizes all chain-specific announcements into a common canonical JSON format.
16+
17+
```json
18+
{
19+
"eventId": "string (unique identifier)",
20+
"sourceChain": "string (e.g., 'evm', 'solana', 'ckb', 'stellar')",
21+
"topic": "string (normalized event type)",
22+
"timestamp": "number (UNIX epoch)",
23+
"payload": {
24+
// Event-specific data
25+
}
26+
}
27+
```
28+
29+
## Per-Chain Event Topic and Payload Shape
30+
31+
Every chain emits announcements slightly differently. Below is the specification for each currently supported chain.
32+
33+
### CKB
34+
35+
* **Event Topic**: `WraithAnnouncement`
36+
* **Payload Shape**:
37+
```json
38+
{
39+
"cell_dep": "string (OutPoint)",
40+
"data": "string (Hex-encoded announcement data)"
41+
}
42+
```
43+
44+
### EVM
45+
46+
* **Event Topic**: `AnnouncementEvent(bytes32 indexed topic, bytes data)`
47+
* **Payload Shape**:
48+
```json
49+
{
50+
"contractAddress": "string (Hex address)",
51+
"topicHash": "string (Hex bytes32)",
52+
"data": "string (Hex encoded bytes)"
53+
}
54+
```
55+
56+
### Solana
57+
58+
* **Event Topic**: `WraithAnnouncementLog`
59+
* **Payload Shape**:
60+
```json
61+
{
62+
"programId": "string (Base58)",
63+
"instructionData": "string (Base64 encoded announcement data)"
64+
}
65+
```
66+
67+
### Stellar
68+
69+
* **Event Topic**: `WRAITH_ANNOUNCEMENT`
70+
* **Payload Shape**:
71+
```json
72+
{
73+
"contractId": "string (Contract ID)",
74+
"topic": "string (Symbol)",
75+
"data": "string (XDR encoded ScVal)"
76+
}
77+
```
78+
79+
## Extensibility Notes for Future Chains
80+
81+
When integrating future chains into the Wraith Protocol SDK, the following guidelines MUST be followed:
82+
1. **Unique Source Chain Identifier**: The new chain must be assigned a unique `sourceChain` identifier.
83+
2. **Deterministic Event IDs**: The `eventId` must be deterministically generated using the chain's native transaction hash or log index to ensure uniqueness across the network.
84+
3. **Payload Normalization**: The SDK implementation for the new chain must map the native event data into the common canonical `payload` structure.
85+
4. **Documentation**: This normative specification must be updated to include the new chain's event topic and native payload shape.

0 commit comments

Comments
 (0)