# tendermint

> A light client which talks to your Tendermint node over RPC

Latest version **5.0.2** (published 2020-03-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install tendermint
pnpm add tendermint
yarn add tendermint
bun add tendermint
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.0.2 |
| Published | 2020-03-24 |
| First published | 2017-01-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 11 |
| Unpacked size | 47 KB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 72 |
| Author | Matt Bell |
| Maintainers | mappum |
| Keywords | tendermint, blockchain, consensus, cosmos, client |

## Links

- npm: https://www.npmjs.com/package/tendermint
- Repository: https://github.com/mappum/js-tendermint
- Homepage: https://github.com/mappum/js-tendermint#readme
- Issues: https://github.com/mappum/js-tendermint/issues
- npm.io page: https://npm.io/package/tendermint

## Dependencies (11)

- [old](https://npm.io/package/old.md) ^0.1.3
- [axios](https://npm.io/package/axios.md) ^0.19.0
- [debug](https://npm.io/package/debug.md) ^3.1.0
- [ndjson](https://npm.io/package/ndjson.md) ^1.5.0
- [pumpify](https://npm.io/package/pumpify.md) ^1.3.5
- [camelcase](https://npm.io/package/camelcase.md) ^4.0.0
- [varstruct](https://npm.io/package/varstruct.md) ^6.1.1
- [create-hash](https://npm.io/package/create-hash.md) ^1.1.3
- [supercop.js](https://npm.io/package/supercop.js.md) ^2.0.1
- [websocket-stream](https://npm.io/package/websocket-stream.md) ^5.1.1
- [json-stable-stringify](https://npm.io/package/json-stable-stringify.md) ^1.0.1

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 5.0.2 (latest) — 2020-03-24
- 5.0.1 — 2020-03-24
- 5.0.0 — 2020-03-24
- 4.0.8 — 2019-06-24
- 4.0.7 — 2019-06-24
- 4.0.6 — 2019-05-10
- 4.0.5 — 2019-05-09
- 4.0.4 — 2019-05-07
- 4.0.3 — 2019-05-07
- 4.0.2 — 2019-02-26
- 4.0.1 — 2019-02-20
- 4.0.0 — 2019-02-20
- 3.4.2 — 2019-02-08
- 3.4.1 — 2019-02-06
- 3.4.0 — 2018-12-12
- … 30 more at https://npm.io/package/tendermint/versions

## README

# tendermint

A light client for Tendermint blockchains which works in Node.js and browsers.

Supports Tendermint v0.33.

### Usage
```
npm install tendermint
```

**Light Node**

Requests data over RPC and verifies blockchain headers

```js
let Tendermint = require('tendermint')

// some full node's RPC port
let peer = 'ws://localhost:46657'

// `state` contains a part of the chain we know to be valid. If it's
// too old, we cannot safely verify the chain and need to get a newer
// state out-of-band.
let state = {
  // a header, in the same format as returned by RPC
  // (see http://localhost:46657/commit, under `"header":`)
  header: { ... },

  // the valdiator set for this header, in the same format as returned by RPC
  // (see http://localhost:46657/validators)
  validators: [ ... ],

  // the commit (validator signatures) for this header, in the same format as
  // returned by RPC (see http://localhost:46657/commit, under `"commit":`)
  commit: { ... }
}

// options
let opts = {
  // the maximum age of a state to be safely accepted,
  // e.g. the unbonding period
  // (in seconds)
  maxAge: 1728000 // defaults to 30 days
}

// instantiate client. will automatically start syncing to the latest state of
// the blockchain
let node = Tendermint(peer, state, opts)

// make sure to handle errors
node.on('error', (err) => { ... })
// emitted once we have caught up to the current chain tip
node.on('synced', () => { ... })
// emitted every time we have verified a new part of the blockchain
node.on('update', () => { ... })

// returns the height of the most recent header we have verified
node.height()

// returns the state object ({ header, validators, commit }) of the most recently
// verified header, should be stored and used to instantiate the light client
// the next time the user runs the app
node.state()
```

**RPC Client**

Simple client to make RPC requests to nodes

```js
let { RpcClient } = require('tendermint')

let client = RpcClient('ws://localhost:46657')

// request a block
client.block({ height: 100 })
  .then((res) => console.log(res))
```

The following RPC methods are available:

```
- subscribe
- unsubscribe
- status
- netInfo
- dialSeeds
- blockchain
- genesis
- block
- validators
- dumpConsensusState
- broadcastTxCommit
- broadcastTxAsync
- broadcastTxSync
- unconfirmedTxs
- numUnconfirmedTxs
- abciQuery
- abciInfo
- abciProof
- unsafeFlushMempool
- unsafeSetConfig
- unsafeStartCpuProfiler
- unsafeStopCpuProfiler
- unsafeWriteHeapProfile
```

---
_Source: https://npm.io/package/tendermint · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
