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
description: Explore step-by-step tutorials for exploring the world of building decentralized applications using the toolkits that Polkadot provides.
19655
-
template: index-page.html
19653
+
title: Decentralized Application Tutorials
19654
+
description: Explore step-by-step tutorials for exploring the world of building decentralized applications using the toolkits that Polkadot provides.
19655
+
template: index-page.html
19656
19656
---
19657
+
19658
+
# Build Decentralized Applications on Polkadot
19659
+
19660
+
This section provides hands-on tutorials for building decentralized applications (dApps) using the Polkadot SDK and its developer toolkits. These guides help you leverage Polkadot's infrastructure to build scalable, secure, and interoperable dApps without relying solely on smart contracts.
19661
+
19662
+
You'll explore a range of topics—from client-side apps and CLI tools to on-chain interaction patterns—all backed by lightweight or full-node tooling.
19663
+
19664
+
## Featured Tutorials
19665
+
19666
+
Learn how to integrate Polkadot APIs, use local or light clients, and interact with on-chain logic:
19667
+
19668
+
- **[Polkadot API Account Watcher](/tutorials/dapps/papi-account-watcher/){target=\_blank}** – build a CLI that listens for on-chain `remarkWithEvent` extrinsics using the Polkadot API and light clients
19669
+
19670
+
## In This Section
19671
+
19672
+
:::INSERT_IN_THIS_SECTION:::
19673
+
19674
+
## Additional Resources
19675
+
19676
+
<div class="subsection-wrapper">
19677
+
<div class="card">
19678
+
<a href="/develop/toolkit/api-libraries/papi/">
19679
+
<h2 class="title">Polkadot API (PAPI)</h2>
19680
+
<hr>
19681
+
<p class="description">Learn how to use the Polkadot API to build dApps that interact with Substrate-based chains directly via RPC or light clients.</p>
19682
+
</a>
19683
+
</div>
19684
+
<div class="card">
19685
+
<a href="/develop/">
19686
+
<h2 class="title">Start Building on Polkadot</h2>
19687
+
<hr>
19688
+
<p class="description">Get an overview of the tools, SDKs, and templates available for building with Polkadot—from runtime development to frontend integration.</p>
description: Explore step-by-step tutorials for building applications using the Polkadot API.
19664
-
template: index-page.html
19697
+
title: Polkadot API (PAPI) Tutorials
19698
+
description: Follow hands-on tutorials to build decentralized apps using the Polkadot API, including light clients, event listeners, and extrinsics.
19699
+
template: index-page.html
19665
19700
---
19701
+
19702
+
# Build with the Polkadot API (PAPI)
19703
+
19704
+
This section features practical tutorials for building applications using the [Polkadot API](/develop/toolkit/api-libraries/papi){target=\_blank}. Learn how to connect to Polkadot SDK-based chains, listen to on-chain events, submit extrinsics, and build apps powered by light or full clients.
description: Learn how to build a decentralized command-line application using the Polkadot API.
19714
+
title: Account Watcher
19715
+
description: Build a CLI app that monitors on-chain events using the Polkadot API and reacts to custom system.remarkWithEvent messages.
19673
19716
---
19674
19717
19718
+
# PAPI Account Watcher
19719
+
19675
19720
## Introduction
19676
19721
19677
-
This tutorial demonstrates how to build a simple command-line interface (CLI) application that monitors a user's account on the relay chain for the [`system.remarkWithEvent`](https://paritytech.github.io/polkadot-sdk/master/frame_system/pallet/struct.Pallet.html#method.remark_with_event){target=\_blank} extrinsic.
19722
+
This tutorial demonstrates how to build a simple command-line interface (CLI) application that monitors a user's account on the relay chain for the [`system.remarkWithEvent`](https://paritytech.github.io/polkadot-sdk/master/frame_system/pallet/struct.Pallet.html#method.remark_with_event){target=\_blank} extrinsic, using the [Polkadot API](/develop/toolkit/api-libraries/papi){target=\_blank}.
19678
19723
19679
19724
The `system.remarkWithEvent` extrinsic enables the submission of arbitrary data on-chain. In this tutorial, the data consists of a hash derived from the combination of an account address and the word "email" (`address+email`). This hash is monitored on-chain, and the application listens for remarks addressed to the specified account. The `system.remarkWithEvent` extrinsic emits an event that can be observed using the Polkadot API (PAPI).
19680
19725
@@ -19694,7 +19739,7 @@ Additionally, you need an account with Westend tokens. Refer to the following re
19694
19739
19695
19740
## Clone the Repository
19696
19741
19697
-
To follow this tutorial, you can either run the example directly or use a boilerplate/template. This tutorial uses a template that includes all necessary dependencies for working with the Polkadot API and TypeScript. Clone the appropriate branch (`empty-cli`) of the repository as follows:
19742
+
To follow this tutorial, you can either run the example directly or use a boilerplate/template. This tutorial uses a template that includes all necessary dependencies for working with the Polkadot API and TypeScript. Clone the appropriate branch ([`empty-cli`](https://github.com/CrackTheCode016/polkadot-api-example-cli/tree/empty-cli){target=\_blank}) of the repository as follows:
The `withLightClient` function is particularly important. It uses the built-in light client functionality, powered by [`smoldot`](https://github.com/smol-dot/smoldot){target=\_blank}, to create a light client that synchronizes and interacts with Polkadot directly within the application.
@@ -19722,7 +19781,16 @@ The `withLightClient` function is particularly important. It uses the built-in l
19722
19781
The CLI functionality is implemented within the `main` function. The CLI includes an option (`-a` / `--account`) to specify the account to monitor for remarks:
19723
19782
19724
19783
```typescript title="index.ts"
19725
-
code/develop/dapps/papi/remark-tutorial/cli.ts
19784
+
const program = new Command();
19785
+
console.log(chalk.white.dim(figlet.textSync("Web3 Mail Watcher")));
19786
+
program
19787
+
.version('0.0.1')
19788
+
.description('Web3 Mail Watcher - A simple CLI tool to watch for remarks on the Polkadot network')
19789
+
.option('-a, --account <account>', 'Account to watch')
To test the application, navigate to the [PAPI Dev Console > Extrinsics](https://dev.papi.how/extrinsics#networkId=westend&endpoint=light-client){target=\_blank}. Select the `System` pallet and the `remark_with_event` call.
19858
+
To test the application, navigate to the [PAPI Dev Console > Extrinsics](https://dev.papi.how/extrinsics#networkId=westend&endpoint=light-client){target=\_blank}. Select the `System` pallet and the `remark_with_event` call. Ensure the input field follows the convention `address+email`. For example, if monitoring `5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY`, the input should be:
19787
19859
19788
-
Ensure the input field follows the convention `address+email`. For example, if monitoring `5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY`, the input should be:
Submit the extrinsic and sign it using the Polkadot.js browser wallet. The CLI will display the following output and play the "You've Got Mail!" sound:
description: Explore step-by-step tutorials for exploring the world of building decentralized applications using the toolkits that Polkadot provides.
4
-
template: index-page.html
5
-
---
2
+
title: Decentralized Application Tutorials
3
+
description: Explore step-by-step tutorials for exploring the world of building decentralized applications using the toolkits that Polkadot provides.
4
+
template: index-page.html
5
+
---
6
+
7
+
# Build Decentralized Applications on Polkadot
8
+
9
+
This section provides hands-on tutorials for building decentralized applications (dApps) using the Polkadot SDK and its developer toolkits. These guides help you leverage Polkadot's infrastructure to build scalable, secure, and interoperable dApps without relying solely on smart contracts.
10
+
11
+
You'll explore a range of topics—from client-side apps and CLI tools to on-chain interaction patterns—all backed by lightweight or full-node tooling.
12
+
13
+
## Featured Tutorials
14
+
15
+
Learn how to integrate Polkadot APIs, use local or light clients, and interact with on-chain logic:
16
+
17
+
-**[Polkadot API Account Watcher](/tutorials/dapps/papi-account-watcher/){target=\_blank}** – build a CLI that listens for on-chain `remarkWithEvent` extrinsics using the Polkadot API and light clients
18
+
19
+
## In This Section
20
+
21
+
:::INSERT_IN_THIS_SECTION:::
22
+
23
+
## Additional Resources
24
+
25
+
<divclass="subsection-wrapper">
26
+
<divclass="card">
27
+
<a href="/develop/toolkit/api-libraries/papi/">
28
+
<h2 class="title">Polkadot API (PAPI)</h2>
29
+
<hr>
30
+
<p class="description">Learn how to use the Polkadot API to build dApps that interact with Substrate-based chains directly via RPC or light clients.</p>
31
+
</a>
32
+
</div>
33
+
<divclass="card">
34
+
<a href="/develop/">
35
+
<h2 class="title">Start Building on Polkadot</h2>
36
+
<hr>
37
+
<p class="description">Get an overview of the tools, SDKs, and templates available for building with Polkadot—from runtime development to frontend integration.</p>
description: Explore step-by-step tutorials for building applications using the Polkadot API.
4
-
template: index-page.html
5
-
---
2
+
title: Polkadot API (PAPI) Tutorials
3
+
description: Follow hands-on tutorials to build decentralized apps using the Polkadot API, including light clients, event listeners, and extrinsics.
4
+
template: index-page.html
5
+
---
6
+
7
+
# Build with the Polkadot API (PAPI)
8
+
9
+
This section features practical tutorials for building applications using the [Polkadot API](/develop/toolkit/api-libraries/papi){target=\_blank}. Learn how to connect to Polkadot SDK-based chains, listen to on-chain events, submit extrinsics, and build apps powered by light or full clients.
0 commit comments