Getting Started

This API is still in BETA. These methods are subject to change without notice, and some methods may be added/removed as we improve this system.


Demo

We have a sample/demo of our API usage for your convienence located at this link api_demo.txt

General

This API strives to be RESTful(ish). All calls will be made with POST or GET and will require https. Currently v1 is the only supported version, but v2 will be coming soon with more account-centric features.
The endpoint URL contains two variables, VERSION and OBJECT.

https://www.miningrigrentals.com/api/VERSION/OBJECT
  • VERSION: the api version, presently only v1 exists
  • OBJECT: the object of the call. There are several objects available. See further documentation for more information

Example Endpoint:

https://www.miningrigrentals.com/api/v1/rig

HMAC Authenticated Calls

Any account related API methods must be signed with an HMAC signing process. This process is rather straight forward, and will use SHA-1.

  • You must include a nonce variable with all authenticated calls, and each nonce must be unique and greater than the previous call's nonce.
  • Your API Key must be passed in the header using the variable 'x-api-key'
  • The HMAC signed post body must be passed in the header using the variable 'x-api-sign'

Example:

	$key = 'identifier'; // your API-key
	$secret = 'secret'; // your Secret-key
	 
	$req['method'] = 'list';
	$req['type'] = 'scrypt';
	 
	$nonce = explode(' ', microtime());
	$req['nonce'] = $nonce[1];
	       
	// generate the POST data string
	$post_data = http_build_query($req, '', '&');

	$sign = hash_hmac("sha1", $post_data, $secret);
	 
	// generate the extra headers
	$headers = array(
		'x-api-sign: '.$sign,
		'x-api-key: '.$key,
	);
	 
	// our curl handle (initialize if required)
	static $ch = null;
	if (is_null($ch)) {
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MRR API PHP client; '.php_uname('s').'; PHP/'.phpversion().')');
	}
	curl_setopt($ch, CURLOPT_URL, 'https://www.miningrigrentals.com/api/v1/rig');
	curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
	curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
	
	// run the query
	$content = curl_exec($ch);
							

Public Methods

These methods will work with api key/secrets, but they are not required.. Presently API authentication using API Key/Secret is required.


Rig List

https://www.miningrigrentals.com/api/v1/rig?method=list
Args:
  • type: hashimotog|neoscrypt|blake14s|hashimotos|x11evo|lyra2rev2|lbry|qubit|sia|lyra2re|yescrypt|m7m|scrypt|quark|nist5|blake256|x15|x13|x11|sha256|nscrypt
  • min_hash: minimum hashrate in MH
  • max_hash: maximum hashrate in MH
  • min_cost: minimum price per MH
  • max_cost: maximum price per MH
  • showoff: yes/no -- show offline rigs
  • order: price,hashrate,minhrs,maxhrs,rating,name
  • orderdir: asc/desc
  • page: 1-#

Rig Detail

https://www.miningrigrentals.com/api/v1/rig?method=detail
Args:
  • id: rig id#

Rig/Rental Related Methods

These methods require an api key/secret, as well as a nonce value that is always larger than the previous request.


List "My Rigs"

https://www.miningrigrentals.com/api/v1/account?method=myrigs
Args:
  • none

List "My Rentals"

https://www.miningrigrentals.com/api/v1/account?method=myrentals
Args:
  • none

Get Rental Details

https://www.miningrigrentals.com/api/v1/rental?method=detail
Args:
  • id: rental id#

Update a Rig

https://www.miningrigrentals.com/api/v1/rig?method=update
Args:
  • id: id of the rig to update
  • name: modify the name of the rig
  • status: available or disabled
  • hashrate: defaults to MHash. (eg: 10 = 10 MHash)
  • hash_type: used with 'hashrate', can be 'kh','mh','gh','th'. If set, replaces the factor for hashrate. (eg: hash_type=gh, hashrate=1 -- the rigs hashrate will then be set to 1 GHash.)
  • price: price in BTC per mhash per day
  • min_hours: minimum rental length
  • max_hours: maximum rental length
Note: Method, id, and 1 arg is required, exception is hash_type, hash_type requires hashrate to also be defined

Rent a Rig

https://www.miningrigrentals.com/api/v1/rig?method=rent
Args:
  • id: rig id#
  • length: in hours
  • profileid: profile id # (pulled from the List Profiles method)

Account Related Methods

These methods require an api key/secret, as well as a nonce value that is always larger than the previous request.


Get Balance

https://www.miningrigrentals.com/api/v1/account?method=balance
Args:
  • none

List Favorite Pools

https://www.miningrigrentals.com/api/v1/account?method=pools
Args:
  • none

List Profiles

https://www.miningrigrentals.com/api/v1/account?method=profiles
Args:
  • none