Socket
Socket
Sign inDemoInstall

coin-hive

Package Overview
Dependencies
150
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.0 to 1.3.0

7

package.json
{
"name": "coin-hive",
"version": "1.2.0",
"version": "1.3.0",
"description": "",

@@ -11,5 +11,8 @@ "main": "src/index.js",

"dependencies": {
"elegant-spinner": "^1.0.1",
"express": "^4.15.4",
"log-update": "^2.1.0",
"minimist": "^1.2.0",
"puppeteer": "^0.10.2"
"puppeteer": "^0.10.2",
"tty-table": "^2.5.5"
},

@@ -16,0 +19,0 @@ "bin": {

@@ -9,14 +9,2 @@ # Coin-Hive [![Build Status](https://travis-ci.org/cazala/coin-hive.svg?branch=master)](https://travis-ci.org/cazala/coin-hive)

## What is this?
This package just does 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).
## Install

@@ -34,12 +22,4 @@

// Options are not mandatory, defaults values:
const options = {
interval: 1000, // interval for "update"
port: 3002, // puppeteer port
host: 'localhost', // puppeteer host,
threads: -1 // number of threads to start with, defaults to navigator.hardwareConcurrency see https://coin-hive.com/documentation/miner#constructor-options
}
// Create miner
const miner = await CoinHive('ZM4gjqQ0jh0jbZ3tZDByOXAjyotDbo00', options); // Coin-Hive's Site Key
const miner = await CoinHive('ZM4gjqQ0jh0jbZ3tZDByOXAjyotDbo00'); // Coin-Hive's Site Key

@@ -81,4 +61,14 @@ // Start miner

- `CoinHive(siteKey)`: Returns a promise of a `Miner` instance. It requires a [Coin-Hive Site Key](https://coin-hive.com/settings/sites).
- `CoinHive(siteKey [, options])`: Returns a promise of a `Miner` instance. It requires a [Coin-Hive Site Key](https://coin-hive.com/settings/sites). The `options` object is not mandatory and may contain the following properties:
- `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).
- `proxy`: Puppeteer's proxy socket 5/4 (ie: `socks5://127.0.0.1:9050`).
- `miner.start()`: Connect to the pool and start mining. Returns a promise that will resolve once the miner is started.

@@ -136,3 +126,3 @@

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

@@ -139,0 +129,0 @@ ## Requisites

@@ -40,3 +40,4 @@ var miner = null;

acceptedHashes: miner.getAcceptedHashes(),
threads: miner.getNumThreads()
threads: miner.getNumThreads(),
autoThreads: miner.getAutoThreadsEnabled(),
}

@@ -43,0 +44,0 @@ console.log('update:', update)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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