You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/data-streams/tutorials/streams-direct/solana-onchain-report-verification.mdx
+34-44Lines changed: 34 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,19 +73,23 @@ Before you begin, you should have:
73
73
74
74
To complete this guide, you'll need:
75
75
76
-
-**Rust and Cargo**: Install the latest version using [rustup](https://rustup.rs/). Run <CopyTexttext="rustc --version"code/> to verify your installation.
76
+
-**Rust tool-chain ([rustup](https://rustup.rs/))**: Use `rustc` and `cargo` ≥ 1.73 (the version Anchor 0.31 requires). Run <CopyTexttext="rustc --version"code/> to verify your installation.
77
77
78
-
-**Solana CLI tools**: Install the latest version following the [official guide](https://docs.solana.com/cli/install-solana-cli-tools). Run <CopyTexttext="solana --version"code/> to verify your installation.
78
+
-**Solana CLI tools**: Use 2.x (Anchor 0.31 is built against the 2.x SDK). Install an appropriate version following the [official guide](https://docs.solana.com/cli/install-solana-cli-tools). Run <CopyTexttext="solana --version"code/> to verify your installation.
79
79
80
-
-**Anchor Framework**: Follow the [official installation guide](https://www.anchor-lang.com/docs/installation). Run <CopyTexttext="anchor --version"code /> to verify your installation.
80
+
-**Anchor Framework**: Use Anchor ≥ 0.31.0 (older 0.29/0.30 will not work with Solana 2.x.). Follow the [official installation guide](https://www.anchor-lang.com/docs/installation). Run <CopyTexttext="anchor --version"code /> to verify your installation.
81
81
82
-
-**Node.js and npm**: [Install Node.js 20 or later](https://nodejs.org/). Verify your installation with <CopyTexttext="node --version"code/>.
82
+
-**Node.js and npm**: [Install Node.js ≥ 20](https://nodejs.org/). Verify your installation with <CopyTexttext="node --version"code/>.
83
83
84
-
-**ts-node**: Install globally using npm: <CopyTexttext="npm install -g ts-node"code/>. Verify your installation with <CopyTexttext="ts-node --version"code/>.
84
+
-**ts-node**: Use ts-node ≥ 10. Install globally using npm: <CopyTexttext="npm install -g ts-node"code/>. Verify your installation with <CopyTexttext="ts-node --version"code/>.
85
85
86
-
-**Devnet SOL**: You'll need devnet SOL for deployment and testing. Use the [Solana CLI](https://docs.solana.com/cli/transfer-tokens#airdrop-some-tokens-to-get-started) or the [Solana Faucet](https://faucet.solana.com/) to get devnet SOL.
86
+
-**Devnet SOL**: You'll need ~3-5 SOL in your devnet wallet for deployment and testing. Use the [Solana CLI](https://docs.solana.com/cli/transfer-tokens#airdrop-some-tokens-to-get-started) or the [Solana Faucet](https://faucet.solana.com/) to get devnet SOL.
87
87
88
-
> **Note**: While this guide uses the Anchor framework for project structure, you can integrate the verification using any Rust-based Solana program framework. The verifier SDK is written in Rust, but you can integrate it into your preferred Rust program structure.
88
+
<Asidetype="note"title="Framework agnostic">
89
+
While this guide uses the Anchor framework for project structure, you can integrate the verification using any
90
+
Rust-based Solana program framework. The verifier SDK is written in Rust, but you can integrate it into your preferred
91
+
Rust program structure.
92
+
</Aside>
89
93
90
94
### Implementation guide
91
95
@@ -110,12 +114,14 @@ To complete this guide, you'll need:
110
114
Open your `Anchor.toml` file at the root of your project and update it to use devnet:
111
115
112
116
```toml
117
+
[toolchain]
118
+
solana_version = "2.1.0"
119
+
113
120
[features]
114
-
seeds = false
121
+
resolution = true
115
122
skip-lint = false
116
123
117
124
[programs.devnet]
118
-
# Replace with your program ID
119
125
example_verify = "<YOUR_PROGRAM_ID>"
120
126
121
127
[registry]
@@ -137,11 +143,11 @@ In your program's manifest file (`programs/example_verify/Cargo.toml`), add the
@@ -253,7 +258,12 @@ Replace `<YOUR_PROGRAM_ID>` with your program ID in the `declare_id!` macro. You
253
258
254
259
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.
255
260
256
-
> 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.
261
+
<Asidetype="note"title="Report schema version">
262
+
The report schema version is important for decoding the report data correctly. The example uses the [V3
263
+
schema](/data-streams/reference/report-schema) for crypto streams. If you verify reports for RWA streams, use the [V4
264
+
schema](/data-streams/reference/report-schema-v4) from the [report
@@ -303,10 +299,7 @@ In this section, you'll write a client script to interact with your deployed pro
303
299
304
300
1. In the `tests` directory, create a new file <CopyTexttext="verify_test.ts"code/> to interact with your deployed program.
305
301
306
-
1. Populate your `verify_tests.ts` file with the example client script below.
307
-
308
-
- Replace `<YOUR_PROGRAM_ID>` with your program ID.
309
-
- This example provides a report payload. To use your own report payload, update the `hexString` variable.
302
+
1. Populate your `verify_test.ts` file with the example client script below. This example provides a report payload. To use your own report payload, update the `hexString` variable.
310
303
311
304
```typescript
312
305
import*asanchorfrom"@coral-xyz/anchor"
@@ -323,12 +316,9 @@ In this section, you'll write a client script to interact with your deployed pro
323
316
const provider =anchor.AnchorProvider.env()
324
317
anchor.setProvider(provider)
325
318
326
-
// Initialize your program using the IDL and your program ID
327
-
const program =newProgram<ExampleVerify>(
328
-
require("../target/idl/example_verify.json"),
329
-
"<YOUR_PROGRAM_ID>",
330
-
provider
331
-
)
319
+
// Initialize the program using Anchor workspace - this automatically
320
+
// loads the IDL and program ID from lib.rs (declare_id!)
321
+
const program =anchor.workspace.ExampleVerifyasProgram<ExampleVerify>
332
322
333
323
// Convert the hex string to a Uint8Array
334
324
// This is an example report payload for a crypto stream
@@ -455,15 +445,15 @@ In this section, you'll write a client script to interact with your deployed pro
0 commit comments