Giter VIP home page Giter VIP logo

coin-hive-stratum's Introduction

CoinHive Stratum Proxy

This proxy allows you to use CoinHive's JavaScript miner on a custom stratum pool. This package was inspired by x25's coinhive-stratum-mining-proxy.

Installation

npm install -g coin-hive-stratum

Usage

You just need to launch a proxy pointing to the desired pool:

coin-hive-stratum 8892 --host=xmr-eu1.nanopool.org --port=14444

And then just point your CoinHive miner to the proxy:

<script src="https://coinhive.com/lib/coinhive.min.js"></script>
<script>
  // Configure CoinHive to point to your proxy
  CoinHive.CONFIG.WEBSOCKET_SHARDS = [["ws://localhost:8892"]];

  // Start miner
  var miner = CoinHive.Anonymous('your-monero-address');
  miner.start();

</script>

Now your CoinHive miner would be mining on nanopool.org XMR pool, using your monero address. This will work for any pool based on the Stratum Mining Protocol. You can even set up your own.

CLI

Usage: 'coin-hive-stratum <port>'

<port>: The port where the server will listen to

Options:

  --host    The pool's host.
  --port    The pool's port.
  --log     Enable/Disable the logs, default is true

API

  • createProxy: Creates a proxy server. It may take an options object with the following optional properties:

    • host: the pool's host.

    • port: the pool's port.

    • log: enable/disable the logs, default is true.

  • proxy.listen(port): launches the server listening on the specified port, which by default is 8892.

FAQ

Can I use this programmatically?

Yes, like this:

const createProxy = require('coin-hive-stratum');
const proxy = createProxy({
  host: 'xmr-eu1.nanopool.org',
  port: 14444,
});
proxy.listen(8892);

Can I use several workers?

Yes, just create a CoinHive.User and the username will be used as the stratum worker name:

<script src="https://coinhive.com/lib/coinhive.min.js"></script>
<script>
  // Configure CoinHive to point to your proxy
  CoinHive.CONFIG.WEBSOCKET_SHARDS = [["ws://localhost:8892"]];

  // Start miner
  var miner = CoinHive.User('your-monero-address', 'my-worker');
  miner.start();

</script>

Disclaimer

This project is not endorsed by or affiliated with coinhive.com in any way.

coin-hive-stratum's People

Contributors

slayerulan avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.