0.2.2 • Published 3 years ago

substrate-lite v0.2.2

Weekly downloads
1
License
GPL-3.0-or-later ...
Repository
github
Last release
3 years ago

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.

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago