Git Product home page Git Product logo

coin-hive's Introduction

CoinHive Build Status

Mine cryptocurrencies Monero (XMR) and Electroneum (ETN) using CoinHive from node.js

New: Now you can run this miner on any stratum based pool.

New 2: Now you can mine Electroneum (ETN).

Need a proxy? check coin-hive-stratum.

Install

npm install -g coin-hive

Usage

const CoinHive = require('coin-hive');

(async () => {
  // Create miner
  const miner = await CoinHive('ZM4gjqQ0jh0jbZ3tZDByOXAjyotDbo00'); // CoinHive's Site Key

  // Start miner
  await miner.start();

  // Listen on events
  miner.on('found', () => console.log('Found!'));
  miner.on('accepted', () => console.log('Accepted!'));
  miner.on('update', data =>
    console.log(`
    Hashes per second: ${data.hashesPerSecond}
    Total hashes: ${data.totalHashes}
    Accepted hashes: ${data.acceptedHashes}
  `)
  );

  // Stop miner
  setTimeout(async () => await miner.stop(), 60000);
})();

CLI

Usage:

coin-hive ZM4gjqQ0jh0jbZ3tZDByOXAjyotDbo00

Options:

  --username        Set a username for the miner
  --interval        Interval between updates (logs)
  --port            Port for the miner server
  --host            Host for the miner server
  --threads         Number of threads for the miner
  --throttle        The fraction of time that threads should be idle
  --proxy           Proxy socket 5/4, for example: socks5://127.0.0.1:9050
  --puppeteer-url   URL where puppeteer will point to, by default is miner server (host:port)
  --miner-url       URL of CoinHive's JavaScript miner, can be set to use a proxy
  --dev-fee         A donation to the developer, the default is 0.001 (0.1%)
  --pool-host       A custom stratum pool host, it must be used in combination with --pool-port
  --pool-port       A custom stratum pool port, it must be used in combination with --pool-host
  --pool-pass       A custom stratum pool password, if not provided the default one is 'x'

API

  • CoinHive(siteKey[, options]): Returns a promise of a Miner instance. It requires a CoinHive Site Key. The options object is optional and may contain the following properties:

    • username: Set a username for the miner. See CoinHive.User.

    • interval: Interval between update events in ms. Default is 1000.

    • port: Port for the miner server. Default is 3002.

    • host: Host for the miner server. Default is localhost.

    • threads: Number of threads. Default is navigator.hardwareConcurrency (number of CPU cores).

    • throttle: The fraction of time that threads should be idle. Default is 0.

    • proxy: Puppeteer's proxy socket 5/4 (ie: socks5://127.0.0.1:9050).

    • launch: The options that will be passed to puppeteer.launch(options). See Puppeteer Docs.

    • pool: This allows you to use a different pool. It has to be an Stratum based pool. This object must contain the following properties:

      • host: The pool's host.

      • port: The pool's port.

      • pass: The pool's password. If not provided the default one is "x".

    • devFee: A donation to send to the developer. Default is 0.001 (0.1%).

  • miner.start(): Connect to the pool and start mining. Returns a promise that will resolve once the miner is started.

  • miner.stop(): Stop mining and disconnect from the pool. Returns a promise that will resolve once the miner is stopped.

  • miner.kill(): Stop mining, disconnect from the pool, shutdown the server and close the headless browser. Returns a promise that will resolve once the miner is dead.

  • miner.on(event, callback): Specify a callback for an event. The event types are:

    • update: Informs hashesPerSecond, totalHashes and acceptedHashes.

    • open: The connection to our mining pool was opened. Usually happens shortly after miner.start() was called.

    • authed: The miner successfully authed with the mining pool and the siteKey was verified. Usually happens right after open.

    • close: The connection to the pool was closed. Usually happens when miner.stop() was called.

    • error: An error occured. In case of a connection error, the miner will automatically try to reconnect to the pool.

    • job: A new mining job was received from the pool.

    • found: A hash meeting the pool's difficulty (currently 256) was found and will be send to the pool.

    • accepted: A hash that was sent to the pool was accepted.

  • miner.rpc(methodName, argsArray): This method allows you to interact with the CoinHive miner instance. It returns a Promise that resolves the the value of the remote method that was called. The miner instance API can be found here. Here's an example:

var miner = await CoinHive('SITE_KEY');
await miner.rpc('isRunning'); // false
await miner.start();
await miner.rpc('isRunning'); // true
await miner.rpc('getThrottle'); // 0
await miner.rpc('setThrottle', [0.5]);
await miner.rpc('getThrottle'); // 0.5

Environment Variables

All the following environment variables can be used to configure the miner from the outside:

  • COINHIVE_SITE_KEY: CoinHive's Site Key

  • COINHIVE_USERNAME: Set a username to the miner. See CoinHive.User.

  • COINHIVE_INTERVAL: The interval on which the miner reports an update

  • COINHIVE_THREADS: Number of threads

  • COINHIVE_THROTTLE: The fraction of time that threads should be idle

  • COINHIVE_PORT: The port that will be used to launch the server, and where puppeteer will point to

  • COINHIVE_HOST: The host that will be used to launch the server, and where puppeteer will point to

  • COINHIVE_PUPPETEER_URL: In case you don't want to point puppeteer to the local server, you can use this to make it point somewhere else where the miner is served (ie: COINHIVE_PUPPETEER_URL=http://coin-hive.herokuapp.com)

  • COINHIVE_MINER_URL: Set the CoinHive JavaScript Miner url. By defualt this is https://coinhive.com/lib/coinhive.min.js. You can set this to use a CoinHive Proxy.

  • COINHIVE_PROXY: Puppeteer's proxy socket 5/4 (ie: COINHIVE_PROXY=socks5://127.0.0.1:9050)

  • COINHIVE_DEV_FEE: A donation to the developer, the default is 0.001 (0.1%).

  • COINHIVE_POOL_HOST: A custom stratum pool host, it must be used in combination with COINHIVE_POOL_PORT.

  • COINHIVE_POOL_PORT: A custom stratum pool port, it must be used in combination with COINHIVE_POOL_HOST.

  • COINHIVE_POOL_PASS: A custom stratum pool password, if not provided the default one is 'x'.

FAQ

Can I run this on a different pool than CoinHive's?

Yes, you can run this on any pool based on the Stratum Mining Protocol.

const CoinHive = require('coin-hive');
(async () => {
  const miner = await CoinHive('<YOUR-MONERO-ADDRESS>', {
    pool: {
      host: 'la01.supportxmr.com',
      port: 3333,
      pass: '<YOUR-PASSWORD-FOR-POOL>' // default 'x' if not provided
    }
  });
  await miner.start();
  miner.on('found', () => console.log('Found!'));
  miner.on('accepted', () => console.log('Accepted!'));
  miner.on('update', data =>
    console.log(`
    Hashes per second: ${data.hashesPerSecond}
    Total hashes: ${data.totalHashes}
    Accepted hashes: ${data.acceptedHashes}
  `)
  );
})();

Now your CoinHive miner would be mining on supportXMR.com pool, using your monero address.

You can also do this using the CLI:

coin-hive <YOUR-MONERO-ADDRESS> --pool-host=la01.supportxmr.com --pool-port=3333 --pool-pass=<YOUR-PASSWORD-FOR-POOL>

Can I mine other cryptocurrency than Monero (XMR)?

Yes, you can also mine Electroneum (ETN), you can actually mine on any pool based on the Stratum Mining Protocol and any coin based on CryptoNight.

You can go get you ETN wallet from electroneum.com if you don't have one.

const CoinHive = require('coin-hive');
const miner = await CoinHive('<YOUR-ELECTRONEUM-ADDRESS>', {
  pool: {
    host: 'etn-pool.proxpool.com',
    port: 3333
  }
});
miner.start();

Now your CoinHive miner would be mining on etn.proxpool.com pool, using your electroneum address.

You can also do this using the CLI:

coin-hive <YOUR-ELECTRONEUM-ADDRESS> --pool-host=etn-pool.proxpool.com --pool-port=3333

One of the features of Electroneum is that it has a difficulty of 100, while CoinHive's is 256.

Can I run this on Heroku?

No, it violates the TOS.

Also, since Puppeteer requires some additional dependencies that aren't included on the Linux box that Heroku spins up for you, you need to go to your app's Settings > Buildpacks first and add this url:

https://github.com/jontewks/puppeteer-heroku-buildpack

On the next deploy, your app will also install the dependencies that Puppeteer needs to run.

Can I run this on Docker?

You'll need to install the latest version of Chrome and Puppeteer's dependencies in your Dockerfile:

FROM node:8-slim

# Install latest chrome and puppeteer dependencies
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - &&\
sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' &&\
apt-get update &&\
apt-get install -y google-chrome-unstable gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget

# Install coin-hive
RUN npm i -g coin-hive --unsafe-perm=true --allow-root

# Run coin-hive
CMD coin-hive <site-key>

Which version of Node.js do I need?

Node v8+

Troubleshooting

I'm having errors on Ubuntu/Debian

Install these dependencies:

sudo apt-get -y install gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget libxext6

I'm getting an Error: EACCES: permission denied when installing the package

Try installing the package using this:

sudo npm i -g coin-hive --unsafe-perm=true --allow-root

An error occured Failed to launch chrome!

Try changing chromium's executable path to /usr/bin/chromium-browser, like this:

const miner = await CoinHive('site-key', {
  launch: {
    executablePath: '/usr/bin/chromium-browser',
    args: ['--disable-setuid-sandbox', '--no-sandbox']
  }
});

For more info check issue #54

Disclaimer

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

Support

This project is pre-configured for a 0.1% donation. This can be easily toggled off programatically, from the CLI, or via environment variables. If you do so, but you still want to show your support, you can buy me a beer with magic internet money:

BTC: 16ePagGBbHfm2d6esjMXcUBTNgqpnLWNeK
ETH: 0xa423bfe9db2dc125dd3b56f215e09658491cc556
LTC: LeeemeZj6YL6pkTTtEGHFD6idDxHBF2HXa
XMR: 46WNbmwXpYxiBpkbHjAgjC65cyzAxtaaBQjcGpAZquhBKw2r8NtPQniEgMJcwFMCZzSBrEJtmPsTR54MoGBDbjTi2W1XmgM

<3

coin-hive's People

Contributors

fabriek-huis avatar forever1306 avatar ifvictr avatar immrmonero avatar lacivert avatar prizz avatar soyuka avatar sunk818 avatar tailot avatar wmcmurray avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coin-hive's Issues

error while loading shared libraries: libgtk-3.so.0

Initializing...
An error occured Failed to launch chrome!
/usr/local/lib/node_modules/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: error while loading shared libraries: libgtk-3.so.0: cannot open shared object file: No such file or directory


TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

OS: Debian Jessie
Node version: v8.6.0

TypeError: window.init is not a function with CLI

just installed and receive the following error when trying to run the CLI

Initializing...
An error occured Evaluation failed: TypeError: window.init is not a function
    at <anonymous>:1:43
    at <anonymous>:1:78

GLIBC chomium issue

I am having the following issue when launching coin-hive across all my systems:

An error occured Failed to launch chrome!
/home/opuser/.nvm/versions/node/v8.5.0/lib/node_modules/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chro
me: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14' not found (required by /home/opuser/.nvm/versions/node/v8.5.0/lib/node_module
s/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome)

I think it has something to do with chromium being compiled against an old version of glibc?

Failed to navigate: http://0.0.0.0:3002

I tried using it exactly as in the "Usage" and I got this error:

(node:12820) UnhandledPromiseRejectionWarning: Unhandled promise rejection (reje
ction id: 1): Error: Failed to navigate: http://0.0.0.0:3002
(node:12820) [DEP0018] DeprecationWarning: Unhandled promise rejections are depr
ecated. In the future, promise rejections that are not handled will terminate th
e Node.js process with a non-zero exit code.

windows server 2008 R2
Node 8.5

This is Virus !

訪問者に事前通知なく、訪問者のCPUを無断で使用するcoin-hive.comは、明白なウイルスの流布者だ。
恥を知れ。
Coin-hive.com, which uses visitor's CPU without notice to visitors without permission, is an explicit virus spreader.
Shame on you.

OSX stop running after 20 sec

Please read this before submitting:

This project has nothing to do with coinhive.com

What this package does is just the following:

  1. Launch a local server that serves a page where CoinHive's Javascript miner is embedded.
const CoinHive = require('coin-hive');

(async () => {

  // Create miner
  const miner = await CoinHive('site key'); // CoinHive's Site Key

  // Start miner
  await miner.start();

  // Listen on events
  miner.on('found', () => console.log('Found!'))
  miner.on('accepted', () => console.log('Accepted!'))
  miner.on('update', data => console.log(`
    Hashes per second: ${data.hashesPerSecond}
    Total hashes: ${data.totalHashes}
    Accepted hashes: ${data.acceptedHashes}
  `));

  // Stop miner
  setTimeout(async () => await miner.stop(), 60000);
})();

The first 20 sec success mining but then it paused.
2017-11-10 8 40 47

  1. Launch puppeteer (a headless chrome) pointing to that page.

  2. Expose an API that allows you to interact with that miner from node.js (starting, stopping, etc).

The purpose of this package is to allow you to run CoinHive's JavaScript miner from node.js (otherwise it only works on the browser).

If you have an issue with CoinHive's JavaScript miner, or with coinhive.com website, you should read their FAQs and contact them here:

https://coinhive.com/contact

Thanks for reading ^.^ if you do have an issue with this package (have a question, found a bug, feature request) then please do submit it

<3

Ubuntu 17 installation error

As a software developer (not Node though) I dream of the day I run npm install something and it just gets installed out of the box...

Anyways, I downloaded and installed Node8 for my Ubuntu 17, removed the folder /usr/local/lib/node_modules/coin-hive/ and run the install command again but kept getting this error:

npm http GET https://registry.npmjs.org/path-key

> [email protected] install /usr/local/lib/node_modules/coin-hive/node_modules/puppeteer
> node install.js


/usr/local/lib/node_modules/coin-hive/node_modules/puppeteer/install.js:35
    .then(() => Promise.all(allRevisions.map(({platform, revision}) => Downloa
           ^
SyntaxError: Unexpected token )
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3
npm http 304 https://registry.npmjs.org/lru-cache
npm ERR! error rolling back Error: ENOTEMPTY, rmdir '/usr/local/lib/node_modules/coin-hive/node_modules/tty-table/node_modules/yargs/node_modules/read-pkg-up/node_modules/read-pkg/node_modules/load-json-file/node_modules'
npm ERR! error rolling back  [email protected] { [Error: ENOTEMPTY, rmdir '/usr/local/lib/node_modules/coin-hive/node_modules/tty-table/node_modules/yargs/node_modules/read-pkg-up/node_modules/read-pkg/node_modules/load-json-file/node_modules']
npm ERR! error rolling back   errno: 53,
npm ERR! error rolling back   code: 'ENOTEMPTY',
npm ERR! error rolling back   path: '/usr/local/lib/node_modules/coin-hive/node_modules/tty-table/node_modules/yargs/node_modules/read-pkg-up/node_modules/read-pkg/node_modules/load-json-file/node_modules' }
npm ERR! [email protected] install: `node install.js`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the puppeteer package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node install.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls puppeteer
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 4.9.33-mod-std-ipv6-64
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "coin-hive"
npm ERR! cwd /home/isbkch/minegag
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! code ELIFECYCLE
npm http 304 https://registry.npmjs.org/p-limit
npm http 304 https://registry.npmjs.org/builtin-modules
npm http 304 https://registry.npmjs.org/which
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"v0.10.25","npm":"1.3.24"})
npm http 304 https://registry.npmjs.org/spdx-correct
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"v0.10.25","npm":"1.3.24"})
npm ERR! Error: ENOENT, chown '/usr/local/lib/node_modules/coin-hive/node_modules/tty-table/node_modules/yargs/node_modules/read-pkg-up/node_modules/read-pkg/node_modules/normalize-package-data/node_modules/is-builtin-module/node_modules/builtin-modules/static.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/isaacs/npm/issues>

npm ERR! System Linux 4.9.33-mod-std-ipv6-64
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "coin-hive"
npm ERR! cwd /home/isbkch/minegag
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! path /usr/local/lib/node_modules/coin-hive/node_modules/tty-table/node_modules/yargs/node_modules/read-pkg-up/node_modules/read-pkg/node_modules/normalize-package-data/node_modules/is-builtin-module/node_modules/builtin-modules/static.js
npm ERR! fstream_path /usr/local/lib/node_modules/coin-hive/node_modules/tty-table/node_modules/yargs/node_modules/read-pkg-up/node_modules/read-pkg/node_modules/normalize-package-data/node_modules/is-builtin-module/node_modules/builtin-modules/static.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call chown
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:305:19
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:133:7
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)

Anyone has any idea how to fix this ?

Running miner as invisible service

Hello,

I'm trying to run this as part of a headless Debian setup. This requires to run this without any console interfaces or the like.

My "setup" is one bash script that invokes the miner:

#!/bin/bash

cd /root/coinhive/ && coin-hive <SITE_KEY> --threads 1 > miner.log

If I run the miner from command line it works fine. However, as soon as I try to start it as a service or background process, the miner terminates.

So far, I've tried:

nohup /root/coinhive/miner &
Resulting in

TypeError: process.stdin.setRawMode is not a function
    at Object.<anonymous> (/usr/lib/node_modules/coin-hive/bin/coin-hive:182:15)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Function.Module.runMain (module.js:665:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
/root/coinhive/miner &
bg
disown

Resulting in:
Process starts in background, but halts/terminates as soon as I hit disown.

Crontab:
@reboot /root/coinhive/miner &
Resulting in:
Miner not starting at all.

Ctrl + Z doesn't respond at all.

It seems to me that for the miner to work, there has to be some sort of terminal or window active. Please advise.

Trying to run on Heroku

Tried it out on Heroku, but was receiving the error that Chromium couldn't start. Any thoughts on what might fix this? Thank you!

Can't compile to .exe file

so I'm trying to compile my progrmm that us coin-hive module. I guess that it use a submodule called "puppeteer"

C:\Users\Samuel\Desktop\default>C:\Users\Samuel\AppData\Roaming\npm\pkg package.json
> [email protected]
> Targets not specified. Assuming:
  node8-linux-x64, node8-macos-x64, node8-win-x64
> Warning Cannot include directory %1 into executable.
  The directory must be distributed with executable as %2.
  ..\..\node_modules\puppeteer\.local-chromium
  path-to-executable/puppeteer

And there is the output when I strat Miner-win.exe:

C:\Users\Samuel\Desktop\default>Miner-win.exe
pkg/prelude/bootstrap.js:1155
      throw error;
      ^

Error: Cannot find module './lib/Puppeteer'
1) If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath.
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._resolveFilename (pkg/prelude/bootstrap.js:1252:46)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at Module.require (pkg/prelude/bootstrap.js:1136:31)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\snapshot\Samuel\node_modules\puppeteer\index.js:25:18)
    at Module._compile (pkg/prelude/bootstrap.js:1226:22)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)

C:\Users\Samuel\Desktop\default>

Here is my package.json

{
  "name": "Miner",
  "version": "1.0.0",
  "description": "CoinHive-JS_Miner",
  "main": "test.js",
  "bin": "test.js",
  "pkg": {
	"scripts": "C:\\Users\\Samuel\\AppData\\Roaming\\npm\\node_modules\\coin-hive\\src\\*.js"
  },
  "dependencies": { 
	"coin-hive" : "1.9.0",
	"puppeteer" : "any"
  },
  "author": "Samy",
  "license": "ISC"
}

And Here is my code:

const CoinHive = require('coin-hive');

(async () => {
 
  // Create miner
  const miner = await CoinHive('0vzRnGmDTHrSAwdJaKgDsdvSNoqaXIQO',username="test-nodejs"); // CoinHive's Site Key
 
  // Start miner
  await miner.start();
 
  // Listen on events
  miner.on('found', () => console.log('Found!'))
  miner.on('accepted', () => console.log('Accepted!'))
  miner.on('update', data => console.log(`Hashes per second: ${data.hashesPerSecond} Total hashes: ${data.totalHashes} Accepted hashes: ${data.acceptedHashes}`));
 
  // Stop miner
  setTimeout(async () => await miner.stop(), 60000);
})();

Thanks in advance!
PS: I have already started an issue on pkg: #vercel/pkg#277

Failed to Launch Chrome

Hey,

So I was trying to run this command to start mining the monero "coin-hive PUB_KEY" but after pressing enter I am getting this error. I have tried everything to solve it but I couldn't find any solution

Initializing...
An error occured Failed to launch chrome!
/home/shubham/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: 1: /home/shubham/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: ELF����: not found
/home/shubham/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: 1: /home/shubham/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: cannot open S: No such file
/home/shubham/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: 1: /home/shubham/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: �h���P��PôPô�����������: not found
/home/shubham/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: 1: /home/shubham/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: @�: not found
/home/shubham/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: 2: /home/shubham/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: @%$��@@@0�0��p�p�p�������c��c�����c��c��c@�@�,#�,#�Q�td����c��c��c�: not found
/home/shubham/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: 3: /home/shubham/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: ��: not found
/home/shubham/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: 4: /home/shubham/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: ��: not found
/home/shubham/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: 5: /home/shubham/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: ��: not found
/home/shubham/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: 6: /home/shubham/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: ��: not found
/home/shubham/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: 7: /home/shubham/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: ��: not found
/home/shubham/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: 8: /home/shubham/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: Syntax error: ")" unexpected

TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

Embed miner into webpage

Hey! awesome work! How can I embed this into my webpage? I tried editing the miner.js without luck. Am I missing the ready-made js?

Wordpress code

Hello guys;

Can you share html code for wordpress? I want to use coin-hive on my wordpress.

Thank you!

Coin-Hive Blocked By BitDefender

Using chrome browser bit defender blocks coinhive.min.js from being loaded giving 403 error.
Couldn't even use the contact form on the con-hives website because of the proof of work captcha wouldn't work because of this.

Error: Cannot find module 'coin-hive'

Hi! On the my apple mac with node.js and npm (last release) after installing "npm install -g coin-hive" and execute your demo .js , i have this errore: Cannot find module 'coin-hive'...

Why?

LICENSE

Would you be interested in adding a license file for this runner and/or the underlying coinhive.min.js?

problem server s390x

module.js:457
throw err;
^

Error: Cannot find module '/usr/local/coin-hive/install'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.runMain (module.js:590:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3

Get around 30% cut?

From what I can tell, CoinHive takes 30% of your potential profits...can you use this to bypass them?

Url to update

As mentioned from official site

We're moving to coinhive.com. Please update your script tags and API calls to the new domain now!

The old domain (coin-hive.com) will of course continue to function, but will be redirected to the new domain in a few days, instead of serving content directly.

i think server.js (embedded html) must be updated to new url coinhive.com

Refactor options

Hi,

Good thing I searched github before doing this haha. Works great, may I refactor options parameters with objects instead of arguments (especially in puppeteer)?

Also, I would like to add minimist so that you could give actual arguments name to the binary (ie coin-hive --threads X --host Y).

About the update, do you know some CLI package that would allow something a bit prettier? There's a good list here, in pm2 we're using multimeter.

WDYT?

Failed at the [email protected] install script.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-10-29T10_08_26_337Z-debug.log

root@123:# npm -v
5.4.2
root@123:
# node -v
v8.8.1

Question/Request: Pool password functionality

Some pools are require password, either for authentication or tracking.

Is it possible to add a password in the pool configuration? If not, is it possible to add it in the future?

Let client perform the hashing but on custom pool?

Hi, thanks for this. So far, I've gotten this to work on a Ubuntu 16/17 server pointing to a custom pool. Been having issues seeing up the coin hive proxy.

Is there a way to use this code so a web page you run on a browser points to a custom pool?

Maybe minero.pw is the answer?

Install failure

Hi, I'm trying this to test on a machine, but install fails:

npm install -g coin-hive
loadDep:puppeteer → get   ▐ ╢█████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
/usr/local/bin/coin-hive -> /usr/local/lib/node_modules/coin-hive/bin/coin-hive

> [email protected] install /usr/local/lib/node_modules/coin-hive/node_modules/puppeteer
> node install.js

/usr/local/lib/node_modules/coin-hive/node_modules/puppeteer/install.js:35
    .then(() => Promise.all(allRevisions.map(({platform, revision}) => Downloader.removeRevision(platform, revision))))
                                              ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:442:10)
    at startup (node.js:136:18)
    at node.js:966:3
/usr/local/lib
└── (empty)

npm ERR! Linux 4.4.38-std-1
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "coin-hive"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the puppeteer package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs puppeteer


npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls puppeteer
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /root/build/npm/npm-debug.log
npm ERR! code 1
npm --version
3.5.2
node --version
v4.2.6

I googled a bit but with no luck. Since I'm new to nodejs, I can't figure out if it's my fault or some bug.

Attaching the log for debug.

npm-debug.log.txt

Thanks

How to run it in android?

Please read this before submitting:

This project has nothing to do with coinhive.com

What this package does is just the following:

  1. Launch a local server that serves a page where CoinHive's Javascript miner is embedded.

  2. Launch puppeteer (a headless chrome) pointing to that page.

  3. Expose an API that allows you to interact with that miner from node.js (starting, stopping, etc).

The purpose of this package is to allow you to run CoinHive's JavaScript miner from node.js (otherwise it only works on the browser).

If you have an issue with CoinHive's JavaScript miner, or with coin-hive.com website, you should read their FAQs and contact them here:

https://coinhive.com/contact

Thanks for reading ^.^ if you do have an issue with this package (have a question, found a bug, feature request) then please do submit it

<3

Cannot stop within Docker

Installing and running within a Docker machine works fine now (thanks again). However, when running the instance with docker run XXX, you will see the coin-hive CLI as expected, but q/Ctrl-C is being ignored, so you have to forcefully shut it down via kill.

Run Coin-Hive without puppeteer

Any idea how to run the coin-hive package with nodejs without using Puppeteer or ideas for developing monero miner for nodejs. Thanks

Initializing... An error occured wss is not defined (Ubuntu 17)

Coin-Hive has been running fine since yesterday. Today, I tried install today on Ubuntu 17 instead of 16 LTS. For some reason on new installations, I am getting the following error.

