Socket
Socket
Sign inDemoInstall

node-stratum-client

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    node-stratum-client

Stratum protocol client for Node.js


Version published
Maintainers
1
Install size
21.1 kB
Created

Readme

Source

node-stratum-client

Stratum protocol client for Node.js

Install

$ npm install node-stratum-client --save

How to use

import StratumClient from "node-stratum-client"
const client = new StratumClient()
const POOL_PORT = 4233
const POOL_HOST = "example.com"
const WORKER_NAME = "ABCDabcd12345678"

client.onNotify(res => {
  console.log("notify", res)
})
client.onSetDifficulty(res => {
  console.log("set difficulty", res)
})
client.onSocketError(error => {
  console.error("socket error", error)
})
client.onSocketClose(() => {
  console.log("socket closed")
})
client.connect(POOL_PORT, POOL_HOST)
  .then(() => {
    console.log("connection successful")
    return client.authorize(WORKER_NAME)
  })
  .then(res => {
    console.log("authorize successful", res)
    return client.subscribe()
  })
  .then(res => {
    console.log("subscription successful", res)
    return client.getTransactions("0")
  })
  .then(res => {
    console.log("getTransactions successful", res)
  })
  .catch(error => {
    console.error("error", error)
  })

Development

Watch and build

$ npm start

Run tests

$ npm run test

FAQs

Last updated on 10 Feb 2018

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc