Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Polkadot Wiki Migration] Using Light Clients #8

Merged
merged 11 commits into from
Sep 30, 2024
1 change: 1 addition & 0 deletions develop/application-devs/interact/.pages
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
title: Interact with the Network
nav:
- index.md
- 'Using Light Clients': 'light-clients.md'
50 changes: 50 additions & 0 deletions develop/application-devs/interact/light-clients.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
title: Using Light Clients
description: Information about light client options available in the Polkadot ecosystem and how they simplify interactions with the network.
---
# Using Light Clients

## Introduction

Conventionally, applications use a JSON-RPC protocol for communication between a user interface (UI) and a Polkadot SDK-built node with one of the following approaches:

- **User controlled nodes** - the UI connects to a node client the user has installed on their machine. These nodes are secure, but installation and maintenance of these nodes tend to be an inconvenience

- **Publicly accessible nodes** - the UI connects to a third-party-owned publicly accessible node client. While these nodes are more prevalent in their usage as they are convenient to use, they are centralized and insecure

With the advent of light clients, applications no longer have to rely on RPC nodes. Light clients don't sync entire blocks. Instead, they merely verify the finalized network headers. This option provides a cryptographically robust and less resource-intensive way to interact with and ensure the state of the network. Light clients are also available locally and embedded as part of the application, enabling a trustless solution versus running an RPC node.

<!-- TODO: add link to chain specification when glossary is merged -->
You can use a light client implementation to connect to a Polkadot SDK-based network, both in and outside the browser, as long as a [chain specification]() for that network is available.

## Light Client Options

dawnkelly09 marked this conversation as resolved.
Show resolved Hide resolved
Popular options for Polkadot ecosystem light clients include:

- The [Polkadot API (PAPI)](https://papi.how/){target=\_blank} integrates [`smoldot`](https://github.com/smol-dot/smoldot){target=\_blank} as a choice of light client for both browser and server-based implementations

- [Substrate Connect](https://github.com/paritytech/substrate-connect){target=\_blank} is a browser extension and JavaScript library that enables developers to build application-specific light clients for Polkadot SDK chains

## Light Client Benefits

A light client allows for all essential features of the chain, such as fetching data and transferring tokens, but it doesn't store a copy of the entire blockchain or require the trust of remote peers. Light clients fetch the needed data from a node with an associated proof to validate the data.

=== "Full RPC Node"

- Complete verification of all blocks of the chain
- Holds all the previous block data and the chain's storage in database
- Installation, maintenance, and execution tend to be exhaustive and require system administration expertise


=== "Light Client"

- Only verifies the authenticity of blocks of the chain
- No database
- No need to provision servers or other DevOps-related maintenance, singificantly reducing initialization time from startup


## Resources

Learn more about light clients and how they help you develop on Polkadot:

- [What is a light client and why you should care?](https://medium.com/paritytech/what-is-a-light-client-and-why-you-should-care-75f813ae2670){target=\_blank}