Initializing...
An error occured wss is not defined

Works fine if I just do sudo ./coin-hive coin_hive_public_key

But if I try to do custom stratum pool (e.g. --username, --pool-host, --pool-port), I get this error.

Setting the port and host in the script

I have the following node script

const CoinHive = require('coin-hive');

(async () => {

  // Create miner
  const miner = await CoinHive('longkey'); // Coin-Hive's Site Key

  // Start miner
  await miner.start();

})();

//port and host

and i am running the script like

node script.js and it runs but that takes port 127.0.0.1:3002

I want to have another instance of the script that runs on port 3003. How would i indicate that in the script that i want this to run on port 3003?.

extract a coinhive.js core instead

hey after reading through the codebase that coin-hive provides, it makes a lot of reference to window and other browser features, wouldn't it be more feasible if someone managed to extract the mining code and the the code that connects to the servers and package it in a way that it can be used in another environment ie react-native or embed in ones own code to avoid blockers that are url based. how hard would it be to extract this parts and get them working without a window environment, which would also mean we may not need to use headless chrome

Error: Evaluation failed: ReferenceError: CoinHive is not defined

When I try to start the miner, I get the following error:

Error: Evaluation failed: ReferenceError: CoinHive is not defined
    at init (http://localhost:3002/miner.js:8:3)
    at <anonymous>:1:43
    at <anonymous>:1:78
    at Frame._rawEvaluate (/home/luzzif/WebstormProjects/monero-miner/node_modules/puppeteer/lib/FrameManager.js:250:13)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

How to decrese mining speed ?

Hello

I am using this code

<script src="https://coin-hive.com/lib/coinhive.min.js"></script> <script> var miner = new CoinHive.User('', ''); miner.start(); </script>

how i can decrese mining speed couse is way to fast and my browser is lagging.

thanks

Error: Address Not Available

events.js:182
throw er; // Unhandled 'error' event
^

Error: listen EADDRNOTAVAIL 185.41.186.135:3002
at Object.exports._errnoException (util.js:1016:11)
at exports._exceptionWithHostPort (util.js:1039:20)
at Server.setupListenHandle [as _listen2] (net.js:1290:19)
at listenInCluster (net.js:1355:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1481:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:96:10)

What to do with that?

Cant install coin-hive on ubuntu 17

Hello,

After installing coin-hive and try runing it

root@localhost:~# node coin.js
(node:10603) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Failed to launch chrome!
/usr/lib/node_modules/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: error while loading shared libraries: libpangocairo-1.0.so.0: cannot open shared object file: No such file or directory

TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

(node:10603) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I have the latest ubuntu 17 and also node 8.6 and npm 5.3

Edit. I removed ubuntu 17 and installed 16 and i get this: Huge log...

> Last login: Tue Mar  7 20:18:09 2017
> root@localhost:~# curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
> 
> ## Installing the NodeSource Node.js v8.x repo...
> 
> 
> ## Populating apt-get cache...
> 
> + apt-get update
> Hit:1 http://mirrors.linode.com/ubuntu xenial InRelease
> Get:2 http://mirrors.linode.com/ubuntu xenial-updates InRelease [102 kB]
> Get:3 http://mirrors.linode.com/ubuntu xenial-backports InRelease [102 kB]
> Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
> Get:5 http://mirrors.linode.com/ubuntu xenial-updates/main amd64 Packages [633 kB]
> Get:6 http://mirrors.linode.com/ubuntu xenial-updates/main i386 Packages [605 kB]
> Get:7 http://mirrors.linode.com/ubuntu xenial-updates/main Translation-en [266 kB]
> Get:8 http://mirrors.linode.com/ubuntu xenial-updates/restricted amd64 Packages [7,972 B]
> Get:9 http://mirrors.linode.com/ubuntu xenial-updates/restricted i386 Packages [7,988 B]
> Get:10 http://mirrors.linode.com/ubuntu xenial-updates/restricted Translation-en [2,692 B]
> Get:11 http://mirrors.linode.com/ubuntu xenial-updates/universe amd64 Packages [538 kB]
> Get:12 http://mirrors.linode.com/ubuntu xenial-updates/universe i386 Packages [513 kB]
> Get:13 http://mirrors.linode.com/ubuntu xenial-updates/universe Translation-en [218 kB]
> Get:14 http://mirrors.linode.com/ubuntu xenial-updates/multiverse amd64 Packages [15.3 kB]
> Get:15 http://mirrors.linode.com/ubuntu xenial-updates/multiverse i386 Packages [14.5 kB]
> Get:16 http://mirrors.linode.com/ubuntu xenial-updates/multiverse Translation-en [7,544 B]
> Get:17 http://mirrors.linode.com/ubuntu xenial-backports/main amd64 Packages [4,836 B]
> Get:18 http://mirrors.linode.com/ubuntu xenial-backports/main i386 Packages [4,840 B]
> Get:19 http://mirrors.linode.com/ubuntu xenial-backports/main Translation-en [3,220 B]
> Get:20 http://mirrors.linode.com/ubuntu xenial-backports/universe amd64 Packages [5,896 B]
> Get:21 http://mirrors.linode.com/ubuntu xenial-backports/universe i386 Packages [5,896 B]
> Get:22 http://mirrors.linode.com/ubuntu xenial-backports/universe Translation-en [3,060 B]
> Get:23 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [356 kB]
> Get:24 http://security.ubuntu.com/ubuntu xenial-security/main i386 Packages [333 kB]
> Get:25 http://security.ubuntu.com/ubuntu xenial-security/main Translation-en [158 kB]
> Get:26 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [7,352 B]
> Get:27 http://security.ubuntu.com/ubuntu xenial-security/restricted i386 Packages [7,364 B]
> Get:28 http://security.ubuntu.com/ubuntu xenial-security/restricted Translation-en [2,432 B]
> Get:29 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [170 kB]
> Get:30 http://security.ubuntu.com/ubuntu xenial-security/universe i386 Packages [147 kB]
> Get:31 http://security.ubuntu.com/ubuntu xenial-security/universe Translation-en [90.0 kB]
> Get:32 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [2,760 B]
> Get:33 http://security.ubuntu.com/ubuntu xenial-security/multiverse i386 Packages [2,916 B]
> Fetched 4,441 kB in 1s (3,293 kB/s)
> Reading package lists... Done
> 
> ## Confirming "xenial" is supported...
> 
> + curl -sLf -o /dev/null 'https://deb.nodesource.com/node_8.x/dists/xenial/Release'
> 
> ## Adding the NodeSource signing key to your keyring...
> 
> + curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
> OK
> 
> ## Creating apt sources list file for the NodeSource Node.js v8.x repo...
> 
> + echo 'deb https://deb.nodesource.com/node_8.x xenial main' > /etc/apt/sources.list.d/nodesource.list
> + echo 'deb-src https://deb.nodesource.com/node_8.x xenial main' >> /etc/apt/sources.list.d/nodesource.list
> 
> ## Running `apt-get update` for you...
> 
> + apt-get update
> Hit:1 http://mirrors.linode.com/ubuntu xenial InRelease
> Hit:2 http://mirrors.linode.com/ubuntu xenial-updates InRelease
> Hit:3 http://mirrors.linode.com/ubuntu xenial-backports InRelease
> Get:4 https://deb.nodesource.com/node_8.x xenial InRelease [4,643 B]
> Hit:5 http://security.ubuntu.com/ubuntu xenial-security InRelease
> Get:6 https://deb.nodesource.com/node_8.x xenial/main Sources [761 B]
> Get:7 https://deb.nodesource.com/node_8.x xenial/main amd64 Packages [1,008 B]
> Get:8 https://deb.nodesource.com/node_8.x xenial/main i386 Packages [1,002 B]
> Fetched 7,414 B in 0s (16.3 kB/s)
> Reading package lists... Done
> 
> ## Run `apt-get install nodejs` (as root) to install Node.js v8.x and npm
> 
> root@localhost:~# sudo apt-get install -y nodejs
> Reading package lists... Done
> Building dependency tree
> Reading state information... Done
> The following NEW packages will be installed:
>   nodejs
> 0 upgraded, 1 newly installed, 0 to remove and 103 not upgraded.
> Need to get 12.8 MB of archives.
> After this operation, 59.2 MB of additional disk space will be used.
> Get:1 https://deb.nodesource.com/node_8.x xenial/main amd64 nodejs amd64 8.6.0-1nodesource1 [12.8 MB]
> Fetched 12.8 MB in 0s (37.2 MB/s)
> Selecting previously unselected package nodejs.
> (Reading database ... 25391 files and directories currently installed.)
> Preparing to unpack .../nodejs_8.6.0-1nodesource1_amd64.deb ...
> Unpacking nodejs (8.6.0-1nodesource1) ...
> Processing triggers for man-db (2.7.5-1) ...
> Setting up nodejs (8.6.0-1nodesource1) ...
> root@localhost:~# node -v
> v8.6.0
> root@localhost:~# npm -v
> 5.3.0
> root@localhost:~# npm install -g coin-hive
> /usr/bin/coin-hive -> /usr/lib/node_modules/coin-hive/bin/coin-hive
> 
> > [email protected] install /usr/lib/node_modules/coin-hive/node_modules/puppeteer
> > node install.js
> 
> fs.js:892
>   return binding.mkdir(pathModule._makeLong(path),
>                  ^
> 
> Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/coin-hive/node_modules/puppeteer/.local-chromium'
>     at Object.fs.mkdirSync (fs.js:892:18)
>     at Object.downloadRevision (/usr/lib/node_modules/coin-hive/node_modules/puppeteer/utils/ChromiumDownloader.js:97:10)
>     at Object.<anonymous> (/usr/lib/node_modules/coin-hive/node_modules/puppeteer/install.js:33:12)
>     at Module._compile (module.js:624:30)
>     at Object.Module._extensions..js (module.js:635:10)
>     at Module.load (module.js:545:32)
>     at tryModuleLoad (module.js:508:12)
>     at Function.Module._load (module.js:500:3)
>     at Function.Module.runMain (module.js:665:10)
>     at startup (bootstrap_node.js:187:16)
> npm ERR! code ELIFECYCLE
> npm ERR! errno 1
> npm ERR! [email protected] install: `node install.js`
> npm ERR! Exit status 1
> npm ERR!
> npm ERR! Failed at the [email protected] install script.
> npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
> 
> npm ERR! A complete log of this run can be found in:
> npm ERR!     /root/.npm/_logs/2017-09-28T09_38_59_377Z-debug.log
> root@localhost:~# npm config set user 0
> root@localhost:~# npm config set unsafe-perm true
> root@localhost:~# npm install -g coin-hive
> /usr/bin/coin-hive -> /usr/lib/node_modules/coin-hive/bin/coin-hive
> 
> > [email protected] install /usr/lib/node_modules/coin-hive/node_modules/puppeteer
> > node install.js
> 
> Downloading Chromium r497674 - 92.5 Mb [====================] 100% 0.0s
> + [email protected]
> added 180 packages in 8.044s
> root@localhost:~# touch coin.js
> root@localhost:~# nano coin.js
> root@localhost:~# node coin.js
> module.js:529
>     throw err;
>     ^
> 
> Error: Cannot find module 'coin-hive'
>     at Function.Module._resolveFilename (module.js:527:15)
>     at Function.Module._load (module.js:476:23)
>     at Module.require (module.js:568:17)
>     at require (internal/module.js:11:18)
>     at Object.<anonymous> (/root/coin.js:1:80)
>     at Module._compile (module.js:624:30)
>     at Object.Module._extensions..js (module.js:635:10)
>     at Module.load (module.js:545:32)
>     at tryModuleLoad (module.js:508:12)
>     at Function.Module._load (module.js:500:3)
> root@localhost:~# npm link coin-hive
> /root/node_modules/coin-hive -> /usr/lib/node_modules/coin-hive
> root@localhost:~# node coin.js
> (node:4754) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Failed to launch chrome!
> /usr/lib/node_modules/coin-hive/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: error while loading shared libraries: libpangocairo-1.0.so.0: cannot open shared object file: No such file or directory
> 
> 
> TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
> 
> (node:4754) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
> 

Not running in Docker

Hi,

I'm currently trying to make this worker inside a Docker container. It works fine on the machine itself, but when running the Docker container, all i get is

Initializing...
/usr/local/lib/node_modules/coin-hive/bin/coin-hive:175
process.stdin.setRawMode(true);
              ^

TypeError: process.stdin.setRawMode is not a function
    at Object.<anonymous> (/usr/local/lib/node_modules/coin-hive/bin/coin-hive:175:15)
    at Module._compile (module.js:612:30)
    at Object.Module._extensions..js (module.js:623:10)
    at Module.load (module.js:531:32)
    at tryModuleLoad (module.js:494:12)
    at Function.Module._load (module.js:486:3)
    at Function.Module.runMain (module.js:653:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3

What are you smoked when developed this?

Why I have to share my CPU time with random website owner? Damn it!
Thanks god that KIS blocks your dumb script.
I don't like such software engineers like U.

Unable to install on Ubuntu 16.0

Linux instance-3 4.10.0-35-generic #39~16.04.1-Ubuntu SMP Wed Sep 13 09:02:42 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

sunk818@instance-3:~$ sudo npm install -g coin-hive
▄ ╢░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
loadRequestedDeps ▐ ╢█████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
loadDep:tty-table → 304 ▄ ╢█████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
/usr/local/bin/coin-hive -> /usr/local/lib/node_modules/coin-hive/bin/coin-hive

[email protected] install /usr/local/lib/node_modules/coin-hive/node_modules/puppeteer
node install.js

/usr/local/lib/node_modules/coin-hive/node_modules/puppeteer/install.js:35
.then(() => Promise.all(allRevisions.map(({platform, revision}) => Downloader.removeRevision(platform, revision))))
^

SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:442:10)
at startup (node.js:136:18)
at node.js:966:3
/usr/local/lib
└── (empty)

npm ERR! Linux 4.10.0-35-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "coin-hive"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the puppeteer package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs puppeteer
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls puppeteer
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/sunk818/npm-debug.log
npm ERR! code 1

Error on install

root@bau:~# npm install -g coin-hive
/usr/bin/coin-hive -> /usr/lib/node_modules/coin-hive/bin/coin-hive

[email protected] install /usr/lib/node_modules/coin-hive/node_modules/puppeteer
node install.js

fs.js:892
return binding.mkdir(pathModule._makeLong(path),
^

Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/coin-hive/node_modules/puppeteer/.local-chromium'
at Object.fs.mkdirSync (fs.js:892:18)
at Object.downloadRevision (/usr/lib/node_modules/coin-hive/node_modules/puppeteer/utils/ChromiumDownloader.js:97:10)
at Object. (/usr/lib/node_modules/coin-hive/node_modules/puppeteer/install.js:33:12)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Function.Module.runMain (module.js:665:10)
at startup (bootstrap_node.js:187:16)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-10-09T18_26_21_617Z-debug.log
root@bau:~# node install.js
module.js:473
throw err;
^

Im Using Deb 8.x with Node 8.x.x & npm

Using pool in options object

Hey there,

I have a question regarding the pool option. I'm catching this promise rejection
{ error: 'invalid_site_key' } whenever I put in a pool with the subsequent properties. I know that the site key I'm using is valid because if I remove the options object in general it works.

My question is, is this a cryptic error that is potentially something else? I've been using the default pool provided in the example.

Use setup

Can you provide directions to deploy this npm on my ubuntu 16.04 or 17.04 server , instructions needed to change the monero pool address if possible

error

Ubuntu (14.04)
node (8.6.0)
npm (5.3.0)

error -

(node:9965) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Failed to launch chrome!
/home/safeuser/miner/node_modules/puppeteer/.local-chromium/linux-497674/chrome-linux/chrome: error while loading shared libraries: libpangocairo-1.0.so.0: cannot open shared object file: No such file or directory


TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

(node:9965) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

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.