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
-**[Dedot](/reference/tools/dedot/){target=\_blank}**: Lightweight TypeScript library optimized for performance
18
+
-**[Python Substrate Interface](/reference/tools/py-substrate-interface/){target=\_blank}**: Python library for Substrate chains
19
+
-**[Subxt](/reference/tools/subxt/){target=\_blank}**: Rust library with compile-time type safety
20
20
21
21
Select your preferred SDK below to see complete, runnable examples that send balance transfer transactions on Polkadot Hub.
22
22
23
-
!!! note
24
-
Ensure to replace `INSERT_WS_ENDPOINT` with the proper WebSocket endpoint, `INSERT_SENDER_MNEMONIC` with your account's mnemonic phrase, and `INSERT_DEST_ADDRESS` with the recipient address. For this example, you can use Polkadot Hub (`wss://polkadot-asset-hub-rpc.polkadot.io`).
25
-
26
-
!!! warning
27
-
Never share your mnemonic phrase or private keys. The examples below use mnemonics for demonstration purposes only. In production, use secure key management solutions.
28
-
29
23
## Prerequisites
30
24
31
25
- Access to a Polkadot-SDK-compatible wallet, with its mnemonic phrase or private key.
32
26
- A funded account on Polkadot Hub, with some testnet tokens. You can use the [Polkadot Faucet](https://faucet.polkadot.io/?parachain=1111){target=\_blank} to obtain test tokens.
33
27
34
28
## Send Transactions
35
29
36
-
=== "PAPI"
30
+
!!! warning
31
+
Never share your mnemonic phrase or private keys. The examples below use mnemonics for demonstration purposes only. In production, use secure key management solutions.
37
32
38
-
[Polkadot API (PAPI)](/reference/tools/papi/){target=\_blank} is a modern, type-safe TypeScript library optimized for light-client functionality.
33
+
=== "PAPI"
39
34
40
35
**Prerequisites**
41
36
@@ -68,12 +63,15 @@ Select your preferred SDK below to see complete, runnable examples that send bal
68
63
69
64
The following example constructs, signs, and submits a balance transfer transaction.
70
65
71
-
Create a file named `send-transfer.ts`:
66
+
Create a file named `send-transfer.ts` and add the following code to it:
Ensure to replace `INSERT_WS_ENDPOINT` with the proper WebSocket endpoint, `INSERT_SENDER_MNEMONIC` with your account's mnemonic phrase, and `INSERT_DEST_ADDRESS` with the recipient address. For this example, you can use Polkadot Hub (`wss://polkadot-asset-hub-rpc.polkadot.io`).
74
+
77
75
Run the script:
78
76
79
77
```bash
@@ -89,8 +87,6 @@ Select your preferred SDK below to see complete, runnable examples that send bal
89
87
!!! warning "Maintenance Mode Only"
90
88
The Polkadot.js API is no longer actively developed. New projects should use [PAPI](/reference/tools/papi/){target=\_blank} or [Dedot](/reference/tools/dedot/){target=\_blank} as actively maintained alternatives.
91
89
92
-
[Polkadot.js API](/reference/tools/polkadot-js-api/){target=\_blank} is a comprehensive JavaScript library with extensive ecosystem support.
93
-
94
90
**Prerequisites**
95
91
96
92
- [Node.js](https://nodejs.org/){target=\_blank} v18 or higher
@@ -115,12 +111,15 @@ Select your preferred SDK below to see complete, runnable examples that send bal
115
111
116
112
The following example constructs, signs, and submits a balance transfer transaction.
117
113
118
-
Create a file named `send-transfer.js`:
114
+
Create a file named `send-transfer.js` and add the following code:
Ensure to replace `INSERT_WS_ENDPOINT` with the proper WebSocket endpoint, `INSERT_SENDER_MNEMONIC` with your account's mnemonic phrase, and `INSERT_DEST_ADDRESS` with the recipient address. For this example, you can use Polkadot Hub (`wss://polkadot-asset-hub-rpc.polkadot.io`).
122
+
124
123
Run the script:
125
124
126
125
```bash
@@ -133,8 +132,6 @@ Select your preferred SDK below to see complete, runnable examples that send bal
133
132
134
133
=== "Dedot"
135
134
136
-
[Dedot](/reference/tools/dedot/){target=\_blank} is a next-generation TypeScript client that's lightweight, tree-shakable, and maintains API compatibility with Polkadot.js.
137
-
138
135
**Prerequisites**
139
136
140
137
- [Node.js](https://nodejs.org/){target=\_blank} v18 or higher
@@ -160,12 +157,15 @@ Select your preferred SDK below to see complete, runnable examples that send bal
160
157
161
158
The following example constructs, signs, and submits a balance transfer transaction.
162
159
163
-
Create a file named `send-transfer.ts`:
160
+
Create a file named `send-transfer.ts` and add the following code to it:
Ensure to replace `INSERT_WS_ENDPOINT` with the proper WebSocket endpoint, `INSERT_SENDER_MNEMONIC` with your account's mnemonic phrase, and `INSERT_DEST_ADDRESS` with the recipient address. For this example, you can use Polkadot Hub (`wss://polkadot-asset-hub-rpc.polkadot.io`).
168
+
169
169
Run the script:
170
170
171
171
```bash
@@ -176,9 +176,7 @@ Select your preferred SDK below to see complete, runnable examples that send bal
[Python Substrate Interface](/reference/tools/py-substrate-interface/){target=\_blank} provides a Python library for interacting with Substrate-based chains.
179
+
=== "Python Substrate Interface"
182
180
183
181
**Prerequisites**
184
182
@@ -204,12 +202,15 @@ Select your preferred SDK below to see complete, runnable examples that send bal
204
202
205
203
The following example constructs, signs, and submits a balance transfer transaction.
206
204
207
-
Create a file named `send_transfer.py`:
205
+
Create a file named `send_transfer.py` and add the following code to it:
Ensure to replace `INSERT_WS_ENDPOINT` with the proper WebSocket endpoint, `INSERT_SENDER_MNEMONIC` with your account's mnemonic phrase, and `INSERT_DEST_ADDRESS` with the recipient address. For this example, you can use Polkadot Hub (`wss://polkadot-asset-hub-rpc.polkadot.io`).
213
+
213
214
Run the script:
214
215
215
216
```bash
@@ -259,12 +260,15 @@ Select your preferred SDK below to see complete, runnable examples that send bal
259
260
260
261
The following example constructs, signs, and submits a balance transfer transaction.
261
262
262
-
Create a file at `src/bin/send_transfer.rs`:
263
+
Create a file at `src/bin/send_transfer.rs` and add the following code to it:
Ensure to replace `INSERT_WS_ENDPOINT` with the proper WebSocket endpoint, `INSERT_SENDER_MNEMONIC` with your account's mnemonic phrase, and `INSERT_DEST_ADDRESS` with the recipient address. For this example, you can use Polkadot Hub (`wss://polkadot-asset-hub-rpc.polkadot.io`).
271
+
268
272
Run the script:
269
273
270
274
```bash
@@ -277,8 +281,22 @@ Select your preferred SDK below to see complete, runnable examples that send bal
277
281
278
282
## Where to Go Next
279
283
280
-
Now that you understand how to send transactions, explore these related topics:
0 commit comments