Skip to content

Data Streams: RWA v8 #2851

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions public/samples/DataStreams/ClientReportsVerifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,17 @@ contract ClientReportsVerifier {
}

/**
* @dev Data Streams report schema v4 (RWA streams).
* @dev Data Streams report schema v8 (RWA streams).
*/
struct ReportV4 {
struct ReportV8 {
bytes32 feedId;
uint32 validFromTimestamp;
uint32 observationsTimestamp;
uint192 nativeFee;
uint192 linkFee;
uint32 expiresAt;
int192 price;
uint64 lastUpdateTimestamp;
int192 midPrice;
uint32 marketStatus;
}

Expand Down Expand Up @@ -140,11 +141,11 @@ contract ClientReportsVerifier {
// ----------------- Public API -----------------

/**
* @notice Verify a Data Streams report (schema v3 or v4).
* @notice Verify a Data Streams report (schema v3 or v8).
*
* @dev Steps:
* 1. Decode the unverified report to get `reportData`.
* 2. Read the first two bytes → schema version (`0x0003` or `0x0004`).
* 2. Read the first two bytes → schema version (`0x0003` or `0x0008`).
* - Revert if the version is unsupported.
* 3. Fee handling:
* - Query `s_feeManager()` on the proxy.
Expand All @@ -155,7 +156,7 @@ contract ClientReportsVerifier {
* 5. Decode the verified report into the correct struct and emit the price.
*
* @param unverifiedReport Full payload returned by Streams Direct.
* @custom:reverts InvalidReportVersion when schema ≠ v3/v4.
* @custom:reverts InvalidReportVersion when schema ≠ v3/v8.
*/
function verifyReport(bytes memory unverifiedReport) external {
// ─── 1. & 2. Extract reportData and schema version ──
Expand All @@ -166,7 +167,7 @@ contract ClientReportsVerifier {

uint16 reportVersion = (uint16(uint8(reportData[0])) << 8) |
uint16(uint8(reportData[1]));
if (reportVersion != 3 && reportVersion != 4)
if (reportVersion != 3 && reportVersion != 8)
revert InvalidReportVersion(reportVersion);

// ─── 3. Fee handling ──
Expand Down Expand Up @@ -204,7 +205,7 @@ contract ClientReportsVerifier {
lastDecodedPrice = price;
emit DecodedPrice(price);
} else {
int192 price = abi.decode(verified, (ReportV4)).price;
int192 price = abi.decode(verified, (ReportV8)).midPrice;
lastDecodedPrice = price;
emit DecodedPrice(price);
}
Expand Down
6 changes: 3 additions & 3 deletions src/config/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ export const SIDEBAR: Partial<Record<Sections, SectionEntry[]>> = {
children: [
{
title: "Report Schema v3 (Crypto)",
url: "data-streams/reference/report-schema",
url: "data-streams/reference/report-schema-v3",
},
{
title: "Report Schema v3 (DEX State Price)",
Expand All @@ -362,8 +362,8 @@ export const SIDEBAR: Partial<Record<Sections, SectionEntry[]>> = {
url: "data-streams/rwa-streams",
children: [
{
title: "Report Schema v4",
url: "data-streams/reference/report-schema-v4",
title: "Report Schema v8",
url: "data-streams/reference/report-schema-v8",
},
],
},
Expand Down
3 changes: 2 additions & 1 deletion src/content/data-streams/architecture.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ whatsnext:
"Learn more about the Standard API Implementation": "/data-streams/tutorials/api-go",
"Learn more about the Streams Trade Implementation": "/data-streams/streams-trade",
"Find the list of available Stream IDs": "/data-streams/crypto-streams",
"Find the schema of data to expect from Data Streams reports": "/data-streams/reference/report-schema",
"Find the schema of data to expect from Data Streams reports: Crypto": "/data-streams/reference/report-schema-v3",
"Find the schema of data to expect from Data Streams reports: RWA": "/data-streams/reference/report-schema-v8",
}
---

Expand Down
3 changes: 2 additions & 1 deletion src/content/data-streams/billing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ whatsnext:
{
"Learn the basics about how to retrieve Data Streams reports in the Getting Started guide.": "/data-streams/getting-started",
"Find the list of available Stream IDs.": "/data-streams/crypto-streams",
"Find the schema of data to expect from Data Streams reports.": "/data-streams/reference/report-schema",
"Find the schema of data to expect from Data Streams reports: Crypto": "/data-streams/reference/report-schema-v3",
"Find the schema of data to expect from Data Streams reports: RWA": "/data-streams/reference/report-schema-v8",
}
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ metadata:
whatsnext:
{
"Find the list of available Stream IDs.": "/data-streams/crypto-streams",
"Find the schema of data to expect from Data Streams reports.": "/data-streams/reference/report-schema",
"Find the schema of data to expect from Data Streams reports: Crypto": "/data-streams/reference/report-schema-v3",
"Find the schema of data to expect from Data Streams reports: RWA": "/data-streams/reference/report-schema-v8",
}
---

import DataStreams from "@features/data-streams/common/DataStreams.astro"

<DataStreams section="dsNotes" />

Chainlink Data Streams provides [reports](/data-streams/reference/report-schema) with a _Mid_ and _Liquidity-Weighted Bid and Ask (LWBA)_ prices. These three prices form a pricing spread that offers protocols insight into market activity based on the current state of the order books.
Chainlink Data Streams provides [reports](/data-streams/reference/report-schema-v3) with a _Mid_ and _Liquidity-Weighted Bid and Ask (LWBA)_ prices. These three prices form a pricing spread that offers protocols insight into market activity based on the current state of the order books.

**Note**: At the moment, only [Crypto streams](/data-streams/crypto-streams) provide LWBA prices.

Expand Down
3 changes: 2 additions & 1 deletion src/content/data-streams/developer-responsibilities.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ metadata:
whatsnext:
{
"Find the list of available Stream IDs": "/data-streams/crypto-streams",
"Find the schema of data to expect from Data Streams reports": "/data-streams/reference/report-schema",
"Find the schema of data to expect from Data Streams reports: Crypto": "/data-streams/reference/report-schema-v3",
"Find the schema of data to expect from Data Streams reports: RWA": "/data-streams/reference/report-schema-v8",
"Learn the basics about how to retrieve Data Streams reports using the Streams Trade implementation": "/data-streams/getting-started",
"Learn how to fetch and decode Data Streams reports using the Data Streams API": "/data-streams/tutorials/api-go",
}
Expand Down
5 changes: 3 additions & 2 deletions src/content/data-streams/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ whatsnext:
{
"Learn how to fetch and decode Data Streams reports with the API": "/data-streams/tutorials/api-go",
"Find the list of available Stream IDs": "/data-streams/crypto-streams",
"Find the schema of data to expect from Data Streams reports": "/data-streams/reference/report-schema",
"Find the schema of data to expect from Data Streams reports: Crypto": "/data-streams/reference/report-schema-v3",
"Find the schema of data to expect from Data Streams reports: RWA": "/data-streams/reference/report-schema-v8",
}
---

Expand Down Expand Up @@ -85,7 +86,7 @@ Access data directly through REST APIs or WebSocket connections using our SDKs:

1. Understand the Architecture: Review the [system components and data flow](/data-streams/architecture) to understand how Data Streams works.

1. Explore Available Data: Browse [available Stream IDs](/data-streams/crypto-streams) and [report schemas](/data-streams/reference/report-schema) to see what data is available.
1. Explore Available Data: Browse [available Stream IDs](/data-streams/crypto-streams) and [report schemas](/data-streams/reference/report-schema-v3) to see what data is available.

1. Try the API: Follow our [hands-on tutorial](/data-streams/tutorials/api-go) to fetch and decode your first report.

Expand Down
5 changes: 3 additions & 2 deletions src/content/data-streams/market-hours.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ whatsnext:
{
"Find the list of available Crypto streams": "/data-streams/crypto-streams",
"Find the list of available RWA streams": "/data-streams/rwa-streams",
"Find the schema of data to expect from Data Streams reports": "/data-streams/reference/report-schema",
"Find the schema of data to expect from Data Streams reports: Crypto": "/data-streams/reference/report-schema-v3",
"Find the schema of data to expect from Data Streams reports: RWA": "/data-streams/reference/report-schema-v8",
}
---

Expand All @@ -26,4 +27,4 @@ Markets for several assets are actively traded only during certain hours. Listed

## Real World Asset market status

Reports for Real World Asset (RWA) streams include the `marketStatus` value, which reflects the DON'S consensus on whether the market is currently open. For additional information, refer to the [RWA report schema](/data-streams/reference/report-schema-v4) page.
Reports for Real World Asset (RWA) streams include the `marketStatus` value, which reflects the DON'S consensus on whether the market is currently open. For additional information, refer to the [RWA report schema](/data-streams/reference/report-schema-v8) page.
4 changes: 2 additions & 2 deletions src/content/data-streams/reference/go-sdk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ Where `ID` is the unique identifier for the stream.

#### `FeedVersion` uint16

Represents the stream [report schema](/data-streams/reference/report-schema) version.
Represents the stream [report schema](/data-streams/reference/report-schema-v3) version.

```go
type FeedVersion uint16
Expand Down Expand Up @@ -329,7 +329,7 @@ import report "github.com/smartcontractkit/data-streams-sdk/go/report"

```go
type Data interface {
v1.Data | v2.Data | v3.Data | v4.Data
v1.Data | v2.Data | v3.Data | v4.Data | v8.Data | v9.Data
Schema() abi.Arguments
}
```
Expand Down
4 changes: 2 additions & 2 deletions src/content/data-streams/reference/report-schema-v3-dex.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import { PageTabs } from "@components"
url: "/data-streams/reference/report-schema-v3-dex",
},
{
name: "Real World Asset (RWA) Report Schema (v4)",
url: "/data-streams/reference/report-schema-v4",
name: "RWA Report Schema (v8)",
url: "/data-streams/reference/report-schema-v8",
},
]}
headerTitle="Available Report Schemas"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,23 @@ import { PageTabs } from "@components"

<PageTabs
pages={[

{
name: "Cryptocurrency Report Schema (v3)",
url: "/data-streams/reference/report-schema",
url: "/data-streams/reference/report-schema-v3",
},
{
name: "DEX State Price Report Schema (v3)",
url: "/data-streams/reference/report-schema-v3-dex",
},
{
name: "Real World Asset (RWA) Report Schema (v4)",
url: "/data-streams/reference/report-schema-v4",
},
]}
headerTitle="Available Report Schemas"
headerDescription="Choose the schema version you want to explore."
name: "RWA Report Schema (v8)",
url: "/data-streams/reference/report-schema-v8",
}

]}
headerTitle="Available Report Schemas"
headerDescription="Choose the schema version you want to explore."
/>

Cryptocurrency streams adhere to the report schema outlined below.
Expand All @@ -45,7 +47,7 @@ Cryptocurrency streams adhere to the report schema outlined below.
| `nativeFee` | `uint192` | Verification cost in native blockchain tokens |
| `linkFee` | `uint192` | Verification cost in LINK tokens |
| `expiresAt` | `uint32` | Timestamp when this report expires |
| `price` | `int192` | DON consensus median price (18 decimal places) |
| `price` | `int192` | DON consensus median price |
| `bid` | `int192` | Simulated buy impact price at X% liquidity depth |
| `ask` | `int192` | Simulated sell impact price at X% liquidity depth |

Expand Down
27 changes: 19 additions & 8 deletions src/content/data-streams/reference/report-schema-v4.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,46 @@ section: dataStreams
date: Last Modified
title: "Report Schemas"
metadata:
title: "Real World Asset (RWA) Report Schema (v4) | Chainlink Data Streams"
title: "Real World Asset (RWA) Report Schema (v4) (Deprecated) | Chainlink Data Streams"
description: "Learn about Chainlink Data Streams Real World Asset (RWA) report schema (v4), including fields, encoding, and examples for integrating RWA data in your applications."
keywords: ["Report Schema", "RWA", "Real World Assets", "v4 Schema", "Data Format", "Report Structure"]
---

import DataStreams from "@features/data-streams/common/DataStreams.astro"
import { PageTabs } from "@components"
import { Aside, PageTabs } from "@components"

<DataStreams section="dsNotes" />

<PageTabs
pages={[

{
name: "Cryptocurrency Report Schema (v3)",
url: "/data-streams/reference/report-schema",
url: "/data-streams/reference/report-schema-v3",
},
{
name: "DEX State Price Report Schema (v3)",
url: "/data-streams/reference/report-schema-v3-dex",
},
{
name: "Real World Asset (RWA) Report Schema (v4)",
name: "(Deprecated) RWA Report Schema (v4)",
url: "/data-streams/reference/report-schema-v4",
},
]}
headerTitle="Available Report Schemas"
headerDescription="Choose the schema version you want to explore."
{
name: "RWA Report Schema (v8)",
url: "/data-streams/reference/report-schema-v8",
},

]}
headerTitle="Available Report Schemas"
headerDescription="Choose the schema version you want to explore."
/>

<Aside type="danger">
The v4 report schema is deprecated. View the [v8 report schema](/data-streams/reference/report-schema-v8) for the
latest RWA report schema.
</Aside>

Real World Asset (RWA) streams adhere to the report schema outlined below.

## Schema Fields
Expand All @@ -44,7 +55,7 @@ Real World Asset (RWA) streams adhere to the report schema outlined below.
| `nativeFee` | `uint192` | The cost to verify this report onchain when paying with the blockchain's native token |
| `linkFee` | `uint192` | The cost to verify this report onchain when paying with LINK |
| `expiresAt` | `uint32` | The expiration date of this report |
| `price` | `int192` | The DON's consensus median price for this report carried to 18 decimal places |
| `price` | `int192` | The DON's consensus median price |
| `marketStatus` | `uint32` | The DON's consensus on whether the market is currently open. Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). |

**Notes**:
Expand Down
47 changes: 47 additions & 0 deletions src/content/data-streams/reference/report-schema-v8.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
section: dataStreams
date: Last Modified
title: "Report Schemas"
metadata:
title: "Real World Asset (RWA) Report Schema (v8) | Chainlink Data Streams"
description: "Learn about Chainlink Data Streams Real World Asset (RWA) report schema (v8), including fields, encoding, and examples for integrating RWA data in your applications."
keywords: ["Report Schema", "RWA", "Real World Assets", "v8 Schema", "Data Format", "Report Structure"]
---

import DataStreams from "@features/data-streams/common/DataStreams.astro"
import { PageTabs } from "@components"

<DataStreams section="dsNotes" />

<PageTabs
pages={[

{
name: "Cryptocurrency Report Schema (v3)",
url: "/data-streams/reference/report-schema-v3",
},
{
name: "RWA Report Schema (v8)",
url: "/data-streams/reference/report-schema-v8",
},

]}
headerTitle="Available Report Schemas"
headerDescription="Choose the schema version you want to explore."
/>

RWA streams adhere to the report schema outlined below.

### Schema Fields

| Value | Type | Description |
| ----------------------- | --------- | ----------------------------------------------------------------------------------------------------------- |
| `feedID` | `bytes32` | Unique identifier for the Data Streams feed |
| `validFromTimestamp` | `uint32` | Earliest timestamp when the price is valid |
| `observationsTimestamp` | `uint32` | Latest timestamp when the price is valid |
| `nativeFee` | `uint192` | Cost to verify report onchain (native token) |
| `linkFee` | `uint192` | Cost to verify report onchain (LINK) |
| `expiresAt` | `uint32` | Expiration date of the report |
| `lastUpdateTimestamp` | `uint64` | Timestamp of the last valid price update |
| `midPrice` | `int192` | DON's consensus median price |
| `marketStatus` | `uint32` | [Market status](/data-streams/market-hours). Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`) |
21 changes: 11 additions & 10 deletions src/content/data-streams/reference/rust-sdk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The [Data Streams SDK for Rust](https://github.com/smartcontractkit/data-streams

- **REST API Client**: Fetch point-in-time data from Data Streams
- **WebSocket Client**: Stream real-time data with automatic reconnection
- **Report Decoding**: Built-in support for decoding and validating multiple report formats (V3, V4)
- **Report Decoding**: Built-in support for decoding and validating multiple report formats (V3, V8)
- **High Availability**: WebSocket connection management with failover support
- **Tracing Support**: Optional logging via the [`tracing`](https://crates.io/crates/tracing) crate
- **Async/Await**: Built on Tokio for efficient async operations
Expand All @@ -72,10 +72,10 @@ The SDK provides several feature flags to customize its functionality:

## Report Types

The Rust SDK supports multiple report formats, including **V3 (Crypto)** and **V4 (RWA)**. For the complete list of fields and their detailed descriptions, refer to the dedicated schema pages:
The Rust SDK supports multiple report formats, including **V3 (Crypto)** and **V8 (RWA)**. For the complete list of fields and their detailed descriptions, refer to the dedicated schema pages:

- [V3 (Cryptocurrency) Report Schema](/data-streams/reference/report-schema)
- [V4 (RWA) Report Schema](/data-streams/reference/report-schema-v4)
- [V3 (Cryptocurrency) Report Schema](/data-streams/reference/report-schema-v3)
- [V8 (RWA) Report Schema](/data-streams/reference/report-schema-v8)

Below are basic code snippets for decoding these reports with the SDK:

Expand All @@ -95,22 +95,23 @@ println!("Ask: {}", report_data.ask);
// ... etc.
```

For more details on every field in V3 (Crypto) reports, see the [V3 report schema page](/data-streams/reference/report-schema).
For more details on every field in V3 (Crypto) reports, see the [V3 report schema page](/data-streams/reference/report-schema-v3).

### V4 Reports (RWA Streams)
### V8 Reports (RWA Streams)

```rust
use chainlink_data_streams_report::report::v4::ReportDataV4;
use chainlink_data_streams_report::report::v8::ReportDataV8;

let report_data = ReportDataV4::decode(&report_blob)?;
let report_data = ReportDataV8::decode(&report_blob)?;

// Example usage:
println!("Price: {}", report_data.price);
println!("Mid Price: {}", report_data.mid_price);
println!("Market Status: {}", report_data.market_status);

// ... etc.
```

For more details on every field in V4 (RWA) reports, see the [V4 report schema page](/data-streams/reference/report-schema-v4).
For more details on every field in v8 (RWA) reports, see the [V8 report schema page](/data-streams/reference/report-schema-v8).

## Authentication

Expand Down
Loading
Loading