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: develop/toolkit/api-libraries/subxt.md
+20-24Lines changed: 20 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,42 +23,38 @@ Before using subxt, ensure you have the following installed:
23
23
24
24
To use subxt in your project, you need to install the necessary dependencies. Each plays a specific role in enabling interaction with the blockchain:
25
25
26
-
### Install the Subxt CLI
26
+
1. Install the subxt CLI - [`subxt-cli`](https://crates.io/crates/subxt-cli){target=\_blank} is a command-line tool that provides utilities for working with Polkadot SDK metadata. In the context of subxt, it is essential for downloading chain metadata, which is required to generate type-safe Rust interfaces for interacting with the blockchain. Install it using:
27
27
28
-
[`subxt-cli`](https://crates.io/crates/subxt-cli){target=\_blank} is a command-line tool that provides utilities for working with Polkadot SDK metadata. In the context of subxt, it is essential for downloading chain metadata, which is required to generate type-safe Rust interfaces for interacting with the blockchain. Install it using:
28
+
```bash
29
+
cargo install subxt-cli
30
+
```
29
31
30
-
```bash
31
-
cargo install subxt-cli
32
-
```
32
+
2. Add core dependencies - these dependencies are essential for interacting with the blockchain:
33
33
34
-
### Add Core Dependencies
34
+
- **[subxt](https://crates.io/crates/subxt){target=\_blank}** - the main library for communicating with Polkadot SDK nodes. It handles RPC requests, encoding/decoding, and type generation
35
35
36
-
These dependencies are essential for interacting with the blockchain:
36
+
```bash
37
+
cargo add subxt
38
+
```
37
39
38
-
- **[subxt](https://crates.io/crates/subxt){target=\_blank}** - the main libraryforcommunicating with Polkadot SDK nodes. It handles RPC requests, encoding/decoding, and type generation
40
+
- **[subxt-signer](https://crates.io/crates/subxt-signer){target=\_blank}** - provides cryptographic functionalityforsigning transactions. Without this, you can only read data but cannot submit transactions
39
41
40
-
```bash
41
-
cargo add subxt
42
-
```
42
+
```bash
43
+
cargo add subxt-signer
44
+
```
43
45
44
-
- **[subxt-signer](https://crates.io/crates/subxt-signer){target=\_blank}** - provides cryptographic functionalityforsigning transactions. Without this, you can only read data but cannot submit transactions
46
+
- **[tokio](https://crates.io/crates/tokio){target=\_blank}** - an asynchronous runtimeforRust. Since blockchain operations are async, Tokio enables efficient handling of network requests. The `rt` feature enables Tokio’s runtime, including the current-thread single-threaded scheduler, necessary for async execution. The `macros` feature provides procedural macros like `#[tokio::main]` to simplify runtime setup
45
47
46
-
```bash
47
-
cargo add subxt-signer
48
-
```
48
+
```bash
49
+
cargo add tokio --features rt,macros
50
+
```
49
51
50
-
- **[tokio](https://crates.io/crates/tokio){target=\_blank}** - an asynchronous runtime for Rust. Since blockchain operations are async, Tokio enables efficient handling of network requests. The `rt` feature enables Tokio’s runtime, including the current-thread single-threaded scheduler, necessary for async execution. The `macros` feature provides procedural macros like `#[tokio::main]` to simplify runtime setup
52
+
After adding the dependencies, your `Cargo.toml` should look like this:
This guide will walk you through the fundamental operations of subxt, from setting up your environment to executing transactions and querying blockchain state.
Copy file name to clipboardExpand all lines: llms.txt
+21-25Lines changed: 21 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -7792,40 +7792,36 @@ Before using subxt, ensure you have the following installed:
7792
7792
7793
7793
To use subxt in your project, you need to install the necessary dependencies. Each plays a specific role in enabling interaction with the blockchain:
7794
7794
7795
-
### Install the Subxt CLI
7795
+
1. Install the subxt CLI - [`subxt-cli`](https://crates.io/crates/subxt-cli){target=\_blank} is a command-line tool that provides utilities for working with Polkadot SDK metadata. In the context of subxt, it is essential for downloading chain metadata, which is required to generate type-safe Rust interfaces for interacting with the blockchain. Install it using:
7796
7796
7797
-
[`subxt-cli`](https://crates.io/crates/subxt-cli){target=\_blank} is a command-line tool that provides utilities for working with Polkadot SDK metadata. In the context of subxt, it is essential for downloading chain metadata, which is required to generate type-safe Rust interfaces for interacting with the blockchain. Install it using:
7798
-
7799
-
```bash
7800
-
cargo install subxt-cli
7801
-
```
7802
-
7803
-
### Add Core Dependencies
7797
+
```bash
7798
+
cargo install subxt-cli
7799
+
```
7804
7800
7805
-
These dependencies are essential for interacting with the blockchain:
7801
+
2. Add core dependencies - these dependencies are essential for interacting with the blockchain:
7806
7802
7807
-
- **[subxt](https://crates.io/crates/subxt){target=\_blank}** - the main library for communicating with Polkadot SDK nodes. It handles RPC requests, encoding/decoding, and type generation
7803
+
- **[subxt](https://crates.io/crates/subxt){target=\_blank}** - the main library for communicating with Polkadot SDK nodes. It handles RPC requests, encoding/decoding, and type generation
7808
7804
7809
-
```bash
7810
-
cargo add subxt
7811
-
```
7805
+
```bash
7806
+
cargo add subxt
7807
+
```
7812
7808
7813
-
- **[subxt-signer](https://crates.io/crates/subxt-signer){target=\_blank}** - provides cryptographic functionality for signing transactions. Without this, you can only read data but cannot submit transactions
7809
+
- **[subxt-signer](https://crates.io/crates/subxt-signer){target=\_blank}** - provides cryptographic functionality for signing transactions. Without this, you can only read data but cannot submit transactions
7814
7810
7815
-
```bash
7816
-
cargo add subxt-signer
7817
-
```
7811
+
```bash
7812
+
cargo add subxt-signer
7813
+
```
7818
7814
7819
-
- **[tokio](https://crates.io/crates/tokio){target=\_blank}** - an asynchronous runtime for Rust. Since blockchain operations are async, Tokio enables efficient handling of network requests. The `rt` feature enables Tokio’s runtime, including the current-thread single-threaded scheduler, necessary for async execution. The `macros` feature provides procedural macros like `#[tokio::main]` to simplify runtime setup
7815
+
- **[tokio](https://crates.io/crates/tokio){target=\_blank}** - an asynchronous runtime for Rust. Since blockchain operations are async, Tokio enables efficient handling of network requests. The `rt` feature enables Tokio’s runtime, including the current-thread single-threaded scheduler, necessary for async execution. The `macros` feature provides procedural macros like `#[tokio::main]` to simplify runtime setup
7820
7816
7821
-
```bash
7822
-
cargo add tokio --features rt,macros
7823
-
```
7817
+
```bash
7818
+
cargo add tokio --features rt,macros
7819
+
```
7824
7820
7825
-
After adding the dependencies, your `Cargo.toml` should look like this:
7821
+
After adding the dependencies, your `Cargo.toml` should look like this:
7826
7822
7827
-
```toml
7828
-
[package]
7823
+
```toml
7824
+
[package]
7829
7825
name = "my-project"
7830
7826
version = "0.1.0"
7831
7827
edition = "2021"
@@ -7834,7 +7830,7 @@ edition = "2021"
7834
7830
subxt = "0.39.0"
7835
7831
subxt-signer = "0.39.0"
7836
7832
tokio = { version = "1.43.0", features = ["rt", "macros"] }
0 commit comments