Skip to content

Commit e872e9f

Browse files
committed
Merge remote-tracking branch 'origin' into dawn/add-llms-category
2 parents d173943 + eea5a67 commit e872e9f

File tree

23 files changed

+288
-60
lines changed

23 files changed

+288
-60
lines changed

.DS_Store

6 KB
Binary file not shown.

develop/smart-contracts/dev-environments/hardhat.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Before getting started, ensure you have:
5252
3. To interact with Polkadot, Hardhat requires the following plugin to compile contracts to PolkaVM bytecode and to spawn a local node compatible with PolkaVM:
5353

5454
```bash
55-
npm install --save-dev @parity/[email protected].5
55+
npm install --save-dev @parity/[email protected].8
5656
```
5757

5858
4. Create a Hardhat project:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
title: Precompiles
22
nav:
33
- index.md
4-
- 'Interact With Precompiles': interact-with-precompiles.md
4+
- 'Interact with Precompiles': interact-with-precompiles.md
55
- 'XCM Precompile': xcm-precompile.md

develop/smart-contracts/wallets.md

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,57 +22,92 @@ To get started with MetaMask, you need to install the [MetaMask extension](https
2222

2323
For example, to connect to the Polkadot Hub TestNet via MetaMask, you need to follow these steps:
2424

25-
1. Open the MetaMask extension and click on the network icon to switch to the Polkadot Hub TestNet
25+
1. Open the MetaMask extension and click on the network icon to switch to the Polkadot Hub TestNet.
2626

2727
![](/images/develop/smart-contracts/wallets/wallets-1.webp){: .browser-extension}
2828

29-
2. Click on the **Add a custom network** button
29+
2. Click on the **Add a custom network** button.
3030

3131
![](/images/develop/smart-contracts/wallets/wallets-2.webp){: .browser-extension}
3232

33-
3. Complete the necessary fields, then click the **Save** button (refer to the [Networks](/develop/smart-contracts/connect-to-polkadot#networks-details) section for copy and paste parameters)
33+
3. Complete the necessary fields, then click the **Save** button (refer to the [Networks](/develop/smart-contracts/connect-to-polkadot#networks-details){target=\_blank} section for copy and paste parameters).
3434

3535
![](/images/develop/smart-contracts/wallets/wallets-3.webp){: .browser-extension}
3636

37-
4. Click on **Polkadot Hub TestNet** to switch the network
37+
4. Click on **Polkadot Hub TestNet** to switch the network.
3838

3939
![](/images/develop/smart-contracts/wallets/wallets-4.webp){: .browser-extension}
4040

4141
The steps in the preceding section can be used to connect to any chain by modifying the network specification and endpoint parameters.
4242

43+
### SubWallet
44+
45+
[SubWallet](https://www.subwallet.app/){target=\_blank} is a popular non-custodial wallet solution for Polkadot and Ethereum ecosystems. It offers seamless integration with Polkadot SDK-based networks while maintaining Ethereum compatibility, making the wallet an ideal choice for users and developers to interact with Polkadot Hub.
46+
47+
SubWallet now fully supports the [Polkadot Hub TestNet](/polkadot-protocol/smart-contract-basics/networks/#test-networks){target=\_blank} where developers can deploy and interact with Ethereum-compatible, Solidity smart contracts.
48+
49+
You can easily view and manage your Paseo native token (PAS) using the Ethereum RPC endpoint (Passet Hub EVM) or the Substrate node RPC endpoint (passet-hub).
50+
51+
??? code "Polkadot Hub TestNet"
52+
You can see support here for Polkadot Hub's TestNet. The **Passet Hub EVM** network uses an ETH RPC endpoint, and the **passet-hub** uses a Substrate endpoint.
53+
The ETH RPC endpoint will let you send transactions that follow an ETH format, while the Substrate endpoint will follow a Substrate transaction format.
54+
Note the PAS token, which is the native token of the Polkadot Hub TestNet.
55+
56+
![](/images/develop/smart-contracts/wallets/subwallet-PAS.webp){: .browser-extension}
57+
58+
To connect to Polkadot Hub TestNet using SubWallet, follow these steps:
59+
60+
1. Install the [SubWallet browser extension](https://chromewebstore.google.com/detail/subwallet-polkadot-wallet/onhogfjeacnfoofkfgppdlbmlmnplgbn?hl=en){target=\_blank} and set up your wallet by following the on-screen instructions, or refer to our [step-by-step guide](https://docs.subwallet.app/main/extension-user-guide/getting-started/install-subwallet){target=\_blank} for assistance.
61+
62+
2. After setting up your wallet, click the List icon at the top left corner of the extension window to open **Settings**.
63+
64+
![](/images/develop/smart-contracts/wallets/subwallet-01.webp){: .browser-extension}
65+
66+
3. Scroll down and select **Manage networks**.
67+
68+
![](/images/develop/smart-contracts/wallets/subwallet-02.webp){: .browser-extension}
69+
70+
4. In the Manage network screen, either scroll down or type in the search bar to find the networks. Once done, enable the toggle next to the network name.
71+
72+
![](/images/develop/smart-contracts/wallets/subwallet-03.webp){: .browser-extension}
73+
74+
You are now ready to use SubWallet to interact with [Polkadot Hub TestNet](/develop/smart-contracts/connect-to-polkadot/#networks-details){target=\_blank} seamlessly!
75+
76+
![](/images/develop/smart-contracts/wallets/subwallet-04.webp){: .browser-extension}
77+
4378
### Talisman
4479

4580
[Talisman](https://talisman.xyz/){target=\_blank} is a specialized wallet for the Polkadot ecosystem that supports both Substrate and EVM accounts, making it an excellent choice for Polkadot Hub interactions. Talisman offers a more integrated experience for Polkadot-based chains while still providing Ethereum compatibility.
4681

47-
To use Talisman with Polkadot Hub:
82+
To use Talisman with Polkadot Hub TestNet:
4883

49-
1. Install the [Talisman extension](https://talisman.xyz/download){target=\_blank} and set up your wallet by following the on-screen instructions
84+
1. Install the [Talisman extension](https://talisman.xyz/download){target=\_blank} and set up your wallet by following the on-screen instructions.
5085

51-
2. Once installed, click on the Talisman icon in your browser extensions and click on the **Settings* button:
86+
2. Once installed, click on the Talisman icon in your browser extensions and click on the **Settings** button:
5287

5388
![](/images/develop/smart-contracts/wallets/wallets-5.webp){: .browser-extension}
5489

55-
3. Click the button **All settings**:
90+
3. Click the button **All settings**.
5691

5792
![](/images/develop/smart-contracts/wallets/wallets-6.webp){: .browser-extension}
5893

59-
4. Go to the **Networks & Tokens** section:
94+
4. Go to the **Networks & Tokens** section.
6095

6196
![](/images/develop/smart-contracts/wallets/wallets-7.webp)
6297

63-
5. Click the **Manage networks** button:
98+
5. Click the **Manage networks** button.
6499

65100
![](/images/develop/smart-contracts/wallets/wallets-8.webp)
66101

67-
6. Click the **+ Add network** button:
102+
6. Click the **+ Add network** button.
68103

69104
![](/images/develop/smart-contracts/wallets/wallets-9.webp)
70105

71-
7. Fill in the form with the required parameters and click the **Add network** button:
106+
7. Fill in the form with the required parameters and click the **Add network** button.
72107

73108
![](/images/develop/smart-contracts/wallets/wallets-10.webp)
74109

75-
8. After that, you can switch to the Polkadot Hub TestNet by clicking on the network icon and selecting **Polkadot Hub TestNet**:
110+
8. After that, you can switch to the Polkadot Hub TestNet by clicking on the network icon and selecting **Polkadot Hub TestNet**.
76111

77112
![](/images/develop/smart-contracts/wallets/wallets-11.webp)
78113

develop/toolkit/parachains/.pages

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ nav:
66
- fork-chains
77
- e2e-testing
88
- 'Light Clients': light-clients.md
9+
- 'RPC Calls': rpc-calls.md
910
- 'Polkadot Omni Node': polkadot-omni-node.md
Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
---
2+
title: RPC Calls to Polkadot SDK chains.
3+
description: Learn how to interact with Polkadot SDK-based chains using RPC calls. This guide covers essential methods and usage via curl.
4+
---
5+
6+
# RPC Calls
7+
8+
## Introduction
9+
10+
[Remote Procedure Call](https://en.wikipedia.org/wiki/Remote_procedure_call){target=\_blank} (RPC) interfaces are the primary way to interact programmatically with Polkadot SDK-based parachains and relay chains. RPC calls allow you to query chain state, submit transactions, and monitor network health from external applications or scripts.
11+
12+
This guide covers:
13+
14+
- What RPC calls are and how they work in the Polkadot SDK.
15+
- How to make RPC calls using `curl` or similar tools.
16+
- The most useful and commonly used RPC methods.
17+
18+
RPC endpoints are available on every node and can be accessed via HTTP and WebSocket. Most developer tools, dashboards, and libraries (like [Polkadot.js](/develop/toolkit/api-libraries/polkadot-js-api){target=\_blank}, [Subxt](/develop/toolkit/api-libraries/subxt){target=\_blank}, and others) utilize these endpoints internally.
19+
20+
## How Do RPC Calls Work?
21+
22+
RPC (Remote Procedure Call) is a protocol that allows you to invoke functions on a remote server (in this case, a blockchain node) as if they were local. Polkadot SDK nodes implement the [JSON-RPC 2.0](https://www.jsonrpc.org/specification){target=\_blank} standard, making it easy to interact with them using standard HTTP requests.
23+
24+
```mermaid
25+
flowchart LR
26+
CLIENT([Client Application])-- JSON-RPC Request -->NODE([Node])
27+
NODE -- JSON Response --> CLIENT
28+
```
29+
30+
RPC calls are stateless and can be used to:
31+
32+
- Query chain state (e.g., block number, storage values)
33+
- Submit extrinsics (transactions)
34+
- Monitor node and network health
35+
- Retrieve metadata and runtime information
36+
37+
## Making RPC Calls with Curl
38+
39+
You can make RPC calls to a node using [`curl`](https://curl.se/){target=\_blank} or any HTTP client. The general format that the RPC calls stick to is the following:
40+
41+
```bash
42+
curl -H "Content-Type: application/json" \
43+
-d '{"id":1, "jsonrpc":"2.0", "method": "INSERT_METHOD_NAME", "params": [INSERT_PARAMS]}' \
44+
NODE_ENDPOINT
45+
```
46+
47+
- **`method`**: The RPC method you want to call (e.g., `system_health`).
48+
- **`params`**: Parameters for the method (if any).
49+
- **`NODE_ENDPOINT`**: The HTTP endpoint of your node (e.g., `http://localhost:9933` or a public endpoint).
50+
51+
Here's a simple example to get the latest block number of the Polkadot relay chain; you can use the following node endpoint:
52+
53+
```bash
54+
curl -H "Content-Type: application/json" \
55+
-d '{"id":1, "jsonrpc":"2.0", "method": "chain_getBlock"}' \
56+
https://rpc.polkadot.io
57+
```
58+
59+
## Essential RPC Methods
60+
61+
Below are some of the most useful and commonly used RPC methods for Polkadot SDK-based chains. Each method includes a description, parameters, and an example request.
62+
63+
---
64+
65+
### system_health
66+
67+
Checks the health of your node.
68+
69+
**Parameters:**
70+
71+
None
72+
73+
**Example:**
74+
75+
```bash title="system_health"
76+
curl -H "Content-Type: application/json" \
77+
-d '{"id":1, "jsonrpc":"2.0", "method": "system_health", "params":[]}' \
78+
http://localhost:9933
79+
```
80+
81+
---
82+
83+
### chain_getBlock
84+
85+
Returns the latest block or a specific block by hash.
86+
87+
**Parameters:**
88+
89+
- `blockHash` *(optional, string)* – The hash of the block to retrieve. If omitted, returns the latest block.
90+
91+
**Example:**
92+
93+
```bash title="chain_getBlock"
94+
curl -H "Content-Type: application/json" \
95+
-d '{"id":1, "jsonrpc":"2.0", "method": "chain_getBlock", "params":[]}' \
96+
http://localhost:9933
97+
```
98+
99+
---
100+
101+
### state_getStorage
102+
103+
Queries on-chain storage by key (requires [SCALE-encoded](/polkadot-protocol/parachain-basics/data-encoding){target=_blank} storage key).
104+
105+
**Parameters:**
106+
107+
- `storageKey` *(string)* – The SCALE-encoded storage key to query.
108+
109+
**Example:**
110+
111+
```bash title="state_getStorage"
112+
curl -H "Content-Type: application/json" \
113+
-d '{"id":1, "jsonrpc":"2.0", "method": "state_getStorage", "params":["0x..."]}' \
114+
http://localhost:9933
115+
```
116+
117+
---
118+
119+
### author_submitExtrinsic
120+
121+
Submits a signed extrinsic (transaction) to the node.
122+
123+
**Parameters:**
124+
125+
- `extrinsic` *(string)* – The SCALE-encoded, signed extrinsic (transaction).
126+
127+
**Example:**
128+
129+
```bash title="author_submitExtrinsic"
130+
curl -H "Content-Type: application/json" \
131+
-d '{"id":1, "jsonrpc":"2.0", "method": "author_submitExtrinsic", "params":["0x..."]}' \
132+
http://localhost:9933
133+
```
134+
135+
---
136+
137+
### state_getMetadata
138+
139+
Fetches the runtime metadata (needed for decoding storage and extrinsics).
140+
141+
**Parameters:**
142+
143+
None
144+
145+
**Example:**
146+
147+
```bash title="state_getMetadata"
148+
curl -H "Content-Type: application/json" \
149+
-d '{"id":1, "jsonrpc":"2.0", "method": "state_getMetadata", "params":[]}' \
150+
http://localhost:9933
151+
```
152+
153+
---
154+
155+
## Check Available RPC Calls
156+
157+
To check all the RPC methods exposed by your node, you can use the `rpc_methods` call to get a comprehensive list of available methods. This is particularly useful when working with different chain implementations or custom runtimes that may have additional RPC endpoints. You can do this via [`curl`](#using-curl) or the [Polkadot.Js Apps](#using-polkadotjs-apps).
158+
159+
### Using curl
160+
161+
To check the available RPC methods using `curl`, you can use the following command:
162+
163+
```bash
164+
curl -H "Content-Type: application/json" \
165+
-d '{"id":1, "jsonrpc":"2.0", "method": "rpc_methods", "params":[]}' \
166+
https://rpc.polkadot.io
167+
```
168+
169+
You can replace `https://rpc.polkadot.io` with the node endpoint you need to query.
170+
171+
### Using Polkadot.js Apps
172+
173+
1. Go to the [Polkadot.js Apps UI](https://polkadot.js.org/apps){target=\_blank} and navigate to the RPC calls section.
174+
175+
![](/images/develop/toolkit/parachains/rpc-calls/rpc-calls-01.webp)
176+
177+
2. Select **`rpc`** from the dropdown menu.
178+
179+
![](/images/develop/toolkit/parachains/rpc-calls/rpc-calls-02.webp)
180+
181+
3. Choose the **`methods`** method.
182+
183+
![](/images/develop/toolkit/parachains/rpc-calls/rpc-calls-03.webp)
184+
185+
4. Submit the call to get a list of all available RPC methods.
186+
187+
![](/images/develop/toolkit/parachains/rpc-calls/rpc-calls-04.webp)
188+
189+
This will return a JSON response containing all the RPC methods supported by your node.
190+
191+
![](/images/develop/toolkit/parachains/rpc-calls/rpc-calls-05.webp)
192+
193+
From this interface, you can also query the RPC methods directly, as you would do with curl.
194+
195+
## Resources
196+
197+
- [Polkadot JSON-RPC API Reference](https://polkadot.js.org/docs/substrate/rpc/){target=\_blank}
198+
- [Parity DevOps: Important Flags for Running an RPC Node](https://paritytech.github.io/devops-guide/guides/rpc_index.html?#important-flags-for-running-an-rpc-node){target=\_blank}
199+
- [Polkadot.js Apps RPC Explorer](https://polkadot.js.org/apps/#/rpc){target=\_blank}

images/.DS_Store

6 KB
Binary file not shown.

images/develop/.DS_Store

6 KB
Binary file not shown.
6 KB
Binary file not shown.
23.5 KB
Loading

0 commit comments

Comments
 (0)