npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

burst-stratum

v1.2.1

Published

Slightly modified stratum protocol for burst mining.

Downloads

12

Readme

Burst-Stratum

Software License npm npm weekly downloads

Usage

Server

const { BurstStratumServer } = require('burst-stratum');

(async () => {
  const server = new BurstStratumServer('127.0.0.1', 12345);

  // Register the submission handler
  server.onSubmitNonce(async ({ coin, submission, options }) => {
    // Submit/Validate the submission

    // Return the result of the submission
    return {
      result: 'success',
      deadline: 12345,
    };
  });

  // Configure the initial mining info
  server.updateMiningInfo('BHD', {
    generationSignature: '1471e5075e2207e70a9ac46ea46f740dc0c981a4ec336c534e647917904febc6',
    baseTarget: 25256,
    height: 330800,
    targetDeadline: 31536000,
  });
  server.updateMiningInfo('BURST', {
    generationSignature: '2a61cd695b14fe850bd2cbf95bb45c94a9316831d8c952fc439ff299eaa12772',
    baseTarget: 34985,
    height: 758335,
    targetDeadline: 31536000,
  });

  // Start listening for connections
  await server.start();

  // Update the miningInfo and notify all subscribed clients for this coin
  server.updateMiningInfo('BHD', {
    generationSignature: '6b914699608eede35bbecac30414e6e2ee282601b4410c6f6301988647753faa',
    baseTarget: 23455,
    height: 330900,
    targetDeadline: 31536000,
  });
})();

Client

const { BurstStratumClient } = require('burst-stratum');

(async () => {
  const client = new BurstStratumClient('stratum+tcp://localhost:12345');

  // Register the new miningInfo handler
  client.onMiningInfo(({ coin, miningInfo }) => {
    // Do something with the new miningInfo
  });

  // Establish a connection to the burst-stratum server
  await client.connect();

  // Subscribe to the coins you want to receive miningInfo for
  await client.subscribe(['BHD', 'BURST']);

  // Submit to the burst-stratum server
  const result = await client.submitNonce({
    coin: 'BHD',
    submission: {
      height: 330900,
      accountId: '12312134123123',
      nonce: '32462454345354',
      deadline: 23213232,
    },
    options: {
      minerName: 'Miner 1',
      accountName: 'My Name',
      payoutAddress: '33fKEwAHxVwnrhisREFdSNmZkguo76a2ML',
      userAgent: 'Foxy-Miner 1.13.0',
      capacity: 1337, // Capacity in GiB
      distributionRatio: '0-100',
    },
  });
})();

Protocol

Subscribe to miningInfo notifications (Client -> Server)

{
    "jsonrpc": "2.0",
    "id": 123,
    "method": "mining.subscribe",
    "params": [
        "BHD",
        "BURST"
    ]
}

{
    "jsonrpc": "2.0",
    "id": 123,
    "result": true
}

Submit a nonce (Client -> Server)

{
    "jsonrpc": "2.0",
    "id": 123,
    "method": "mining.submit",
    "params": {
        "coin": "BHD",
        "submission": {
            "height": 330900,
            "accountId": "12312134123123",
            "nonce": "32462454345354",
            "deadline": 23213232
        },
        "options": {
            "minerName": "Miner 1",
            "accountName": "My Name",
            "payoutAddress": "33fKEwAHxVwnrhisREFdSNmZkguo76a2ML",
            "userAgent": "Foxy-Miner 1.13.0",
            "capacity": 1337,
            "distributionRatio": "0-100"
        }
    }
}

{
    "jsonrpc": "2.0",
    "id": 123,
    "result": {
        "success": true,
        "deadline": 1337
    }
}

New miningInfo notifications (Server -> Client)

{
    "jsonrpc": "2.0",
    "id": null,
    "method": "mining.notify",
    "params": {
        "coin": "BHD",
        "miningInfo": {
            "generationSignature": "6b914699608eede35bbecac30414e6e2ee282601b4410c6f6301988647753faa",
            "baseTarget": 23455,
            "height": 330900,
            "targetDeadline": 31536000
        }
    }
}

Keepalive (Ping/Pong)

Both client and server must respond to a ping message with a pong message

{
    "jsonrpc": "2.0",
    "id": null,
    "method": "ping"
}

{
    "jsonrpc": "2.0",
    "id": null,
    "method": "pong"
}

License

GNU GPLv3 (see LICENSE)