🚀 DAY 2 OF LAUNCH WEEK: Unify Your Security Stack with Socket Basics.Learn more →
Socket
Book a DemoInstallSign in
Socket

substrate-lite

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

substrate-lite

Light client that connects to Polkadot and Substrate-based blockchains

latest
Source
npmnpm
Version
0.2.2
Version published
Maintainers
1
Created
Source

Light client for Polkadot and Substrate-based chains

This JavaScript library provides a light client for the Polkadot blockchain and for chains built using the Substrate blockchain framework.

It is an "actual" light client, in the sense that it is byzantine-resilient. It does not rely on the presence of an RPC server, but directly connects to the full nodes of the network.

Usage

import * as substrate_lite from 'substrate-lite';

// Load a string chain specifications.
const chain_spec = Buffer.from(fs.readFileSync('./westend.json')).toString('utf8');

substrate_lite
  .start({
    chain_spec: chain_spec,
    json_rpc_callback: (resp) => {
        // Called whenever the client emits a response to a JSON-RPC request,
        // or a JSON-RPC pub-sub notification.
        console.log(resp)
    }
  })
  .then((client) => {
    client.send_json_rpc('{"jsonrpc":"2.0","id":1,"method":"system_name","params":[]}');
  })

The start function returns a Promise.

FAQs

Package last updated on 06 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts