How to Run the CoinHive Miner in the Command Line (Headless)


(Command-Line Ninja) #1

Running and Mining from CoinHive in the Linux Command Line

As you may be aware, 0x00sec has begun offering Monero Mining in the browser via Javascript. If you’re like me, you have some server somewhere that can happily take the load, but it’s headless, and you don’t want to be leaving a web browser window open forever.

Fear no more. I have been messing around and finally got it sorted.

What you need to do, is installed Google Chrome or Chromium and run this command.

chromium --headless --disable-gpu --repl

This will start Chrome in headless mode, with REPL enabled, Read-Evaluate-Print-Loop, basically this will allow you to execute javascript in the DOM via the command line, without having to render the actual page.

This may take a little while, once you’ve got this you’ll see a prompt. Paste this.

miner = new CoinHive.User('8GiCBvTene8ArpdPgDjPt2tUIIr4NrXM', "pry0cc", { throttle: 0, autoThreads: true});

Obviously change “pry0cc” to your username, or whoever you want to mine for!

Then start the miner with:


And then check it is running with


You can execute any range of commands, the docs can be found here

I hope this helped! Stay Snappy :wink:


CoinHive -- Node.js
(3,4,5-trimethoxyphenethylamine) #2

This still wont be optimized for performance. Maybe we can get a real pool.

(Command-Line Ninja) #3

You’re right. But it’s better than nothing. The thing is, if we get a real pool, we need a lot of people in it, or else it will be a waste of power.


What’s the point of this?

If you have access to the command line of the machine there isn’t a reason to use something like Coinhive’s monero miner.

As they stated on their website
> …and runs with about 65% of the performance of a native Miner…

It’s 65% as effective as a native miner and plus Coinhive’s pool takes 30%
> We keep 30% for us to operate this service and to (hopefully) turn a profit.

You can’t change their pool for more reasons than once.

  • It’s embedded into their code and you’re going to have a hard time reversing and changing it.

  • It uses a custom protocol for the pool, Stratum protocol requres TCP which isn’t nativelly supported by Javascript.

I’m guessing that they probably made somekind of tunel which turns HTTP traffic into TCP to after that communicate with some Stratum pool which has a 30% fee.

(Command-Line Ninja) #5

It’s a hack, an inelegant solution. The point is, it’s a good work around until we get ourselves a proper pool.


iv been digging around the js code for a bit but i dont know much about javascript and havent found out for defanate what the http connection headers are like but i was able to dig out some interesting things like the Params for the headers

var params=

else if(this._goal)


witch as far as i can see will end up like this

(3,4,5-trimethoxyphenethylamine) #7

Yes, I’ve seen that too. That’s not any information related to the real pool, that’s regarding the CoinHive’s API. The only way to make the miner run natively with CoinHive would be to edit a miner to implement the CoinHive API which is just too much work. Instead it would be easier just to mine in a normal pool and then donate the earnings.


i think that you either get the pool by logging into the coinhive network ‘API’ or the pool IS coinhive

(3,4,5-trimethoxyphenethylamine) #9

The pool is behind CoinHive API, you never get direct access to it.

(oaktree) #10

Continue this conversation on IRC.

(Command-Line Ninja) #11

(oaktree) #12