diff --git a/public/samples/DataStreams/ClientReportsVerifier.sol b/public/samples/DataStreams/ClientReportsVerifier.sol index 708f1dc9eab..ad4d7155532 100644 --- a/public/samples/DataStreams/ClientReportsVerifier.sol +++ b/public/samples/DataStreams/ClientReportsVerifier.sol @@ -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; } @@ -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. @@ -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 ── @@ -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 ── @@ -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); } diff --git a/src/config/sidebar.ts b/src/config/sidebar.ts index 009145c7114..b86099f1240 100644 --- a/src/config/sidebar.ts +++ b/src/config/sidebar.ts @@ -349,7 +349,7 @@ export const SIDEBAR: Partial> = { 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)", @@ -362,8 +362,8 @@ export const SIDEBAR: Partial> = { 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", }, ], }, diff --git a/src/content/data-streams/architecture.mdx b/src/content/data-streams/architecture.mdx index 0e897432341..47ad5909dae 100644 --- a/src/content/data-streams/architecture.mdx +++ b/src/content/data-streams/architecture.mdx @@ -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", } --- diff --git a/src/content/data-streams/billing.mdx b/src/content/data-streams/billing.mdx index 644ccad29d8..5ac1b14b781 100644 --- a/src/content/data-streams/billing.mdx +++ b/src/content/data-streams/billing.mdx @@ -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", } --- diff --git a/src/content/data-streams/concepts/liquidity-weighted-prices.mdx b/src/content/data-streams/concepts/liquidity-weighted-prices.mdx index 8723ab080b1..cfbb2b177c3 100644 --- a/src/content/data-streams/concepts/liquidity-weighted-prices.mdx +++ b/src/content/data-streams/concepts/liquidity-weighted-prices.mdx @@ -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", } --- @@ -16,7 +17,7 @@ import DataStreams from "@features/data-streams/common/DataStreams.astro" -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. diff --git a/src/content/data-streams/developer-responsibilities.mdx b/src/content/data-streams/developer-responsibilities.mdx index 109e1d94644..db352e26ccd 100644 --- a/src/content/data-streams/developer-responsibilities.mdx +++ b/src/content/data-streams/developer-responsibilities.mdx @@ -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", } diff --git a/src/content/data-streams/index.mdx b/src/content/data-streams/index.mdx index 89392d9487f..d74fd0662a3 100644 --- a/src/content/data-streams/index.mdx +++ b/src/content/data-streams/index.mdx @@ -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", } --- @@ -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. diff --git a/src/content/data-streams/market-hours.mdx b/src/content/data-streams/market-hours.mdx index d09b8759d20..a38af0e30f9 100644 --- a/src/content/data-streams/market-hours.mdx +++ b/src/content/data-streams/market-hours.mdx @@ -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", } --- @@ -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. diff --git a/src/content/data-streams/reference/go-sdk.mdx b/src/content/data-streams/reference/go-sdk.mdx index 8f3866fa63c..d8d35a725b6 100644 --- a/src/content/data-streams/reference/go-sdk.mdx +++ b/src/content/data-streams/reference/go-sdk.mdx @@ -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 @@ -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 } ``` diff --git a/src/content/data-streams/reference/report-schema-v3-dex.mdx b/src/content/data-streams/reference/report-schema-v3-dex.mdx index 3e3345d627f..64f842ae1c1 100644 --- a/src/content/data-streams/reference/report-schema-v3-dex.mdx +++ b/src/content/data-streams/reference/report-schema-v3-dex.mdx @@ -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" diff --git a/src/content/data-streams/reference/report-schema.mdx b/src/content/data-streams/reference/report-schema-v3.mdx similarity index 86% rename from src/content/data-streams/reference/report-schema.mdx rename to src/content/data-streams/reference/report-schema-v3.mdx index 1382df39060..90b2fa2232f 100644 --- a/src/content/data-streams/reference/report-schema.mdx +++ b/src/content/data-streams/reference/report-schema-v3.mdx @@ -16,21 +16,23 @@ import { PageTabs } from "@components" Cryptocurrency streams adhere to the report schema outlined below. @@ -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 | diff --git a/src/content/data-streams/reference/report-schema-v4.mdx b/src/content/data-streams/reference/report-schema-v4.mdx index 46009a76c2c..47c4fe8f83c 100644 --- a/src/content/data-streams/reference/report-schema-v4.mdx +++ b/src/content/data-streams/reference/report-schema-v4.mdx @@ -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" + + Real World Asset (RWA) streams adhere to the report schema outlined below. ## Schema Fields @@ -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**: diff --git a/src/content/data-streams/reference/report-schema-v8.mdx b/src/content/data-streams/reference/report-schema-v8.mdx new file mode 100644 index 00000000000..fbb227d45e4 --- /dev/null +++ b/src/content/data-streams/reference/report-schema-v8.mdx @@ -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" + + + + + +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`) | diff --git a/src/content/data-streams/reference/rust-sdk.mdx b/src/content/data-streams/reference/rust-sdk.mdx index b0cdb5a5904..5e1277e4856 100644 --- a/src/content/data-streams/reference/rust-sdk.mdx +++ b/src/content/data-streams/reference/rust-sdk.mdx @@ -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 @@ -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: @@ -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 diff --git a/src/content/data-streams/tutorials/api-go.mdx b/src/content/data-streams/tutorials/api-go.mdx index d13520a696f..b6b6bdd7b4c 100644 --- a/src/content/data-streams/tutorials/api-go.mdx +++ b/src/content/data-streams/tutorials/api-go.mdx @@ -27,7 +27,7 @@ import DataStreams from "@features/data-streams/common/DataStreams.astro" icon: "/images/tutorial-icons/go_logo_black.png", }, { - name: "Go SDK - V4 reports for RWA streams", + name: "Go SDK - V8 reports for RWA streams", url: "/data-streams/tutorials/api-rwa-go", icon: "/images/tutorial-icons/go_logo_black.png", }, @@ -37,14 +37,14 @@ import DataStreams from "@features/data-streams/common/DataStreams.astro" icon: "/images/tutorial-icons/rust_logo_blk.svg", }, { - name: "Rust SDK - V4 reports for RWA streams", + name: "Rust SDK - V8 reports for RWA streams", url: "/data-streams/tutorials/api-rwa-rust", icon: "/images/tutorial-icons/rust_logo_blk.svg", }, ]} /> -In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/reference/go-sdk) for Go to fetch and decode [V3 reports](/data-streams/reference/report-schema) for [Crypto streams](/data-streams/crypto-streams) from the Data Streams Aggregation Network. You'll set up your Go project, retrieve reports, decode them, and log their attributes. +In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/reference/go-sdk) for Go to fetch and decode [V3 reports](/data-streams/reference/report-schema-v3) for [Crypto streams](/data-streams/crypto-streams) from the Data Streams Aggregation Network. You'll set up your Go project, retrieve reports, decode them, and log their attributes. @@ -530,7 +530,7 @@ Reports are decoded in two steps: This step: - Takes the raw `FullReport` bytes from the response - - Uses `v3.Data` schema for Crypto streams (use `v4.Data` for RWA streams) + - Uses `v3.Data` schema for Crypto streams (use `v8.Data` for RWA streams) - Validates the format and decodes using Go generics - Returns a structured report with typed data @@ -538,7 +538,7 @@ Reports are decoded in two steps: ```go data := decodedReport.Data price := data.BenchmarkPrice.String() // Convert big number to string - bid := data.Bid.String() // All prices use 18 decimal places + bid := data.Bid.String() ask := data.Ask.String() validFrom := data.ValidFromTimestamp // Unix timestamp expiresAt := data.ExpiresAt // Unix timestamp diff --git a/src/content/data-streams/tutorials/api-rust.mdx b/src/content/data-streams/tutorials/api-rust.mdx index ac974ef88b0..d63e42d7f60 100644 --- a/src/content/data-streams/tutorials/api-rust.mdx +++ b/src/content/data-streams/tutorials/api-rust.mdx @@ -27,7 +27,7 @@ import DataStreams from "@features/data-streams/common/DataStreams.astro" icon: "/images/tutorial-icons/go_logo_black.png", }, { - name: "Go SDK - V4 reports for RWA streams", + name: "Go SDK - V8 reports for RWA streams", url: "/data-streams/tutorials/api-rwa-go", icon: "/images/tutorial-icons/go_logo_black.png", }, @@ -37,14 +37,14 @@ import DataStreams from "@features/data-streams/common/DataStreams.astro" icon: "/images/tutorial-icons/rust_logo_blk.svg", }, { - name: "Rust SDK - V4 reports for RWA streams", + name: "Rust SDK - V8 reports for RWA streams", url: "/data-streams/tutorials/api-rwa-rust", icon: "/images/tutorial-icons/rust_logo_blk.svg", }, ]} /> -In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/reference/rust-sdk) for Rust to fetch and decode [V3 reports](/data-streams/reference/report-schema) for [Crypto streams](/data-streams/crypto-streams) from the Data Streams Aggregation Network. You'll set up your Rust project, retrieve reports, decode them, and log their attributes. +In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/reference/rust-sdk) for Rust to fetch and decode [V3 reports](/data-streams/reference/report-schema-v3) for [Crypto streams](/data-streams/crypto-streams) from the Data Streams Aggregation Network. You'll set up your Rust project, retrieve reports, decode them, and log their attributes. @@ -261,7 +261,7 @@ Reports are decoded in three stages: - Validates the report format 1. Data extraction: [`ReportDataV3::decode`](https://github.com/smartcontractkit/data-streams-sdk/blob/main/rust/crates/report/src/report/v3.rs#L80) parses the report blob into structured data: - - Benchmark price (18 decimal places) + - Benchmark price - Bid and ask prices for [liquidity-weighted pricing](/data-streams/concepts/liquidity-weighted-prices) - **Note:** For [DEX State Price streams](/data-streams/concepts/dex-state-price-streams), which also use the V3 schema, the `bid` and `ask` fields contain the same value as `benchmark_price`. - Fee information for onchain verification diff --git a/src/content/data-streams/tutorials/api-rwa-go.mdx b/src/content/data-streams/tutorials/api-rwa-go.mdx index e46d0e0cb34..a683ff3df5d 100644 --- a/src/content/data-streams/tutorials/api-rwa-go.mdx +++ b/src/content/data-streams/tutorials/api-rwa-go.mdx @@ -1,11 +1,11 @@ --- section: dataStreams date: Last Modified -title: "Fetch and decode V4 reports using the Go SDK" +title: "Fetch and decode V8 reports using the Go SDK" metadata: title: "Fetch and Decode Real World Asset Data with Go SDK | Chainlink Data Streams" - description: "Learn how to use the Go SDK to fetch and decode Real World Asset (RWA) market data reports with V4 schema from Chainlink Data Streams." - keywords: ["Go SDK", "Golang", "RWA", "Real World Assets", "V4 Reports", "API Tutorial", "Data Streams"] + description: "Learn how to use the Go SDK to fetch and decode Real World Asset (RWA) market data reports with V8 schema from Chainlink Data Streams." + keywords: ["Go SDK", "Golang", "RWA", "Real World Assets", "V8 Reports", "API Tutorial", "Data Streams"] whatsnext: { "Learn how to stream and decode reports via a WebSocket connection": "/data-streams/tutorials/ws-rwa-go", @@ -27,7 +27,7 @@ import DataStreams from "@features/data-streams/common/DataStreams.astro" icon: "/images/tutorial-icons/go_logo_black.png", }, { - name: "Go SDK - V4 reports for RWA streams", + name: "Go SDK - V8 reports for RWA streams", url: "/data-streams/tutorials/api-rwa-go", icon: "/images/tutorial-icons/go_logo_black.png", }, @@ -37,14 +37,14 @@ import DataStreams from "@features/data-streams/common/DataStreams.astro" icon: "/images/tutorial-icons/rust_logo_blk.svg", }, { - name: "Rust SDK - V4 reports for RWA streams", + name: "Rust SDK - V8 reports for RWA streams", url: "/data-streams/tutorials/api-rwa-rust", icon: "/images/tutorial-icons/rust_logo_blk.svg", }, ]} /> -In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/reference/go-sdk) for Go to fetch and decode [V4 reports](/data-streams/reference/report-schema-v4) for [Real World Assets (RWAs) streams](/data-streams/rwa-streams) from the Data Streams Aggregation Network. You'll set up your Go project, retrieve reports, decode them, and log their attributes. +In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/reference/go-sdk) for Go to fetch and decode [V8 reports](/data-streams/reference/report-schema-v8) for [Real World Assets (RWAs) streams](/data-streams/rwa-streams) from the Data Streams Aggregation Network. You'll set up your Go project, retrieve reports, decode them, and log their attributes. @@ -101,7 +101,7 @@ You'll start with the set up of your Go project. Next, you'll fetch and decode r streams "github.com/smartcontractkit/data-streams-sdk/go" feed "github.com/smartcontractkit/data-streams-sdk/go/feed" report "github.com/smartcontractkit/data-streams-sdk/go/report" - v4 "github.com/smartcontractkit/data-streams-sdk/go/report/v4" // Import the v4 report schema for RWA streams. For Crypto streams, use the v3 schema. + v8 "github.com/smartcontractkit/data-streams-sdk/go/report/v8" // Import the v8 report schema for RWA streams. For Crypto streams, use the v3 schema. ) func main() { @@ -157,33 +157,37 @@ You'll start with the set up of your Go project. Next, you'll fetch and decode r cfg.Logger("Raw report data: %+v\n", reportResponse) // Decode the report - decodedReport, err := report.Decode[v4.Data](reportResponse.FullReport) + decodedReport, err := report.Decode[v8.Data](reportResponse.FullReport) if err != nil { cfg.Logger("Failed to decode report: %v\n", err) os.Exit(1) } // Format and display the decoded report - fmt.Printf("\nDecoded Report for Stream ID %s:\n"+ - "------------------------------------------\n"+ - "Observations Timestamp: %d\n"+ - "Benchmark Price : %s\n"+ - "Valid From Timestamp : %d\n"+ - "Expires At : %d\n"+ - "Link Fee : %s\n"+ - "Native Fee : %s\n"+ - "Market Status : %d\n"+ - "------------------------------------------\n", + fmt.Printf( + "\nDecoded Report for Stream ID %s:\n"+ + "------------------------------------------\n"+ + "Observations Timestamp : %d\n"+ + "Valid From Timestamp : %d\n"+ + "Last Update Timestamp : %d\n"+ + "Expires At : %d\n"+ + "Mid Price : %s\n"+ + "Market Status : %d\n"+ + "Link Fee (wei) : %s\n"+ + "Native Fee (wei) : %s\n"+ + "------------------------------------------\n", feedIDInput, decodedReport.Data.ObservationsTimestamp, - decodedReport.Data.BenchmarkPrice.String(), decodedReport.Data.ValidFromTimestamp, + decodedReport.Data.LastUpdateTimestamp, decodedReport.Data.ExpiresAt, + decodedReport.Data.MidPrice.String(), + decodedReport.Data.MarketStatus, decodedReport.Data.LinkFee.String(), decodedReport.Data.NativeFee.String(), - decodedReport.Data.MarketStatus, ) - } + } + ``` 1. Download the required dependencies and update the `go.mod` and `go.sum` files: @@ -227,35 +231,37 @@ You'll start with the set up of your Go project. Next, you'll fetch and decode r Expect output similar to the following in your terminal: ```bash - 2024-12-14T17:50:49-05:00 Raw report data: {"fullReport":"0x...","feedID":"[STREAM_ID]","validFromTimestamp":1734216649,"observationsTimestamp":1734216649} - - 2024-12-14T17:50:49-05:00 - Decoded Report for Stream ID [STREAM_ID]: - ------------------------------------------ - Observations Timestamp: 1734216649 - Benchmark Price : 636240000000000000 - Valid From Timestamp : 1734216649 - Expires At : 1734303049 - Link Fee : 0 - Native Fee : 0 - Market Status : 1 - ------------------------------------------ + 2025-07-26T12:44:54-05:00 Raw report data: {"fullReport":"0x...","feedID":"[STREAM_ID]","validFromTimestamp":1753551893,"observationsTimestamp":1753551893} + + 2025-07-26T12:44:54-05:00 + Decoded Report for Stream ID [STREAM_ID]: + ------------------------------------------ + Observations Timestamp : 1753551893 + Valid From Timestamp : 1753551893 + Last Update Timestamp : 1753476931520000000 + Expires At : 1756143893 + Mid Price : 213940000000000000000 + Market Status : 1 + Link Fee (wei) : 17515847021884305 + Native Fee (wei) : 85879244037647 + ------------------------------------------ ``` #### Decoded report details -The decoded report details include: +The decoded report includes: -| Attribute | Value | Description | -| ------------------------ | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Stream ID` | `[STREAM_ID]` | The unique identifier for the stream. | -| `Observations Timestamp` | `1734216649` | The timestamp indicating when the data was captured. | -| `Benchmark Price` | `636240000000000000` | The observed price in the report, with 18 decimals. For readability: `0.63624` USD per AUD. | -| `Valid From Timestamp` | `1734216649` | The start validity timestamp for the report, indicating when the data becomes relevant. | -| `Expires At` | `1734303049` | The expiration timestamp of the report, indicating the point at which the data becomes outdated. | -| `Link Fee` | `0` | The fee to pay in LINK tokens for the onchain verification of the report data. With 18 decimals. **Note:** This example fee is not indicative of actual fees. | -| `Native Fee` | `0` | The fee to pay in the native blockchain token (e.g., ETH on Ethereum) for the onchain verification of the report data. With 18 decimals. **Note:** This example fee is not indicative of actual fees. | -| `Market Status` | `1` | The DON's consensus on whether the market is currently open. Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). | +| Attribute | Value | Description | +| ------------------------ | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------- | +| `Stream ID` | `[STREAM_ID]` | The unique identifier for the stream. | +| `Observations Timestamp` | `1753551893` | The timestamp indicating when the data was captured. | +| `Valid From Timestamp` | `1753551893` | The start validity timestamp for the report, indicating when the data becomes relevant. | +| `Last Update Timestamp` | `1753476931520000000` | The timestamp of the last valid price update, in nanoseconds since epoch. | +| `Expires At` | `1756143893` | The expiration timestamp of the report, indicating the point at which the data becomes outdated. | +| `Mid Price` | `213940000000000000000` | The observed median price in the report. For readability: `213.94`. | +| `Market Status` | `1` | The DON's consensus on whether the market is currently open. Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). | +| `Link Fee` | `17515847021884305` | The fee to pay in LINK tokens for onchain verification of the report data. | +| `Native Fee` | `85879244037647` | The fee to pay in the native blockchain token (e.g., ETH) for onchain verification. | #### Payload for onchain verification @@ -285,7 +291,7 @@ production environment, you should verify the data to ensure its integrity and a streams "github.com/smartcontractkit/data-streams-sdk/go" feed "github.com/smartcontractkit/data-streams-sdk/go/feed" report "github.com/smartcontractkit/data-streams-sdk/go/report" - v4 "github.com/smartcontractkit/data-streams-sdk/go/report/v4" // Import the v4 report schema for RWA streams + v8 "github.com/smartcontractkit/data-streams-sdk/go/report/v8" // Import the v8 report schema for RWA streams ) func main() { @@ -354,7 +360,7 @@ production environment, you should verify the data to ensure its integrity and a reportResponse.FeedID.String(), reportResponse) // Decode the report - decodedReport, err := report.Decode[v4.Data](reportResponse.FullReport) + decodedReport, err := report.Decode[v8.Data](reportResponse.FullReport) if err != nil { cfg.Logger("Failed to decode report for Stream ID %s: %v\n", reportResponse.FeedID.String(), err) @@ -362,24 +368,27 @@ production environment, you should verify the data to ensure its integrity and a } // Format and display the decoded report - fmt.Printf("\nDecoded Report for Stream ID %s:\n"+ - "------------------------------------------\n"+ - "Observations Timestamp: %d\n"+ - "Benchmark Price : %s\n"+ - "Valid From Timestamp : %d\n"+ - "Expires At : %d\n"+ - "Link Fee : %s\n"+ - "Native Fee : %s\n"+ - "Market Status : %d\n"+ - "------------------------------------------\n", - reportResponse.FeedID.String(), + fmt.Printf( + "\nDecoded Report for Stream ID %s:\n"+ + "------------------------------------------\n"+ + "Observations Timestamp : %d\n"+ + "Valid From Timestamp : %d\n"+ + "Last Update Timestamp : %d\n"+ + "Expires At : %d\n"+ + "Mid Price : %s\n"+ + "Market Status : %d\n"+ + "Link Fee (wei) : %s\n"+ + "Native Fee (wei) : %s\n"+ + "------------------------------------------\n", + feedIDInput, decodedReport.Data.ObservationsTimestamp, - decodedReport.Data.BenchmarkPrice.String(), decodedReport.Data.ValidFromTimestamp, + decodedReport.Data.LastUpdateTimestamp, decodedReport.Data.ExpiresAt, + decodedReport.Data.MidPrice.String(), + decodedReport.Data.MarketStatus, decodedReport.Data.LinkFee.String(), decodedReport.Data.NativeFee.String(), - decodedReport.Data.MarketStatus, ) } } @@ -413,26 +422,28 @@ production environment, you should verify the data to ensure its integrity and a Decoded Report for Stream ID [STREAM_ID_1]: ------------------------------------------ - Observations Timestamp: 1734216809 - Benchmark Price : 636240000000000000 - Valid From Timestamp : 1734216809 - Expires At : 1734303209 - Link Fee : 0 - Native Fee : 0 - Market Status : 1 + Observations Timestamp : 1753551893 + Valid From Timestamp : 1753551893 + Last Update Timestamp : 1753476931520000000 + Expires At : 1756143893 + Mid Price : 213940000000000000000 + Market Status : 1 + Link Fee (wei) : 17515847021884305 + Native Fee (wei) : 85879244037647 ------------------------------------------ 2024-12-14T17:53:30-05:00 Raw report data for Stream ID [STREAM_ID_2]: {"fullReport":"0x...","feedID":"[STREAM_ID_2]","validFromTimestamp":1734216809,"observationsTimestamp":1734216809} Decoded Report for Stream ID [STREAM_ID_2]: ------------------------------------------ - Observations Timestamp: 1734216809 - Benchmark Price : 1050250000000000000 - Valid From Timestamp : 1734216809 - Expires At : 1734303209 - Link Fee : 0 - Native Fee : 0 - Market Status : 1 + Observations Timestamp : 1753551893 + Valid From Timestamp : 1753551893 + Last Update Timestamp : 1753476931520000000 + Expires At : 1756143893 + Mid Price : 213940000000000000000 + Market Status : 1 + Link Fee (wei) : 17515847021884305 + Native Fee (wei) : 85879244037647 ------------------------------------------ ``` @@ -515,20 +526,20 @@ Reports are decoded in two steps: 1. Report decoding with [`report.Decode`](https://github.com/smartcontractkit/data-streams-sdk/blob/main/go/report/report.go#L30): ```go - decodedReport, err := report.Decode[v4.Data](reportResponse.FullReport) + decodedReport, err := report.Decode[v8.Data](reportResponse.FullReport) ``` This step: - Takes the raw `FullReport` bytes from the response - - Uses `v4.Data` schema for RWA streams (use `v3.Data` for Crypto streams) + - Uses `v8.Data` schema for RWA streams (use `v3.Data` for Crypto streams) - Validates the format and decodes using Go generics - Returns a structured report with typed data 2. Data access: ```go data := decodedReport.Data - price := data.BenchmarkPrice.String() // Convert big number to string + price := data.MidPrice.String(), // Convert big number to string validFrom := data.ValidFromTimestamp // Unix timestamp expiresAt := data.ExpiresAt // Unix timestamp marketStatus := data.MarketStatus // Market status (0: Unknown, 1: Closed, 2: Open) diff --git a/src/content/data-streams/tutorials/api-rwa-rust.mdx b/src/content/data-streams/tutorials/api-rwa-rust.mdx index 92477b5d700..269ffef79f6 100644 --- a/src/content/data-streams/tutorials/api-rwa-rust.mdx +++ b/src/content/data-streams/tutorials/api-rwa-rust.mdx @@ -1,12 +1,12 @@ --- section: dataStreams date: Last Modified -title: "Fetch and decode V4 reports using the Rust SDK" +title: "Fetch and decode V8 reports using the Rust SDK" metadata: title: "Fetch and Decode Real World Asset Data with Rust SDK | Chainlink Data Streams" - description: "Learn how to use the Rust SDK to fetch and decode Real World Asset (RWA) market data reports with V4 schema from Chainlink Data Streams." + description: "Learn how to use the Rust SDK to fetch and decode Real World Asset (RWA) market data reports with V8 schema from Chainlink Data Streams." keywords: - ["Rust SDK", "RWA", "Real World Assets", "V4 Reports", "API Tutorial", "Data Streams", "Forex", "Commodities"] + ["Rust SDK", "RWA", "Real World Assets", "V8 Reports", "API Tutorial", "Data Streams", "Forex", "Commodities"] whatsnext: { "Learn how to stream and decode reports via a WebSocket connection": "/data-streams/tutorials/ws-rwa-rust", @@ -28,7 +28,7 @@ import DataStreams from "@features/data-streams/common/DataStreams.astro" icon: "/images/tutorial-icons/go_logo_black.png", }, { - name: "Go SDK - V4 reports for RWA streams", + name: "Go SDK - V8 reports for RWA streams", url: "/data-streams/tutorials/api-rwa-go", icon: "/images/tutorial-icons/go_logo_black.png", }, @@ -38,14 +38,14 @@ import DataStreams from "@features/data-streams/common/DataStreams.astro" icon: "/images/tutorial-icons/rust_logo_blk.svg", }, { - name: "Rust SDK - V4 reports for RWA streams", + name: "Rust SDK - V8 reports for RWA streams", url: "/data-streams/tutorials/api-rwa-rust", icon: "/images/tutorial-icons/rust_logo_blk.svg", }, ]} /> -In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/reference/rust-sdk) for Rust to fetch and decode [V4 reports](/data-streams/reference/report-schema-v4) for [Real World Assets (RWAs) streams](/data-streams/rwa-streams) from the Data Streams Aggregation Network. You'll set up your Rust project, retrieve reports, decode them, and log their attributes. +In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/reference/rust-sdk) for Rust to fetch and decode [V8 reports](/data-streams/reference/report-schema-v8) for [Real World Assets (RWAs) streams](/data-streams/rwa-streams) from the Data Streams Aggregation Network. You'll set up your Rust project, retrieve reports, decode them, and log their attributes. @@ -88,7 +88,7 @@ You'll start with the set up of your Rust project. Next, you'll fetch and decode ```rust use chainlink_data_streams_report::feed_id::ID; - use chainlink_data_streams_report::report::{ decode_full_report, v4::ReportDataV4 }; + use chainlink_data_streams_report::report::{ decode_full_report, v8::ReportDataV8 }; use chainlink_data_streams_sdk::client::Client; use chainlink_data_streams_sdk::config::Config; use std::env; @@ -129,15 +129,16 @@ You'll start with the set up of your Rust project. Next, you'll fetch and decode // Decode the report let full_report = hex::decode(&response.report.full_report[2..])?; let (_report_context, report_blob) = decode_full_report(&full_report)?; - let report_data = ReportDataV4::decode(&report_blob)?; + let report_data = ReportDataV8::decode(&report_blob)?; // Print decoded report details println!("\nDecoded Report for Stream ID {}:", feed_id_input); println!("------------------------------------------"); - println!("Observations Timestamp: {}", response.report.observations_timestamp); - println!("Benchmark Price : {}", report_data.price); println!("Valid From Timestamp : {}", response.report.valid_from_timestamp); + println!("Observations Timestamp: {}", response.report.observations_timestamp); + println!("Last Update Timestamp : {}", report_data.last_update_timestamp); println!("Expires At : {}", report_data.expires_at); + println!("Mid Price : {}", report_data.mid_price); println!("Link Fee : {}", report_data.link_fee); println!("Native Fee : {}", report_data.native_fee); println!("Market Status : {}", report_data.market_status); @@ -145,6 +146,7 @@ You'll start with the set up of your Rust project. Next, you'll fetch and decode Ok(()) } + ``` 1. Set up your API credentials as environment variables: @@ -172,13 +174,14 @@ You'll start with the set up of your Rust project. Next, you'll fetch and decode Decoded Report for Stream ID [STREAM_ID]: ------------------------------------------ - Observations Timestamp: 1734125487 - Benchmark Price : 635840000000000000 - Valid From Timestamp : 1734125487 - Expires At : 1734211887 - Link Fee : 0 - Native Fee : 0 - Market Status : 2 + Valid From Timestamp : 1753554142 + Observations Timestamp: 1753554142 + Last Update Timestamp : 1753476931520000000 + Expires At : 1756146142 + Mid Price : 213940000000000000000 + Link Fee : 17474419425934927 + Native Fee : 85926694786199 + Market Status : 1 ------------------------------------------ ``` @@ -186,16 +189,17 @@ You'll start with the set up of your Rust project. Next, you'll fetch and decode The decoded report details include: -| Attribute | Value | Description | -| ------------------------ | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Stream ID` | `[STREAM_ID]` | The unique identifier for the stream. | -| `Observations Timestamp` | `1734125487` | The timestamp indicating when the data was captured. | -| `Benchmark Price` | `635840000000000000` | The observed price in the report, with 18 decimals. For readability: `0.63584` USD per AUD. | -| `Valid From Timestamp` | `1734125487` | The start validity timestamp for the report, indicating when the data becomes relevant. | -| `Expires At` | `1734211887` | The expiration timestamp of the report, indicating the point at which the data becomes outdated. | -| `Link Fee` | `0` | The fee to pay in LINK tokens for the onchain verification of the report data. With 18 decimals. **Note:** This example fee is not indicative of actual fees. | -| `Native Fee` | `0` | The fee to pay in the native blockchain token (e.g., ETH on Ethereum) for the onchain verification of the report data. With 18 decimals. **Note:** This example fee is not indicative of actual fees. | -| `Market Status` | `2` | The DON's consensus on whether the market is currently open. Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). | +| Attribute | Value | Description | +| ------------------------ | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------- | +| `Stream ID` | `[STREAM_ID]` | The unique identifier for the stream. | +| `Valid From Timestamp` | `1753554142` | The start validity timestamp for the report, indicating when the data becomes relevant. | +| `Observations Timestamp` | `1753554142` | The timestamp indicating when the data was captured. | +| `Last Update Timestamp` | `1753476931520000000` | The timestamp of the last valid price update, in nanoseconds since epoch. | +| `Expires At` | `1756146142` | The expiration timestamp of the report, indicating the point at which the data becomes outdated. | +| `Mid Price` | `213940000000000000000` | The observed median price in the report. For readability: `213.94`. | +| `Link Fee` | `17474419425934927` | The fee to pay in LINK tokens for onchain verification of the report data. | +| `Native Fee` | `85926694786199` | The fee to pay in the native blockchain token (e.g., ETH) for onchain verification. | +| `Market Status` | `1` | The DON's consensus on whether the market is currently open. Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). | #### Payload for onchain verification @@ -258,8 +262,8 @@ Reports are decoded in three stages: - Isolates the report blob (actual data) - Validates the report format -3. Data extraction: [`ReportDataV4::decode`](https://github.com/smartcontractkit/data-streams-sdk/blob/main/rust/crates/report/src/report/v4.rs#L57) parses the report blob into structured data: - - Price (18 decimal places) +3. Data extraction: [`ReportDataV8::decode`](https://github.com/smartcontractkit/data-streams-sdk/blob/main/rust/crates/report/src/report/v8.rs#L60) parses the report blob into structured data: + - Price - Market status (Open, Closed, or Unknown) - Fee information for onchain verification - Timestamp information diff --git a/src/content/data-streams/tutorials/evm-onchain-report-verification.mdx b/src/content/data-streams/tutorials/evm-onchain-report-verification.mdx index 516b0dd7d07..7bd0e8cad66 100644 --- a/src/content/data-streams/tutorials/evm-onchain-report-verification.mdx +++ b/src/content/data-streams/tutorials/evm-onchain-report-verification.mdx @@ -141,7 +141,7 @@ For this tutorial on _Arbitrum Sepolia_, fees are required, so you need to fund 1. Click the `verifyReport` button to call the function. MetaMask prompts you to accept the transaction. -1. Click the `lastDecodedPrice` getter function to view the decoded price from the verified report. The answer on the ETH/USD stream uses 18 decimal places, so an answer of `3257579704051546000000` indicates an ETH/USD price of 3,257.579704051546. Each stream uses a different number of decimal places for answers. See the [Stream Addresses](/data-streams/crypto-streams) page for more information. +1. Click the `lastDecodedPrice` getter function to view the decoded price from the verified report. The answer of `3257579704051546000000` indicates an ETH/USD price of 3,257.579704051546. Each stream uses a different number of decimal places for answers. See the [Stream Addresses](/data-streams/crypto-streams) page for more information. This example uses the [V3 schema](/data-streams/reference/report-schema) for [crypto streams](/data-streams/crypto-streams) to decode the report. If you verify reports for [RWA streams](/data-streams/rwa-streams), import and use the [V4 schema](/data-streams/reference/report-schema-v4) from the [report crate](https://github.com/smartcontractkit/data-streams-sdk/tree/main/rust/crates/report) instead. +> This example uses the [V3 schema](/data-streams/reference/report-schema-v3) for [crypto streams](/data-streams/crypto-streams) to decode the report. If you verify reports for [RWA streams](/data-streams/rwa-streams), import and use the [V8 schema](/data-streams/reference/report-schema-v8) from the [report crate](https://github.com/smartcontractkit/data-streams-sdk/tree/main/rust/crates/report) instead. #### 4. Create the command-line interface diff --git a/src/content/data-streams/tutorials/solana-onchain-report-verification.mdx b/src/content/data-streams/tutorials/solana-onchain-report-verification.mdx index f28fba61d0d..6f78f5e1047 100644 --- a/src/content/data-streams/tutorials/solana-onchain-report-verification.mdx +++ b/src/content/data-streams/tutorials/solana-onchain-report-verification.mdx @@ -266,7 +266,7 @@ Replace `` with your program ID in the `declare_id!` macro. You Note how the `VerifierInstructions::verify` helper method automatically handles the PDA computations internally. Refer to the [Program Derived Addresses (PDAs)](#program-derived-addresses-pdas) section for more information. -> This example uses the [V3 schema](/data-streams/reference/report-schema) for [crypto streams](/data-streams/crypto-streams) to decode the report. If you verify reports for [RWA streams](/data-streams/rwa-streams), import and use the [V4 schema](/data-streams/reference/report-schema-v4) from the [report crate](https://github.com/smartcontractkit/data-streams-sdk/tree/main/rust/crates/report) instead. +> This example uses the [V3 schema](/data-streams/reference/report-schema-v3) for [crypto streams](/data-streams/crypto-streams) to decode the report. If you verify reports for [RWA streams](/data-streams/rwa-streams), import and use the [V8 schema](/data-streams/reference/report-schema-v8) from the [report crate](https://github.com/smartcontractkit/data-streams-sdk/tree/main/rust/crates/report) instead. #### 5. Deploy your program diff --git a/src/content/data-streams/tutorials/streams-trade/getting-started-hardhat.mdx b/src/content/data-streams/tutorials/streams-trade/getting-started-hardhat.mdx index cf38cd506b4..861a5492e3b 100644 --- a/src/content/data-streams/tutorials/streams-trade/getting-started-hardhat.mdx +++ b/src/content/data-streams/tutorials/streams-trade/getting-started-hardhat.mdx @@ -7,7 +7,8 @@ metadata: excerpt: "Learn the basics for how to get data from Chainlink Data Streams." 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 more about Log Trigger upkeeps": "/chainlink-automation/guides/log-trigger/", } --- diff --git a/src/content/data-streams/tutorials/streams-trade/getting-started.mdx b/src/content/data-streams/tutorials/streams-trade/getting-started.mdx index 76d540f4dde..c5e9f0837ea 100644 --- a/src/content/data-streams/tutorials/streams-trade/getting-started.mdx +++ b/src/content/data-streams/tutorials/streams-trade/getting-started.mdx @@ -7,7 +7,8 @@ metadata: excerpt: "Learn the basics for how to get data from Chainlink Data Streams." 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 more about Log Trigger upkeeps": "/chainlink-automation/guides/log-trigger/", } --- diff --git a/src/content/data-streams/tutorials/streams-trade/streams-trade-lookup-error-handler.mdx b/src/content/data-streams/tutorials/streams-trade/streams-trade-lookup-error-handler.mdx index 557024f7f24..d0c063113f9 100644 --- a/src/content/data-streams/tutorials/streams-trade/streams-trade-lookup-error-handler.mdx +++ b/src/content/data-streams/tutorials/streams-trade/streams-trade-lookup-error-handler.mdx @@ -6,7 +6,8 @@ metadata: linkToWallet: true whatsnext: { "Find the list of available feed 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 more about Log Trigger upkeeps": "/chainlink-automation/guides/log-trigger/", } --- diff --git a/src/content/data-streams/tutorials/ws-go.mdx b/src/content/data-streams/tutorials/ws-go.mdx index 9b4cf71d50a..4e2fd2027a2 100644 --- a/src/content/data-streams/tutorials/ws-go.mdx +++ b/src/content/data-streams/tutorials/ws-go.mdx @@ -26,7 +26,7 @@ import DataStreams from "@features/data-streams/common/DataStreams.astro" icon: "/images/tutorial-icons/go_logo_black.png", }, { - name: "Go SDK - V4 reports for RWA streams", + name: "Go SDK - V8 reports for RWA streams", url: "/data-streams/tutorials/ws-rwa-go", icon: "/images/tutorial-icons/go_logo_black.png", }, @@ -36,14 +36,14 @@ import DataStreams from "@features/data-streams/common/DataStreams.astro" icon: "/images/tutorial-icons/rust_logo_blk.svg", }, { - name: "Rust SDK - V4 reports for RWA streams", + name: "Rust SDK - V8 reports for RWA streams", url: "/data-streams/tutorials/ws-rwa-rust", icon: "/images/tutorial-icons/rust_logo_blk.svg", }, ]} /> -In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/reference/go-sdk) for Go to subscribe to real-time [V3 reports](/data-streams/reference/report-schema) for [Crypto streams](/data-streams/crypto-streams) via a [WebSocket connection](/data-streams/reference/interface-ws). You'll set up your Go project, listen for real-time reports from the Data Streams Aggregation Network, decode the report data, and log their attributes to your terminal. +In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/reference/go-sdk) for Go to subscribe to real-time [V3 reports](/data-streams/reference/report-schema-v3) for [Crypto streams](/data-streams/crypto-streams) via a [WebSocket connection](/data-streams/reference/interface-ws). You'll set up your Go project, listen for real-time reports from the Data Streams Aggregation Network, decode the report data, and log their attributes to your terminal. @@ -98,7 +98,7 @@ In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/r streams "github.com/smartcontractkit/data-streams-sdk/go" feed "github.com/smartcontractkit/data-streams-sdk/go/feed" report "github.com/smartcontractkit/data-streams-sdk/go/report" - v3 "github.com/smartcontractkit/data-streams-sdk/go/report/v3" // Import the v3 report schema for Crypto streams. For RWA streams, use the v4 schema. + v3 "github.com/smartcontractkit/data-streams-sdk/go/report/v3" // Import the v3 report schema for Crypto streams. For RWA streams, use the v8 schema. ) func main() { @@ -301,17 +301,17 @@ In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/r The decoded report details include: -| Attribute | Value | Description | -| ------------------------ | -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Stream ID` | `0x000359843a543ee2fe414dc14c7e7920ef10f4372990b79d6361cdc0dd1ba782` | The unique identifier for the stream. In this example, the stream is for ETH/USD. | -| `Observations Timestamp` | `1722458069` | The timestamp indicating when the data was captured. | -| `Benchmark Price` | `3232773100000000000000` | The observed price in the report, with 18 decimals. For readability: `3,232.7731000000000` USD per ETH. | -| `Bid` | `3232728700000000000000` | The highest price a buyer is willing to pay for an asset, with 18 decimals. For readability: `3,232.7287000000000` USD per ETH. Learn more about the [Bid price](/data-streams/concepts/liquidity-weighted-prices). | -| `Ask` | `3232817400000000000000` | The lowest price a seller is willing to accept for an asset, with 18 decimals. For readability: `3,232.8174000000000` USD per ETH. Learn more about the [Ask price](/data-streams/concepts/liquidity-weighted-prices). | -| `Valid From Timestamp` | `1722458069` | The start validity timestamp for the report, indicating when the data becomes relevant. | -| `Expires At` | `1722544469` | The expiration timestamp of the report, indicating the point at which the data becomes outdated. | -| `Link Fee` | `7775942157527100` | The fee to pay in LINK tokens for the onchain verification of the report data. With 18 decimals. For readability: `0.0077759421575271` LINK. | -| `Native Fee` | `30933194785600` | The fee to pay in the native blockchain token (e.g., ETH on Ethereum) for the onchain verification of the report data. With 18 decimals. **Note:** This example fee is not indicative of actual fees. | +| Attribute | Value | Description | +| ------------------------ | -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Stream ID` | `0x000359843a543ee2fe414dc14c7e7920ef10f4372990b79d6361cdc0dd1ba782` | The unique identifier for the stream. In this example, the stream is for ETH/USD. | +| `Observations Timestamp` | `1722458069` | The timestamp indicating when the data was captured. | +| `Benchmark Price` | `3232773100000000000000` | The observed price in the report. For readability: `3,232.7731000000000` USD per ETH. | +| `Bid` | `3232728700000000000000` | The highest price a buyer is willing to pay for an asset. For readability: `3,232.7287000000000` USD per ETH. Learn more about the [Bid price](/data-streams/concepts/liquidity-weighted-prices). | +| `Ask` | `3232817400000000000000` | The lowest price a seller is willing to accept for an asset. For readability: `3,232.8174000000000` USD per ETH. Learn more about the [Ask price](/data-streams/concepts/liquidity-weighted-prices). | +| `Valid From Timestamp` | `1722458069` | The start validity timestamp for the report, indicating when the data becomes relevant. | +| `Expires At` | `1722544469` | The expiration timestamp of the report, indicating the point at which the data becomes outdated. | +| `Link Fee` | `7775942157527100` | The fee to pay in LINK tokens for the onchain verification of the report data. For readability: `0.0077759421575271` LINK. | +| `Native Fee` | `30933194785600` | The fee to pay in the native blockchain token (e.g., ETH on Ethereum) for the onchain verification of the report data. **Note:** This example fee is not indicative of actual fees. | #### Payload for onchain verification diff --git a/src/content/data-streams/tutorials/ws-rust.mdx b/src/content/data-streams/tutorials/ws-rust.mdx index 04bc579ebda..ff49af1f018 100644 --- a/src/content/data-streams/tutorials/ws-rust.mdx +++ b/src/content/data-streams/tutorials/ws-rust.mdx @@ -26,7 +26,7 @@ import DataStreams from "@features/data-streams/common/DataStreams.astro" icon: "/images/tutorial-icons/go_logo_black.png", }, { - name: "Go SDK - V4 reports for RWA streams", + name: "Go SDK - V8 reports for RWA streams", url: "/data-streams/tutorials/ws-rwa-go", icon: "/images/tutorial-icons/go_logo_black.png", }, @@ -36,14 +36,14 @@ import DataStreams from "@features/data-streams/common/DataStreams.astro" icon: "/images/tutorial-icons/rust_logo_blk.svg", }, { - name: "Rust SDK - V4 reports for RWA streams", + name: "Rust SDK - V8 reports for RWA streams", url: "/data-streams/tutorials/ws-rwa-rust", icon: "/images/tutorial-icons/rust_logo_blk.svg", }, ]} /> -In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/reference/rust-sdk) for Rust to subscribe to real-time [V3 reports](/data-streams/reference/report-schema) for [Crypto streams](/data-streams/crypto-streams) via a [WebSocket connection](/data-streams/reference/interface-ws). You'll set up your Rust project, listen for real-time reports from the Data Streams Aggregation Network, decode the report data, and log their attributes to your terminal. +In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/reference/rust-sdk) for Rust to subscribe to real-time [V3 reports](/data-streams/reference/report-schema-v3) for [Crypto streams](/data-streams/crypto-streams) via a [WebSocket connection](/data-streams/reference/interface-ws). You'll set up your Rust project, listen for real-time reports from the Data Streams Aggregation Network, decode the report data, and log their attributes to your terminal. @@ -314,17 +314,17 @@ This will subscribe to both ETH/USD and BTC/USD streams. The decoded report details include: -| Attribute | Value | Description | -| ------------------------ | -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `Stream ID` | `0x000359843a543ee2fe414dc14c7e7920ef10f4372990b79d6361cdc0dd1ba782` | The unique identifier for the stream. In this example, the stream is for ETH/USD. | -| `Observations Timestamp` | `1734131277` | The timestamp indicating when the data was captured. | -| `Price` | `3906157533081673500000` | The observed price in the report, with 18 decimals. For readability: `3,906.1575330816735` USD per ETH. | -| `Bid` | `3905928693886829700000` | The highest price a buyer is willing to pay for an asset, with 18 decimals. For readability: `3,905.9286938868297` USD per ETH. Learn more about the [Bid price](/data-streams/concepts/liquidity-weighted-prices). | -| `Ask` | `3906215307384792250000` | The lowest price a seller is willing to accept for an asset, with 18 decimals. For readability: `3,906.2153073847923` USD per ETH. Learn more about the [Ask price](/data-streams/concepts/liquidity-weighted-prices). | -| `Valid From Timestamp` | `1734131277` | The start validity timestamp for the report, indicating when the data becomes relevant. | -| `Expires At` | `1734217677` | The expiration timestamp of the report, indicating the point at which the data becomes outdated. | -| `Link Fee` | `3513685734964500` | The fee to pay in LINK tokens for the onchain verification of the report data. With 18 decimals. For readability: `0.0035136857349645` LINK. **Note:** This example fee is not indicative of actual fees. | -| `Native Fee` | `25600606005500` | The fee to pay in the native blockchain token (e.g., ETH on Ethereum) for the onchain verification of the report data. With 18 decimals. For readability: `0.0000256006060055` ETH. **Note:** This example fee is not indicative of actual fees. | +| Attribute | Value | Description | +| ------------------------ | -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `Stream ID` | `0x000359843a543ee2fe414dc14c7e7920ef10f4372990b79d6361cdc0dd1ba782` | The unique identifier for the stream. In this example, the stream is for ETH/USD. | +| `Observations Timestamp` | `1734131277` | The timestamp indicating when the data was captured. | +| `Price` | `3906157533081673500000` | The observed price in the report. For readability: `3,906.1575330816735` USD per ETH. | +| `Bid` | `3905928693886829700000` | The highest price a buyer is willing to pay for an asset. For readability: `3,905.9286938868297` USD per ETH. Learn more about the [Bid price](/data-streams/concepts/liquidity-weighted-prices). | +| `Ask` | `3906215307384792250000` | The lowest price a seller is willing to accept for an asset. For readability: `3,906.2153073847923` USD per ETH. Learn more about the [Ask price](/data-streams/concepts/liquidity-weighted-prices). | +| `Valid From Timestamp` | `1734131277` | The start validity timestamp for the report, indicating when the data becomes relevant. | +| `Expires At` | `1734217677` | The expiration timestamp of the report, indicating the point at which the data becomes outdated. | +| `Link Fee` | `3513685734964500` | The fee to pay in LINK tokens for the onchain verification of the report data. For readability: `0.0035136857349645` LINK. **Note:** This example fee is not indicative of actual fees. | +| `Native Fee` | `25600606005500` | The fee to pay in the native blockchain token (e.g., ETH on Ethereum) for the onchain verification of the report data. For readability: `0.0000256006060055` ETH. **Note:** This example fee is not indicative of actual fees. | #### Payload for onchain verification @@ -358,7 +358,7 @@ As data reports arrive via the WebSocket connection, they are processed in real- 2. Decoding reports: Each report is decoded in two stages: - [`decode_full_report`](https://github.com/smartcontractkit/data-streams-sdk/blob/main/rust/crates/report/src/report.rs#L77) parses the raw hexadecimal data, separating the report context (containing metadata) from the report blob - [`ReportDataV3::decode`](https://github.com/smartcontractkit/data-streams-sdk/blob/main/rust/crates/report/src/report/v3.rs#L80) transforms the report blob into a structured format containing: - - The benchmark price (with 18 decimal places) + - The benchmark price - Bid and ask prices for [liquidity-weighted pricing](/data-streams/concepts/liquidity-weighted-prices) - Fee information for onchain verification - Timestamp information diff --git a/src/content/data-streams/tutorials/ws-rwa-go.mdx b/src/content/data-streams/tutorials/ws-rwa-go.mdx index bcc8eac8ac3..95441edf9fa 100644 --- a/src/content/data-streams/tutorials/ws-rwa-go.mdx +++ b/src/content/data-streams/tutorials/ws-rwa-go.mdx @@ -1,11 +1,11 @@ --- section: dataStreams date: Last Modified -title: "Stream and decode V4 reports via WebSocket using the Go SDK" +title: "Stream and decode V8 reports via WebSocket using the Go SDK" metadata: - title: "RWA V4 Reports via WebSocket with Go SDK | Chainlink Data Streams" - description: "Tutorial on streaming and decoding Real World Assets (RWA) V4 reports using WebSocket connections with the Go SDK for Chainlink Data Streams." - keywords: ["WebSocket", "Go SDK", "Real World Assets", "RWA", "V4 reports", "Data Streams", "Real-time data"] + title: "RWA V8 Reports via WebSocket with Go SDK | Chainlink Data Streams" + description: "Tutorial on streaming and decoding Real World Assets (RWA) V8 reports using WebSocket connections with the Go SDK for Chainlink Data Streams." + keywords: ["WebSocket", "Go SDK", "Real World Assets", "RWA", "V8 reports", "Data Streams", "Real-time data"] whatsnext: { "Learn how to verify your data onchain": "/data-streams/reference/onchain-verification", @@ -26,7 +26,7 @@ import DataStreams from "@features/data-streams/common/DataStreams.astro" icon: "/images/tutorial-icons/go_logo_black.png", }, { - name: "Go SDK - V4 reports for RWA streams", + name: "Go SDK - V8 reports for RWA streams", url: "/data-streams/tutorials/ws-rwa-go", icon: "/images/tutorial-icons/go_logo_black.png", }, @@ -36,14 +36,14 @@ import DataStreams from "@features/data-streams/common/DataStreams.astro" icon: "/images/tutorial-icons/rust_logo_blk.svg", }, { - name: "Rust SDK - V4 reports for RWA streams", + name: "Rust SDK - V8 reports for RWA streams", url: "/data-streams/tutorials/ws-rwa-rust", icon: "/images/tutorial-icons/rust_logo_blk.svg", }, ]} /> -In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/reference/go-sdk) for Go to subscribe to real-time [V4 reports](/data-streams/reference/report-schema-v4) for [Real World Assets (RWAs) streams](/data-streams/rwa-streams) via a [WebSocket connection](/data-streams/reference/interface-ws). You'll set up your Go project, listen for real-time reports from the Data Streams Aggregation Network, decode the report data, and log their attributes to your terminal. +In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/reference/go-sdk) for Go to subscribe to real-time [V8 reports](/data-streams/reference/report-schema-v8) for [Real World Assets (RWAs) streams](/data-streams/rwa-streams) via a [WebSocket connection](/data-streams/reference/interface-ws). You'll set up your Go project, listen for real-time reports from the Data Streams Aggregation Network, decode the report data, and log their attributes to your terminal. @@ -98,7 +98,7 @@ In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/r streams "github.com/smartcontractkit/data-streams-sdk/go" feed "github.com/smartcontractkit/data-streams-sdk/go/feed" report "github.com/smartcontractkit/data-streams-sdk/go/report" - v4 "github.com/smartcontractkit/data-streams-sdk/go/report/v4" // Import the v4 report schema for RWA streams. For Crypto streams, use the v3 schema. + v8 "github.com/smartcontractkit/data-streams-sdk/go/report/v8" // Import the v8 report schema for RWA streams. For Crypto streams, use the v3 schema. ) func main() { @@ -155,7 +155,7 @@ In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/r cfg.Logger("Raw report data: %+v\n", reportResponse) // Decode each report as it comes in - decodedReport, decodeErr := report.Decode[v4.Data](reportResponse.FullReport) + decodedReport, decodeErr := report.Decode[v8.Data](reportResponse.FullReport) if decodeErr != nil { cfg.Logger("Failed to decode report: %v\n", decodeErr) continue @@ -165,7 +165,7 @@ In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/r cfg.Logger("\n--- Report Stream ID: %s ---\n" + "------------------------------------------\n" + "Observations Timestamp : %d\n" + - "Benchmark Price : %s\n" + + "Mid Price : %s\n" + "Valid From Timestamp : %d\n" + "Expires At : %d\n" + "Link Fee : %s\n" + @@ -174,7 +174,7 @@ In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/r "------------------------------------------\n", reportResponse.FeedID.String(), decodedReport.Data.ObservationsTimestamp, - decodedReport.Data.BenchmarkPrice.String(), + decodedReport.Data.MidPrice.String(), decodedReport.Data.ValidFromTimestamp, decodedReport.Data.ExpiresAt, decodedReport.Data.LinkFee.String(), @@ -232,59 +232,62 @@ In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/r Expect output similar to the following in your terminal: ```bash - 2024-10-24T12:52:50-05:00 Raw report data: {"fullReport":"0x...","feedID":"[STREAM_ID]","validFromTimestamp":1729792370,"observationsTimestamp":1729792370} + 2025-07-29T07:00:34-05:00 Raw report data: {"fullReport":"0x00090d9e8d96765a0c49e03a6ae05c82e8f8de70cf179baa632f18313e54bd6900000000000000000000000000000000000000000000000000000000012b136f000000000000000000000000000000000000000000000000000000030000000100000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000280010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200008b8ad9dc4061d1064033c3abc8a4e3f056e5b61d8533e8190eb96ef3b330b000000000000000000000000000000000000000000000000000000006888b7e2000000000000000000000000000000000000000000000000000000006888b7e200000000000000000000000000000000000000000000000000004c142b9ed5c0000000000000000000000000000000000000000000000000003eb04f48948f6f0000000000000000000000000000000000000000000000000000000068b044e200000000000000000000000000000000000000000000000018569aaaebd353c000000000000000000000000000000000000000000000000b997fe8cfd635800000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002dfef02967d39ebebf7741cb7581a91128167c68e9e485d1d34456cddbe3c131b65d697a86cd50e38642b582bd4b0cc58ac3bc67b9611df12bdf88208dcd0af2500000000000000000000000000000000000000000000000000000000000000027777290339633ffe117e3db85efc4a2f88617286fd033e57ac7642b06b77fe3a18fdfed657854ff5e1c253e57bd5334d85ee999dcc223b7286092ab03a5ece27","feedID":"0x0008b8ad9dc4061d1064033c3abc8a4e3f056e5b61d8533e8190eb96ef3b330b","validFromTimestamp":1753790434,"observationsTimestamp":1753790434} - 2024-10-24T12:52:50-05:00 - --- Report Stream ID: [STREAM_ID] --- + 2025-07-29T07:00:34-05:00 + --- Report Stream ID: 0x0008b8ad9dc4061d1064033c3abc8a4e3f056e5b61d8533e8190eb96ef3b330b --- ------------------------------------------ - Observations Timestamp : 1729792370 - Benchmark Price : 663900000000000000 - Valid From Timestamp : 1729792370 - Expires At : 1729878770 - Link Fee : 0 - Native Fee : 0 - Market Status : 2 + Observations Timestamp : 1753790434 + Mid Price : 213975000000000000000 + Valid From Timestamp : 1753790434 + Last Update Timestamp : 1753759163799000000 + Expires At : 1756382434 + Link Fee (wei) : 17645303122661231 + Native Fee (wei) : 83649514886592 + Market Status : 1 ------------------------------------------ - 2024-10-24T12:52:50-05:00 + 2025-07-29T07:00:34-05:00 --- Stream Stats --- accepted: 1, deduplicated: 0, total_received 1, partial_reconnects: 0, full_reconnects: 0, configured_connections: 1, active_connections 1 -------------------------------------------------------------------------------------------------------------------------------------------- - 2024-10-24T12:52:51-05:00 Raw report data: {"fullReport":"0x...","feedID":"[STREAM_ID]","validFromTimestamp":1729792371,"observationsTimestamp":1729792371} + 2025-07-29T07:00:35-05:00 Raw report data: {"fullReport":"0x00090d9e8d96765a0c49e03a6ae05c82e8f8de70cf179baa632f18313e54bd6900000000000000000000000000000000000000000000000000000000012b1372000000000000000000000000000000000000000000000000000000030000000100000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000280010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200008b8ad9dc4061d1064033c3abc8a4e3f056e5b61d8533e8190eb96ef3b330b000000000000000000000000000000000000000000000000000000006888b7e3000000000000000000000000000000000000000000000000000000006888b7e300000000000000000000000000000000000000000000000000004c144784e03d000000000000000000000000000000000000000000000000003eb0c331846a690000000000000000000000000000000000000000000000000000000068b044e300000000000000000000000000000000000000000000000018569aaaebd353c000000000000000000000000000000000000000000000000b997fe8cfd6358000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000029bc44aa6a85efdf31f3208a8c4333a083d4a52f6fae63d7d1ea2ff0f4f8243513e3d2caa118f64dc678ad157e51c3784b4fe38234bdc30ae8f1d43b096482b4f00000000000000000000000000000000000000000000000000000000000000025a53956d52ffedd51bc5ba08d64f3623c20549758e8a7ae11ef97df7b592d24d33a7f253d8e7a6b8d625aaf7cdd158b7dc82c392aa8a720d33bce348133aa713","feedID":"0x0008b8ad9dc4061d1064033c3abc8a4e3f056e5b61d8533e8190eb96ef3b330b","validFromTimestamp":1753790435,"observationsTimestamp":1753790435} - 2024-10-24T12:52:51-05:00 - --- Report Stream ID: [STREAM_ID] --- + 2025-07-29T07:00:35-05:00 + --- Report Stream ID: 0x0008b8ad9dc4061d1064033c3abc8a4e3f056e5b61d8533e8190eb96ef3b330b --- ------------------------------------------ - Observations Timestamp : 1729792371 - Benchmark Price : 663905000000000000 - Valid From Timestamp : 1729792371 - Expires At : 1729878771 - Link Fee : 0 - Native Fee : 0 - Market Status : 2 + Observations Timestamp : 1753790435 + Mid Price : 213975000000000000000 + Valid From Timestamp : 1753790435 + Last Update Timestamp : 1753759163799000000 + Expires At : 1756382435 + Link Fee (wei) : 17645800951933545 + Native Fee (wei) : 83649982947389 + Market Status : 1 ------------------------------------------ - 2024-10-24T12:52:51-05:00 + 2025-07-29T07:00:35-05:00 --- Stream Stats --- accepted: 2, deduplicated: 0, total_received 2, partial_reconnects: 0, full_reconnects: 0, configured_connections: 1, active_connections 1 -------------------------------------------------------------------------------------------------------------------------------------------- - 2024-10-24T12:52:52-05:00 Raw report data: {"fullReport":"0x...","feedID":"[STREAM_ID]","validFromTimestamp":1729792372,"observationsTimestamp":1729792372} + 2025-07-29T07:00:36-05:00 Raw report data: {"fullReport":"0x00090d9e8d96765a0c49e03a6ae05c82e8f8de70cf179baa632f18313e54bd6900000000000000000000000000000000000000000000000000000000012b1375000000000000000000000000000000000000000000000000000000030000000100000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000280010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200008b8ad9dc4061d1064033c3abc8a4e3f056e5b61d8533e8190eb96ef3b330b000000000000000000000000000000000000000000000000000000006888b7e4000000000000000000000000000000000000000000000000000000006888b7e400000000000000000000000000000000000000000000000000004c14ba7cd814000000000000000000000000000000000000000000000000003eb178e40a71610000000000000000000000000000000000000000000000000000000068b044e400000000000000000000000000000000000000000000000018569aaaebd353c000000000000000000000000000000000000000000000000b997fe8cfd63580000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000298ddee1e11820b03b811f2e79deab6dbef3b9677bdc715030dcfb14b49fc372adb29b400d69c9844def9907e264705716820c1e54ed2bf7d1b1943f5f1df6ee700000000000000000000000000000000000000000000000000000000000000022c8b64907a3e950a7cc1166b1e0e166bf4f27213ab911d397d1aa0fda70aad0c5581ce1fec7463821f6a988290edfdbde86a5c0c12c22123dc7635cd06c018ac","feedID":"0x0008b8ad9dc4061d1064033c3abc8a4e3f056e5b61d8533e8190eb96ef3b330b","validFromTimestamp":1753790436,"observationsTimestamp":1753790436} - 2024-10-24T12:52:52-05:00 - --- Report Stream ID: [STREAM_ID] --- + 2025-07-29T07:00:36-05:00 + --- Report Stream ID: 0x0008b8ad9dc4061d1064033c3abc8a4e3f056e5b61d8533e8190eb96ef3b330b --- ------------------------------------------ - Observations Timestamp : 1729792372 - Benchmark Price : 663900000000000000 - Valid From Timestamp : 1729792372 - Expires At : 1729878772 - Link Fee : 0 - Native Fee : 0 - Market Status : 2 + Observations Timestamp : 1753790436 + Mid Price : 213975000000000000000 + Valid From Timestamp : 1753790436 + Last Update Timestamp : 1753759163799000000 + Expires At : 1756382436 + Link Fee (wei) : 17646581336142177 + Native Fee (wei) : 83651911800852 + Market Status : 1 ------------------------------------------ - 2024-10-24T12:52:52-05:00 + 2025-07-29T07:00:36-05:00 --- Stream Stats --- accepted: 3, deduplicated: 0, total_received 3, partial_reconnects: 0, full_reconnects: 0, configured_connections: 1, active_connections 1 -------------------------------------------------------------------------------------------------------------------------------------------- @@ -296,16 +299,17 @@ In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/r The decoded report details include: -| Attribute | Value | Description | -| ------------------------ | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Stream ID` | `[STREAM_ID]` | The unique identifier for the stream. | -| `Observations Timestamp` | `1729792372` | The timestamp indicating when the data was captured. | -| `Benchmark Price` | `663900000000000000` | The observed price in the report, with 18 decimals. | -| `Valid From Timestamp` | `1729792372` | The start validity timestamp for the report, indicating when the data becomes relevant. | -| `Expires At` | `1729878772` | The expiration timestamp of the report, indicating the point at which the data becomes outdated. | -| `Link Fee` | `0` | The fee to pay in LINK tokens for the onchain verification of the report data. With 18 decimals. **Note:** This example fee is not indicative of actual fees. | -| `Native Fee` | `0` | The fee to pay in the native blockchain token (e.g., ETH on Ethereum) for the onchain verification of the report data. With 18 decimals. **Note:** This example fee is not indicative of actual fees. | -| `Market Status` | `2` | The DON's consensus on whether the market is currently open. Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). | +| Attribute | Value | Description | +| ------------------------ | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Stream ID` | `[STREAM_ID]` | The unique identifier for the stream. | +| `Observations Timestamp` | `1753790436` | The timestamp indicating when the data was captured. | +| `Mid Price` | `213975000000000000000` | The observed price in the report. | +| `Valid From Timestamp` | `1753790436` | The start validity timestamp for the report, indicating when the data becomes relevant. | +| `Last Update Timestamp` | `1753759163799000000` | The timestamp indicating when the data was last updated. | +| `Expires At` | `1756382436` | The expiration timestamp of the report, indicating the point at which the data becomes outdated. | +| `Link Fee` | `17646581336142177` | The fee to pay in LINK tokens for the onchain verification of the report data. **Note:** This example fee is not indicative of actual fees. | +| `Native Fee` | `83651911800852` | The fee to pay in the native blockchain token (e.g., ETH on Ethereum) for the onchain verification of the report data. **Note:** This example fee is not indicative of actual fees. | +| `Market Status` | `1` | The DON's consensus on whether the market is currently open. Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). | #### Payload for onchain verification @@ -327,7 +331,7 @@ As data reports arrive via the established WebSocket connection, they are proces - Reading streams: The [`Read`](https://github.com/smartcontractkit/data-streams-sdk/blob/main/go/stream.go#L266) method on the returned Stream object is continuously called within a loop. This method blocks until new data is available, ensuring that all incoming reports are captured as soon as they are broadcasted. -- Decoding reports: For each received report, the SDK's [`Decode`](https://github.com/smartcontractkit/data-streams-sdk/blob/main/go/report/report.go#L30) function parses and transforms the raw data into a structured format (`v4.Data` for [RWA streams](/data-streams/rwa-streams)). This decoded data includes data such as the observation timestamp, benchmark price, and market status from the report data. +- Decoding reports: For each received report, the SDK's [`Decode`](https://github.com/smartcontractkit/data-streams-sdk/blob/main/go/report/report.go#L30) function parses and transforms the raw data into a structured format (`v8.Data` for [RWA streams](/data-streams/rwa-streams)). This decoded data includes data such as the observation timestamp, median price, and market status from the report data. ### Handling the decoded data diff --git a/src/content/data-streams/tutorials/ws-rwa-rust.mdx b/src/content/data-streams/tutorials/ws-rwa-rust.mdx index d254bbb5650..da0a79a843e 100644 --- a/src/content/data-streams/tutorials/ws-rwa-rust.mdx +++ b/src/content/data-streams/tutorials/ws-rwa-rust.mdx @@ -1,11 +1,11 @@ --- section: dataStreams date: Last Modified -title: "Stream and decode V4 reports via WebSocket using the Rust SDK" +title: "Stream and decode V8 reports via WebSocket using the Rust SDK" metadata: - title: "RWA V4 Reports via WebSocket with Rust SDK | Chainlink Data Streams" - description: "Step-by-step tutorial on streaming and decoding Real World Assets (RWA) V4 reports using WebSocket connections with the Rust SDK." - keywords: ["WebSocket", "Rust SDK", "Real World Assets", "RWA", "V4 reports", "Data Streams"] + title: "RWA V8 Reports via WebSocket with Rust SDK | Chainlink Data Streams" + description: "Step-by-step tutorial on streaming and decoding Real World Assets (RWA) V8 reports using WebSocket connections with the Rust SDK." + keywords: ["WebSocket", "Rust SDK", "Real World Assets", "RWA", "V8 reports", "Data Streams"] whatsnext: { "Learn how to verify your data onchain": "/data-streams/reference/onchain-verification", @@ -26,7 +26,7 @@ import DataStreams from "@features/data-streams/common/DataStreams.astro" icon: "/images/tutorial-icons/go_logo_black.png", }, { - name: "Go SDK - V4 reports for RWA streams", + name: "Go SDK - V8 reports for RWA streams", url: "/data-streams/tutorials/ws-rwa-go", icon: "/images/tutorial-icons/go_logo_black.png", }, @@ -36,14 +36,14 @@ import DataStreams from "@features/data-streams/common/DataStreams.astro" icon: "/images/tutorial-icons/rust_logo_blk.svg", }, { - name: "Rust SDK - V4 reports for RWA streams", + name: "Rust SDK - V8 reports for RWA streams", url: "/data-streams/tutorials/ws-rwa-rust", icon: "/images/tutorial-icons/rust_logo_blk.svg", }, ]} /> -In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/reference/rust-sdk) for Rust to subscribe to real-time [V4 reports](/data-streams/reference/report-schema-v4) for [Real World Assets (RWA) streams](/data-streams/rwa-streams) via a [WebSocket connection](/data-streams/reference/interface-ws). You'll set up your Rust project, listen for real-time reports from the Data Streams Aggregation Network, decode the report data, and log their attributes to your terminal. +In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/reference/rust-sdk) for Rust to subscribe to real-time [V8 reports](/data-streams/reference/report-schema-v8) for [Real World Assets (RWA) streams](/data-streams/rwa-streams) via a [WebSocket connection](/data-streams/reference/interface-ws). You'll set up your Rust project, listen for real-time reports from the Data Streams Aggregation Network, decode the report data, and log their attributes to your terminal. @@ -86,7 +86,7 @@ In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/r ```rust use chainlink_data_streams_report::feed_id::ID; - use chainlink_data_streams_report::report::{ decode_full_report, v4::ReportDataV4 }; // Import the v4 report schema for RWA streams + use chainlink_data_streams_report::report::{ decode_full_report, v8::ReportDataV8 }; // Import the v8 report schema for RWA streams use chainlink_data_streams_sdk::config::Config; use chainlink_data_streams_sdk::stream::Stream; use std::env; @@ -144,14 +144,14 @@ In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/r // Decode the report let full_report = hex::decode(&response.report.full_report[2..])?; let (_report_context, report_blob) = decode_full_report(&full_report)?; - let report_data = ReportDataV4::decode(&report_blob)?; + let report_data = ReportDataV8::decode(&report_blob)?; // Print decoded report details info!( "\n--- Report Stream ID: {} ---\n\ ------------------------------------------\n\ Observations Timestamp : {}\n\ - Benchmark Price : {}\n\ + Mid Price : {}\n\ Valid From Timestamp : {}\n\ Expires At : {}\n\ Link Fee : {}\n\ @@ -160,7 +160,7 @@ In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/r ------------------------------------------", response.report.feed_id.to_hex_string(), response.report.observations_timestamp, - report_data.price, + report_data.mid_price, response.report.valid_from_timestamp, report_data.expires_at, report_data.link_fee, @@ -203,61 +203,61 @@ In this tutorial, you'll learn how to use the [Data Streams SDK](/data-streams/r Expect output similar to the following in your terminal: ```bash - 2024-12-13T23:37:17.054816Z INFO my_data_streams_project: WebSocket connection established. Listening for reports... - 2024-12-13T23:37:17.054876Z INFO data_streams_sdk::stream::monitor_connection: Received ping: [49] - 2024-12-13T23:37:17.054896Z INFO data_streams_sdk::stream::monitor_connection: Responding with pong: [49] - 2024-12-13T23:37:17.199112Z INFO data_streams_sdk::stream::monitor_connection: Received new report from Data Streams Endpoint. - 2024-12-13T23:37:17.199304Z INFO my_data_streams_project: - Raw report data: Report { feed_id: [STREAM_ID], valid_from_timestamp: 1734133037, observations_timestamp: 1734133037, full_report: "0x..." } - - 2024-12-13T23:37:17.199585Z INFO my_data_streams_project: - --- Report Stream ID: [STREAM_ID] --- + 2025-07-29T12:09:15.617757Z INFO rust: WebSocket connection established. Listening for reports... + 2025-07-29T12:09:15.617836Z INFO chainlink_data_streams_sdk::stream::monitor_connection: Received ping: [49] + 2025-07-29T12:09:15.617877Z INFO chainlink_data_streams_sdk::stream::monitor_connection: Responding with pong: [49] + 2025-07-29T12:09:15.819279Z INFO chainlink_data_streams_sdk::stream::monitor_connection: Received new report from Data Streams Endpoint. + 2025-07-29T12:09:15.819631Z INFO rust: + Raw report data: Report { feed_id: 0x0008b8ad9dc4061d1064033c3abc8a4e3f056e5b61d8533e8190eb96ef3b330b, valid_from_timestamp: 1753790955, observations_timestamp: 1753790955, full_report: "0x00090d9e8d96765a0c49e03a6ae05c82e8f8de70cf179baa632f18313e54bd6900000000000000000000000000000000000000000000000000000000012b199d000000000000000000000000000000000000000000000000000000030000000100000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000280000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200008b8ad9dc4061d1064033c3abc8a4e3f056e5b61d8533e8190eb96ef3b330b000000000000000000000000000000000000000000000000000000006888b9eb000000000000000000000000000000000000000000000000000000006888b9eb00000000000000000000000000000000000000000000000000004c12b1c3b739000000000000000000000000000000000000000000000000003ebece93dcc9390000000000000000000000000000000000000000000000000000000068b046eb00000000000000000000000000000000000000000000000018569aaaebd353c000000000000000000000000000000000000000000000000b997fe8cfd63580000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000278154493ef77e0fe1f9baa5ccd9d962c021e9cf6cfd96f748890cf301d46adb4737644538d68a63a0045ce0a61e66b5ebe76d14f8ba5a7a432fb105a479f3aa7000000000000000000000000000000000000000000000000000000000000000266d0176f466e6165c7ddd8f5c31857056fac693d640eec7f088f1b416762249a5ba66e2633513850e016ea385f7a4dc57cdd46ee99513e6710a1a76a5b84f10f" } + + 2025-07-29T12:09:15.820629Z INFO rust: + --- Report Stream ID: 0x0008b8ad9dc4061d1064033c3abc8a4e3f056e5b61d8533e8190eb96ef3b330b --- ------------------------------------------ - Observations Timestamp : 1734133037 - Benchmark Price : 636160000000000000 - Valid From Timestamp : 1734133037 - Expires At : 1734219437 - Link Fee : 0 - Native Fee : 0 + Observations Timestamp : 1753790955 + Mid Price : 213975000000000000000 + Valid From Timestamp : 1753790955 + Expires At : 1756382955 + Link Fee : 17661243009321273 + Native Fee : 83643175515961 Market Status : 1 ------------------------------------------ - 2024-12-13T23:37:17.199633Z INFO my_data_streams_project: + 2025-07-29T12:09:15.82085Z INFO rust: --- Stream Stats --- StatsSnapshot { - accepted: 1, - deduplicated: 0, - total_received: 1, - partial_reconnects: 0, - full_reconnects: 0, - configured_connections: 1, - active_connections: 1, + accepted: 1, + deduplicated: 0, + total_received: 1, + partial_reconnects: 0, + full_reconnects: 0, + configured_connections: 1, + active_connections: 1, } -------------------------------------------------------------------------------------------------------------------------------------------- - 2024-12-13T23:37:18.215222Z INFO data_streams_sdk::stream::monitor_connection: Received new report from Data Streams Endpoint. - 2024-12-13T23:37:18.21587Z INFO my_data_streams_project: - Raw report data: Report { feed_id: [STREAM_ID], valid_from_timestamp: 1734133038, observations_timestamp: 1734133038, full_report: "0x..." } + 2025-07-29T12:09:16.504035Z INFO chainlink_data_streams_sdk::stream::monitor_connection: Received new report from Data Streams Endpoint. + 2025-07-29T12:09:16.504224Z INFO rust: + Raw report data: Report { feed_id: 0x0008b8ad9dc4061d1064033c3abc8a4e3f056e5b61d8533e8190eb96ef3b330b, valid_from_timestamp: 1753790956, observations_timestamp: 1753790956, full_report: "0x00090d9e8d96765a0c49e03a6ae05c82e8f8de70cf179baa632f18313e54bd6900000000000000000000000000000000000000000000000000000000012b199f000000000000000000000000000000000000000000000000000000030000000100000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000280010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200008b8ad9dc4061d1064033c3abc8a4e3f056e5b61d8533e8190eb96ef3b330b000000000000000000000000000000000000000000000000000000006888b9ec000000000000000000000000000000000000000000000000000000006888b9ec00000000000000000000000000000000000000000000000000004c1461a41510000000000000000000000000000000000000000000000000003ebf36fa53c22f0000000000000000000000000000000000000000000000000000000068b046ec00000000000000000000000000000000000000000000000018569aaaebd353c000000000000000000000000000000000000000000000000b997fe8cfd635800000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002b94b94745322432804bd8be7f5f3f87d29bc554b46fe8effe29df5f45eaf0eaaf1355088c6fe8c9212f194d34b77497a4656797c5bca6c273f7c93a1ca2abd2900000000000000000000000000000000000000000000000000000000000000027c4e7d0a1485bb6eff898613e42b468095161657d7661633e3e2a3713cb6b86f7f925431bbe7700f663e6dfd53fbb10df836bb917b5cd5189ff5c04bc96d60da" } - 2024-12-13T23:37:18.216946Z INFO my_data_streams_project: - --- Report Stream ID: [STREAM_ID] --- + 2025-07-29T12:09:16.504502Z INFO rust: + --- Report Stream ID: 0x0008b8ad9dc4061d1064033c3abc8a4e3f056e5b61d8533e8190eb96ef3b330b --- ------------------------------------------ - Observations Timestamp : 1734133038 - Benchmark Price : 636160000000000000 - Valid From Timestamp : 1734133038 - Expires At : 1734219438 - Link Fee : 0 - Native Fee : 0 + Observations Timestamp : 1753790956 + Mid Price : 213975000000000000000 + Valid From Timestamp : 1753790956 + Expires At : 1756382956 + Link Fee : 17661691404993071 + Native Fee : 83650421200144 Market Status : 1 ------------------------------------------ - 2024-12-13T23:37:18.21714Z INFO my_data_streams_project: + 2025-07-29T12:09:16.504541Z INFO rust: --- Stream Stats --- StatsSnapshot { - accepted: 2, - deduplicated: 0, - total_received: 2, - partial_reconnects: 0, - full_reconnects: 0, - configured_connections: 1, - active_connections: 1, + accepted: 2, + deduplicated: 0, + total_received: 2, + partial_reconnects: 0, + full_reconnects: 0, + configured_connections: 1, + active_connections: 1, } [...] @@ -292,16 +292,16 @@ This will subscribe to both streams. The decoded report details include: -| Attribute | Value | Description | -| ------------------------ | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Stream ID` | `[STREAM_ID]` | The unique identifier for the stream. | -| `Observations Timestamp` | `1734133037` | The timestamp indicating when the data was captured. | -| `Benchmark Price` | `636160000000000000` | The observed price in the report, with 18 decimals. For readability: `0.63616` USD per AUD. | -| `Valid From Timestamp` | `1734133037` | The start validity timestamp for the report, indicating when the data becomes relevant. | -| `Expires At` | `1734219437` | The expiration timestamp of the report, indicating the point at which the data becomes outdated. | -| `Link Fee` | `0` | The fee to pay in LINK tokens for the onchain verification of the report data. With 18 decimals. **Note:** This example fee is not indicative of actual fees. | -| `Native Fee` | `0` | The fee to pay in the native blockchain token (e.g., ETH on Ethereum) for the onchain verification of the report data. With 18 decimals. **Note:** This example fee is not indicative of actual fees. | -| `Market Status` | `1` | The DON's consensus on whether the market is currently open. Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). In this case, the market is closed. | +| Attribute | Value | Description | +| ------------------------ | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Stream ID` | `[STREAM_ID]` | The unique identifier for the stream. | +| `Observations Timestamp` | `1753790956` | The timestamp indicating when the data was captured. | +| `Mid Price` | `213975000000000000000` | The observed price in the report. | +| `Valid From Timestamp` | `1753790956` | The start validity timestamp for the report, indicating when the data becomes relevant. | +| `Expires At` | `1756382956` | The expiration timestamp of the report, indicating the point at which the data becomes outdated. | +| `Link Fee` | `17661691404993071` | The fee to pay in LINK tokens for the onchain verification of the report data. **Note:** This example fee is not indicative of actual fees. | +| `Native Fee` | `83650421200144` | The fee to pay in the native blockchain token (e.g., ETH on Ethereum) for the onchain verification of the report data. **Note:** This example fee is not indicative of actual fees. | +| `Market Status` | `1` | The DON's consensus on whether the market is currently open. Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). In this case, the market is closed. | #### Payload for onchain verification @@ -334,8 +334,8 @@ As data reports arrive via the WebSocket connection, they are processed in real- 2. Decoding reports: Each report is decoded in two stages: - [`decode_full_report`](https://github.com/smartcontractkit/data-streams-sdk/blob/main/rust/crates/report/src/report.rs#L77) parses the raw hexadecimal data, separating the report context (containing metadata) from the report blob - - [`ReportDataV4::decode`](https://github.com/smartcontractkit/data-streams-sdk/blob/main/rust/crates/report/src/report/v4.rs#L57) transforms the report blob into a structured format containing: - - The benchmark price (with 18 decimal places) + - [`ReportDataV8::decode`](https://github.com/smartcontractkit/data-streams-sdk/blob/main/rust/crates/report/src/report/v8.rs#L60) transforms the report blob into a structured format containing: + - The mid price - Market status (indicating if the market is open, closed, or unknown) - Fee information for onchain verification - Timestamp information diff --git a/src/features/data-streams/common/gettingStarted.mdx b/src/features/data-streams/common/gettingStarted.mdx index f61eba170f8..5b6d7822626 100644 --- a/src/features/data-streams/common/gettingStarted.mdx +++ b/src/features/data-streams/common/gettingStarted.mdx @@ -226,7 +226,7 @@ The `lastDecodedPrice` getter function of your upkeep contract retrieves the las Chainlink Data Streams uses different data types for feed IDs at different stages of the process: - The [`StreamsLookup` error](https://github.com/smartcontractkit/chainlink/blob/contracts-v1.3.0/contracts/src/v0.8/automation/interfaces/StreamsLookupCompatibleInterface.sol#L6) requires feed IDs to be provided as an array of `string`, -- The decoded reports within the contract use `bytes32` types for feed IDs (see the [Report Schemas](/data-streams/reference/report-schema) reference). +- The decoded reports within the contract use `bytes32` types for feed IDs (see the [Report Schemas](/data-streams/reference/report-schema-v3) reference). If your application needs to compare the feed ID(s) sent in the `StreamsLookup` with those received in the report(s), you must convert between `string` and `bytes32` types. diff --git a/src/features/data-streams/common/gettingStartedHardhat.mdx b/src/features/data-streams/common/gettingStartedHardhat.mdx index 7747924bd85..82bc4feecff 100644 --- a/src/features/data-streams/common/gettingStartedHardhat.mdx +++ b/src/features/data-streams/common/gettingStartedHardhat.mdx @@ -210,7 +210,7 @@ The [`getLastRetrievedPrice`](https://github.com/smartcontractkit/smart-contract Chainlink Data Streams uses different data types for feed IDs at different stages of the process: - The [`StreamsLookup` error](https://github.com/smartcontractkit/chainlink/blob/contracts-v1.3.0/contracts/src/v0.8/automation/interfaces/StreamsLookupCompatibleInterface.sol#L6) requires feed IDs to be provided as an array of `string`, -- The decoded reports within the contract use `bytes32` types for feed IDs (see the [Report Schemas](/data-streams/reference/report-schema) reference). +- The decoded reports within the contract use `bytes32` types for feed IDs (see the [Report Schemas](/data-streams/reference/report-schema-v3) reference). If your application needs to compare the feed ID(s) sent in the `StreamsLookup` with those received in the report(s), you must convert between `string` and `bytes32` types. diff --git a/src/features/feeds/components/Tables.tsx b/src/features/feeds/components/Tables.tsx index 6ffcab6f00a..6c31fd090d5 100644 --- a/src/features/feeds/components/Tables.tsx +++ b/src/features/feeds/components/Tables.tsx @@ -819,7 +819,7 @@ const StreamsTr = ({ metadata, isMainnet }) => ( {metadata.docs.assetClass} {metadata.docs.assetSubClass && metadata.docs.assetSubClass !== "Crypto" && - metadata.docs.assetSubClass !== "Forex" + metadata.docs.assetSubClass !== "Equities" ? " - " + metadata.docs.assetSubClass : ""} @@ -875,20 +875,20 @@ const StreamsTr = ({ metadata, isMainnet }) => ( Report Schema:
- + Crypto Schema (v3)
)}{" "} - {metadata.feedType === "Forex" && ( + {metadata.feedType === "Equities" && ( @@ -959,7 +959,7 @@ export const MainnetTable = ({ } if (dataFeedType === "streamsRwa") { - return metadata.contractType === "verifier" && metadata.docs.feedType === "Forex" + return metadata.contractType === "verifier" && metadata.docs.feedType === "Equities" } if (isSmartData) { @@ -1139,7 +1139,7 @@ export const TestnetTable = ({ } if (dataFeedType === "streamsRwa") { - return metadata.contractType === "verifier" && metadata.feedType === "Forex" + return metadata.contractType === "verifier" && metadata.feedType === "Equities" } } diff --git a/src/features/redirects/redirects.json b/src/features/redirects/redirects.json index 617d091db09..51a93f5fcab 100644 --- a/src/features/redirects/redirects.json +++ b/src/features/redirects/redirects.json @@ -2389,6 +2389,11 @@ "source": "data-streams/tutorials", "destination": "data-streams/tutorials/overview", "statusCode": 301 + }, + { + "source": "data-streams/reference/report-schema", + "destination": "data-streams/reference/report-schema-v3", + "statusCode": 301 } ] }