4

In this part of Substrate Recipe it says that I have to create a new_light function to build a light client. But there are no details at all. So I took a look at node template and found that there is no new_light function there as well (only new_full).

After that I found this function in Kulupu's repo. But as I can see, this code is outdated. For example it uses sc_service::new_light_parts() function but there is no such function in up-to-date sc-service crate.

So I have 2 questions:

  • Is it necessary to build a light client? Can a blockchain run normally without it?
  • Are there any other guides to create a light client?

1 Answer 1

6

Light clients are not explicitly needed for a chain to operate. They can be very useful to compliment a network of full nodes that are preferable in many cases over a full node, especially for end user facing dApps.

The light client in Substrate itself has been deprecated that you are seeing in those examples, but this is not forgotten! Now there is a stand-alone project that is being worked on primarily by Parity in the smoldot light client.

For reference to learn more, taken from the READMEs at the time of writing:

Smoldot

smoldot is a prototype of an alternative client of Substrate-based chains, including Polkadot.

In order to simplify the code, two main design decisions have been made compared to Substrate:

  • No native runtime. The execution time of the wasmtime library is satisfying enough that having a native runtime isn't critical anymore.

  • No pluggable architecture. smoldot supports a certain hard coded list of consensus algorithms, at the moment Babe, Aura, and GrandPa. Support for other algorithms can only be added by modifying the code of smoldot, and it is not possible to plug a custom algorithm from outside.

There exists two clients: the full client and the wasm light node.

Substrate Connect

Substrate connect provides a way to interact with substrate based blockchains in the browser without using an RPC server. Substrate connect uses a smoldot WASM light client to securely connect to the blockchain network without relying on specific 3rd parties.

Smoldot Ads uApp

A demo dApp of classified ads using smoldot and substrate-connect.

1
  • Is sc-light deprecated/end of life? As it's not in the latest polkadot-vX releases of substrate
    – flipchan
    Commented Jul 19, 2022 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.