### Install and Initialize miningrigrentals-api-v2 Source: https://context7.com/oipwg/miningrigrentals-api-v2/llms.txt Install the library using npm and initialize it with your MRR API key and secret. ```bash npm install miningrigrentals-api-v2 ``` ```javascript import MiningRigRentals from 'miningrigrentals-api-v2'; const mrr = new MiningRigRentals({ key: 'YOUR_MRR_API_KEY', secret: 'YOUR_MRR_API_SECRET' }); ``` -------------------------------- ### Install miningrigrentals-api-v2 with npm Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/README.md Install the latest version of the library from NPM and save it to your package.json. ```bash npm install miningrigrentals-api-v2 ``` -------------------------------- ### whoami() Source: https://context7.com/oipwg/miningrigrentals-api-v2/llms.txt Tests connectivity and returns your account identity. Sends an authenticated GET to `/whoami`. Use this to verify that your API key and secret are correct and that the library is properly initialized. ```APIDOC ## whoami() ### Description Tests connectivity and returns your account identity. Sends an authenticated GET to `/whoami`. Use this to verify that your API key and secret are correct and that the library is properly initialized. ### Method GET ### Endpoint /whoami ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (object) - Contains account identity information if successful. ### Request Example ```javascript import MiningRigRentals from 'miningrigrentals-api-v2'; const mrr = new MiningRigRentals({ key: process.env.API_KEY, secret: process.env.API_SECRET }); (async () => { try { const res = await mrr.whoami(); if (res.success) { console.log('Authenticated as:', res.data); // { success: true, data: { username: 'myuser', ... } } } } catch (err) { console.error('Auth failed:', err.message); // "Unable to GET /whoami: 403 Forbidden | {\"success\":false,...}" } })(); ``` ``` -------------------------------- ### Get Servers Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.html Retrieves a list of all available MiningRigRentals rig servers. ```APIDOC ## getServers() ### Description Get a list of MRR rig servers. ### Method GET ### Endpoint /servers ### Response #### Success Response (200) - **servers** (Array.) - List of rig servers. ``` -------------------------------- ### Test API Connectivity with whoami() Source: https://context7.com/oipwg/miningrigrentals-api-v2/llms.txt Use the `whoami()` method to verify your API key and secret are correct and the library is initialized. It sends an authenticated GET request to /whoami. ```javascript import MiningRigRentals from 'miningrigrentals-api-v2'; const mrr = new MiningRigRentals({ key: process.env.API_KEY, secret: process.env.API_SECRET }); (async () => { try { const res = await mrr.whoami(); if (res.success) { console.log('Authenticated as:', res.data); // { success: true, data: { username: 'myuser', ... } } } } catch (err) { console.error('Auth failed:', err.message); // "Unable to GET /whoami: 403 Forbidden | {\"success\":false,...}" } })(); ``` -------------------------------- ### Get Account Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.js.html Retrieves general information about the user's account. ```APIDOC ## GET /account ### Description Retrieve account information. ### Method GET ### Endpoint /account ### Response #### Success Response (200) - **data** (Object) - Account information ``` -------------------------------- ### Get All Algorithms with getAlgos() Source: https://context7.com/oipwg/miningrigrentals-api-v2/llms.txt Fetch all supported mining algorithms and their market statistics, including suggested prices and rental activity. Optionally filter by a specific algorithm or currency. ```javascript // All algos, default BTC pricing const allAlgos = await mrr.getAlgos(); // Scrypt stats priced in DASH const scryptDash = await mrr.getAlgos('scrypt', 'DASH'); // scryptDash.data[].suggested_price.currency === 'DASH' // All algos with ETH pricing const ethPriced = await mrr.getAlgos('', 'ETH'); console.log('Suggested ETH price for scrypt:', scryptDash.data[0].suggested_price.amount); ``` -------------------------------- ### Get Rentals Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.html Lists rentals based on specified options, allowing filtering by type, algorithm, history, rig, and pagination. ```APIDOC ## getRentals(options) ### Description Lists rentals. ### Method GET ### Endpoint /rentals ### Parameters #### Query Parameters - **options** (Object) - Optional - Input fields/query parameters. - **type** (string) - Optional - Renter type. Options: [owner, renter]. 'owner' means rentals on your rigs, 'renter' means rentals you purchased. - **algo** (string) - Optional - Filter by algorithm. See /info/algos for available algorithms. - **history** (boolean) - Optional - true = Show completed rentals, false = Active rentals. Defaults to false. - **rig** (number) - Optional - Show rentals related to a specific rig ID. - **start** (number) - Optional - Start number for pagination. Defaults to 0. - **limit** (number) - Optional - Limit number for pagination. Defaults to 25. ### Response #### Success Response (200) - **rentals** (Array.) - List of rentals matching the criteria. ``` -------------------------------- ### getAlgos(algo?, currency?) Source: https://context7.com/oipwg/miningrigrentals-api-v2/llms.txt Gets all algorithms and their market statistics. Returns all supported mining algorithms with suggested prices, hash unit info, and current rental activity. Optionally filter to a specific algo or currency. ```APIDOC ## getAlgos(algo?, currency?) ### Description Gets all algorithms and their market statistics. Returns all supported mining algorithms with suggested prices, hash unit info, and current rental activity. Optionally filter to a specific algo or currency. ### Method GET ### Endpoint /algos ### Parameters #### Query Parameters - **algo** (string) - Optional - Filter by a specific algorithm name. - **currency** (string) - Optional - Filter by a specific currency for pricing. ### Response #### Success Response (200) - **data** (array) - An array of algorithm objects, each containing pricing and market statistics. ### Request Example ```javascript // All algos, default BTC pricing const allAlgos = await mrr.getAlgos(); // Scrypt stats priced in DASH const scryptDash = await mrr.getAlgos('scrypt', 'DASH'); // scryptDash.data[].suggested_price.currency === 'DASH' // All algos with ETH pricing const ethPriced = await mrr.getAlgos('', 'ETH'); console.log('Suggested ETH price for scrypt:', scryptDash.data[0].suggested_price.amount); ``` ``` -------------------------------- ### Get Rigs By ID Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.html Retrieves information for one or more rigs specified by their IDs. ```APIDOC ## getRigsByID(rigIDs) ### Description Get 1 or more rigs by ID. ### Method GET ### Endpoint /rigs/{rigIDs} ### Parameters #### Path Parameters - **rigIDs** (number | Array.) - Required - Rig IDs. ### Response #### Success Response (200) - **rigs** (Array.) - List of rigs matching the provided IDs. ``` -------------------------------- ### Get Account Balance Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.js.html Retrieves the balance information for the user's account. ```APIDOC ## GET /account/balance ### Description Retrieve account balances. ### Method GET ### Endpoint /account/balance ### Response #### Success Response (200) - **data** (Object) - Account balance information ``` -------------------------------- ### Get Rigs Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.html Searches for rigs based on specified criteria. This is identical to the main rig list pages. ```APIDOC ## getRigs(options) ### Description Search for rigs on a specified algo. This is identical to the main rig list pages. ### Method GET ### Endpoint /rigs ### Parameters #### Query Parameters - **type** (string) - Required - Rig type, e.g., sha256, scrypt, x11, etc. - **minhours** (Object) - Optional - Filter the minimum hours of the rig. - **min** (number) - Optional - Minimum hours. - **max** (number) - Optional - Maximum hours. - **maxhours** (Object) - Optional - Filter the maximum hours of the rig. - **min** (number) - Optional - Minimum hours. - **max** (number) - Optional - Maximum hours. - **rpi** (Object) - Optional - Filter the RPI score. - **min** (number) - Optional - Minimum RPI. - **max** (number) - Optional - Maximum RPI. - **hash** (Object) - Optional - Filter the hashrate. - **min** (number) - Optional - Minimum hashrate. - **max** (number) - Optional - Maximum hashrate. - **type** (string) - Optional - The hash type of min/max. Defaults to "mh". Possible values: [hash, kh, mh, gh, th]. - **price** (Object) - Optional - Filter the price. - **min** (number) - Optional - Minimum price. - **max** (number) - Optional - Maximum price. - **offline** (boolean) - Optional - To show or not to show offline rigs. Defaults to false. - **rented** (boolean) - Optional - To show or not to show rented rigs. Defaults to false. - **region** (Object) - Optional - Filter the region. - **type** (string) - Optional - Determines if this filter is an inclusive or exclusive filter. Possible options are [include, exclude]. - **region_value** (string) - Optional - A region to include/exclude. - **count** (number) - Optional - Number of results to return. Max is 100. Defaults to 100. - **offset** (number) - Optional - What result number to start with, returning COUNT results. Defaults to 0. - **order** (string) - Optional - Field to order the results by. Defaults to "score". Possible values: [rpi, hash, price, minhrs, maxhrs, score]. - **orderdir** (string) - Optional - Order direction. Defaults to "asc". ### Response #### Success Response (200) - **rigs** (Array.) - List of rigs matching the criteria. ``` -------------------------------- ### Get Account Balances with getAccountBalance() Source: https://context7.com/oipwg/miningrigrentals-api-v2/llms.txt Retrieve your current account balances across all supported currencies (BTC, LTC, ETH, DASH). ```javascript const res = await mrr.getAccountBalance(); // { success: true, data: { BTC: { confirmed: '0.00500000', unconfirmed: '0' }, ... } } console.log('BTC balance:', res.data.BTC.confirmed); ``` -------------------------------- ### Get Rigs Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.js.html Retrieves a list of available mining rigs with various filtering and sorting options. ```APIDOC ## GET /rig ### Description Retrieves a list of available mining rigs based on specified options. ### Method GET ### Endpoint /rig ### Parameters #### Query Parameters - **options.price.min** (number) - Optional - Minimum price filter. - **options.price.max** (number) - Optional - Maximum price filter. - **options.offline** (boolean) - Optional - Whether to show offline rigs (defaults to false). - **options.rented** (boolean) - Optional - Whether to show rented rigs (defaults to false). - **options.region** (Object) - Optional - Filter by region. - **options.region.type** (string) - Optional - Type of region filter ('include' or 'exclude'). - **options.region.** (boolean) - Optional - A specific region to include or exclude. - **options.count** (number) - Optional - Number of results to return (max 100, defaults to 100). - **options.offset** (number) - Optional - Starting result number for pagination (defaults to 0). - **options.order** (string) - Optional - Field to order results by (e.g., 'score', 'hash', 'price', defaults to 'score'). - **options.orderdir** (string) - Optional - Order direction ('asc' or 'desc'). ### Response #### Success Response (200) - **data** (Object) - Contains the list of rigs matching the criteria. #### Response Example { "example": "{\"rigs\": [...], \"total\": 100}" } ``` -------------------------------- ### Get Rental By ID Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.html Retrieves detailed information about rentals using their specific IDs. ```APIDOC ## getRentalById(ids) ### Description Get information on rentals by rental ID. ### Method GET ### Endpoint /rentals/{ids} ### Parameters #### Path Parameters - **ids** (number | Array.) - Required - Rental IDs. ### Response #### Success Response (200) - **rentals** (Array.) - List of rentals matching the provided IDs. ``` -------------------------------- ### Get Pools From Rigs Source: https://context7.com/oipwg/miningrigrentals-api-v2/llms.txt List the pools that are currently assigned to one or more rigs. Returns a mapping of rig IDs to their assigned pools. ```javascript const res = await mrr.getPoolsFromRigs([101619, 98881]); // { success: true, data: { 101619: [...pools...], 98881: [...pools...] } } ``` -------------------------------- ### Get Pools by Rental ID Source: https://context7.com/oipwg/miningrigrentals-api-v2/llms.txt List the pools assigned to one or more rentals. Returns a mapping of rental IDs to their assigned pool configurations. ```javascript const res = await mrr.getPoolsByRentalID([1750630]); // { success: true, data: { 1750630: [{ priority: 0, host: '...', ... }] } } ``` -------------------------------- ### Get Rigs by ID Source: https://context7.com/oipwg/miningrigrentals-api-v2/llms.txt Fetches details for one or more rigs using their unique IDs. Accepts a single rig ID or an array of IDs. ```javascript // Single rig const single = await mrr.getRigsByID(101619); // Multiple rigs const multi = await mrr.getRigsByID([101619, 98881]); // { success: true, data: [{ id: 101619, name: '...', status: 'available', ... }, ...] } ``` -------------------------------- ### getAlgo(algo, currency?) Source: https://context7.com/oipwg/miningrigrentals-api-v2/llms.txt Gets statistics for a single algorithm. Identical to `getAlgos` but scoped to a specific algorithm name. Returns a single object instead of an array. ```APIDOC ## getAlgo(algo, currency?) ### Description Gets statistics for a single algorithm. Identical to `getAlgos` but scoped to a specific algorithm name. Returns a single object instead of an array. ### Method GET ### Endpoint /algos/{algo} ### Parameters #### Path Parameters - **algo** (string) - Required - The name of the algorithm to retrieve statistics for. #### Query Parameters - **currency** (string) - Optional - The currency to use for pricing statistics. ### Response #### Success Response (200) - **data** (object) - An object containing the statistics for the specified algorithm. ### Request Example ```javascript // Scrypt stats in BTC (default) const scrypt = await mrr.getAlgo('scrypt'); console.log('Scrypt suggested price (BTC):', scrypt.data.suggested_price.amount); // X11 stats in LTC const x11 = await mrr.getAlgo('x11', 'LTC'); console.log('X11 available hash:', x11.data.stats.rented_hash); ``` ``` -------------------------------- ### initAPI Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.html Initializes the API connection with provided settings. ```APIDOC ## initAPI ### Description Initializes the API connection with provided settings. ### Method POST ### Endpoint /initapi ### Parameters #### Request Body - **key** (string) - Required - Your MiningRigRentals API key. - **secret** (string) - Required - Your MiningRigRentals API secret. ``` -------------------------------- ### Create a New Rig - JavaScript Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.js.html Use this method to create a new rig. Ensure all required options are provided. ```javascript async createRig(options) { let endpoint = `/rig`; let params = {}; if (options) { for (let opt in options) { params[opt] = options[opt] } } let api = this.initAPI(endpoint, params); try { return (await api.put(endpoint)).data; } catch (err) { throw this.createError(endpoint, 'PUT', err) } } ``` -------------------------------- ### Get Pools Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.js.html Retrieves a list of saved pools. ```APIDOC ## GET /account/pool ### Description Retrieves a list of saved pools. ### Method GET ### Endpoint /account/pool ### Response #### Success Response (200) - **data** (Object) - Contains a list of saved pools. ``` -------------------------------- ### Get Pools by ID Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.js.html Retrieves one or more saved pools by their IDs. ```APIDOC ## Get Pools by ID ### Description Retrieves one or more saved pools by their IDs. ### Method GET ### Endpoint `/account/pool/{ids}` ### Parameters #### Path Parameters - **ids** (number|Array) - Required - Pool IDs to retrieve. ### Response #### Success Response (200) - **pools** (Array) - An array of pool objects. #### Response Example { "pools": [ { "id": 1, "type": "sha256", "name": "My Pool", "host": "pool.example.com", "port": 3333, "user": "myuser", "pass": "x", "notes": "Notes about the pool" } ] } ``` -------------------------------- ### Get Pool Profile Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.js.html Retrieves a specific pool profile by its ID. ```APIDOC ## GET /account/profile/{id} ### Description Retrieves a specific pool profile by its ID. ### Method GET ### Endpoint /account/profile/{id} ### Parameters #### Path Parameters - **id** (number) - Required - ID of the pool profile ### Response #### Success Response (200) - **data** (Object) - Contains details of the specified pool profile. ``` -------------------------------- ### Create a New Rig Listing Source: https://context7.com/oipwg/miningrigrentals-api-v2/llms.txt Use this method to create a new rig listing. Specify rig details like name, type, server, hash rate, pricing, and rental duration. ```javascript const res = await mrr.createRig({ name: 'My Scrypt Rig', type: 'scrypt', server: 'us-west01.miningrigrentals.com', hash: { hash: 5000, type: 'mh' }, minhours: 3, maxhours: 24, price: { btc: { price: '0.0003', autoprice: false }, ltc: { enabled: true, autoprice: true }, type: 'mh' } }); // { success: true, data: { id: 112233, name: 'My Scrypt Rig', ... } } console.log('Created rig ID:', res.data.id); ``` -------------------------------- ### createRental Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.html Creates a new rental for a rig with specified options including duration, profile, and currency. ```APIDOC ## createRental(options) ### Description Create a new rental. ### Parameters #### Request Body - **options** (Object) - Required - **rig** (number) - Required - Rig ID to rent - **length** (number) - Required - Length in hours to rent - **profile** (number) - Required - The profile ID to apply (see /account/profile) - **currency** (string) - Optional - 'BTC' - Currency to use -- one of [BTC,LTC,ETH,DASH] - **rate** (Object) - Optional - **type** (string) - Optional - 'mh' - The hash type of rate. defaults to "mh", possible values: [hash,kh,mh,gh,th] - **price** (number) - Optional - Price per [rate.type] per day to pay -- this is a filter only, it will use the rig's current price as long as it is <= this value ### Returns Type: Promise. ``` -------------------------------- ### Get Saved Pools Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.js.html Retrieves a list of all saved pools associated with the account. ```javascript async getPools() { let endpoint = `/account/pool`; let api = this.initAPI(endpoint); try { return (await api.get(endpoint)).data; } catch (err) { throw this.createError(endpoint, 'GET', err) } } ``` -------------------------------- ### Get Specific Pool Profile Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.js.html Retrieves a specific pool profile by its ID. ```javascript async getPoolProfile(id) { let endpoint = `/account/profile/${id}`; let api = this.initAPI(endpoint); try { return (await api.get(endpoint)).data; } catch (err) { throw this.createError(endpoint, 'GET', err) } } ``` -------------------------------- ### List My Rigs Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.js.html Lists the rigs owned by the authenticated user, with options to filter by algorithm and calculate hashrates. ```APIDOC ## GET /rig/mine ### Description Lists the mining rigs owned by the user. ### Method GET ### Endpoint /rig/mine ### Parameters #### Query Parameters - **options.type** (string) - Optional - Filter rigs by algorithm type (e.g., 'scrypt', 'sha256'). - **options.hashrate** (boolean) - Optional - Calculate and display hashrates for the rigs (defaults to false). ### Response #### Success Response (200) - **data** (Object) - Contains the list of the user's rigs. #### Response Example { "example": "{\"myRigs\": [...], \"total\": 5}" } ``` -------------------------------- ### Search Available Rigs on Marketplace Source: https://context7.com/oipwg/miningrigrentals-api-v2/llms.txt Queries the public rig marketplace for available rigs. Supports filtering by algorithm, hashrate, price, region, and other parameters. Useful for finding rigs to rent. ```javascript const res = await mrr.getRigs({ type: 'scrypt', rpi: { min: 60, max: 100 }, hash: { min: 10000, max: 100000, type: 'mh' }, price: { max: 0.005 }, offline: false, rented: false, order: 'score', orderdir: 'asc', count: 20, offset: 0 }); // { success: true, data: { records: [...], total: 150, count: 20, offset: 0 } } res.data.records.forEach(r => console.log(`Rig ${r.id}: ${r.name} @ ${r.price.BTC.price} BTC/MH/day`)); ``` -------------------------------- ### Initialize Axios API Instance Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.js.html Initializes a new Axios instance configured with the base URL, API key, HMAC signature, nonce, and request parameters. Supports specifying the API version and includes a serializer for query parameters. ```javascript initAPI(endpoint, params, version = v2) { let nonce = this.generateNonce(); let hmac_digest = this.createHMACSignature(endpoint, nonce, version, params); if (version === v1) { params = {...params, nonce} } return ( new axios.create({ baseURL: `${this.baseURL}${version}/`, headers: { 'x-api-key': this.key, 'x-api-sign': hmac_digest, 'x-api-nonce': nonce, 'Access-Control-Allow-Origin': '*', }, params: params, paramsSerializer: params => { return qs.stringify(params, {arrayFormat: 'repeat'}) }, }) ) } ``` -------------------------------- ### Get Algo Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.js.html Retrieves statistics for a specific algo, with optional currency filtering. ```APIDOC ## GET /info/algos/{algo} ### Description Get statistics for an algo (suggested price, unit information, current rented hash/etc). ### Method GET ### Endpoint /info/algos/{algo} ### Query Parameters - **currency** (string) - Optional - Currency to use for price info. Options: BTC, ETH, LTC, DASH ### Response #### Success Response (200) - **data** (Object) - Algo statistics ``` -------------------------------- ### Get Algos Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.js.html Retrieves a list of all algos and their statistics, with optional currency filtering. ```APIDOC ## GET /info/algos/{algo} ### Description Get all algos and statistics for them (suggested price, unit information, current rented hash/etc). ### Method GET ### Endpoint /info/algos/{algo} ### Query Parameters - **currency** (string) - Optional - Currency to use for price info. Options: BTC, ETH, LTC, DASH ### Response #### Success Response (200) - **data** (Object) - Algo statistics ``` -------------------------------- ### Create a New Rental Source: https://context7.com/oipwg/miningrigrentals-api-v2/llms.txt Initiate a new rental for a specified rig and duration. Requires rig ID, rental length in hours, pool profile ID, currency, and rate details. ```javascript const res = await mrr.createRental({ rig: 98881, length: 6, // hours profile: 23136, // pool profile ID to apply currency: 'BTC', rate: { type: 'mh', price: 0.0005 // max price willing to pay per MH/day } }); // { success: true, data: { id: 1800000, rig: { id: 98881 }, ... } } console.log('Rental started, ID:', res.data.id); ``` -------------------------------- ### Create Rig Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.js.html Creates a new mining rig listing on the platform. ```APIDOC ## POST /rig ### Description Creates a new mining rig listing. ### Method POST ### Endpoint /rig ### Parameters #### Request Body - **options.name** (string) - Required - The name of the rig. - **options.type** (string) - Required - The type of algorithm the rig mines (e.g., 'scrypt', 'sha256'). - **options.status** (string) - Optional - The status of the rig ('enabled' or 'disabled'). - **options.server** (string) - Required - The server name where the rig is located. - **options.price** (Object) - Optional - Pricing details for the rig. - **options.price.btc.price** (string|number) - Optional - Daily price in BTC. - **options.price.btc.autoprice** (boolean) - Optional - Enable automatic BTC pricing. - **options.price.btc.minimum** (string|number) - Optional - Minimum price for BTC autopricing (0 to disable). - **options.price.btc.modified** (string) - Optional - Percentage modification for BTC autopricing (e.g., '+10', '-5.13'). - **options.price.ltc.enabled** (boolean) - Optional - Enable LTC pricing (defaults to true). - **options.price.ltc.price** (string|number) - Optional - Daily price in LTC. - **options.price.ltc.autoprice** (boolean) - Optional - Enable automatic LTC pricing based on BTC price. - **options.price.eth.enabled** (boolean) - Optional - Enable ETH pricing (defaults to true). - **options.price.eth.price** (string|number) - Optional - Daily price in ETH. - **options.price.eth.autoprice** (boolean) - Optional - Enable automatic ETH pricing based on BTC price. - **options.price.dash.enabled** (boolean) - Optional - Enable DASH pricing (defaults to true). - **options.price.dash.price** (string) - Optional - Daily price in DASH. - **options.price.dash.autoprice** (boolean) - Optional - Enable automatic DASH pricing based on BTC price. - **options.price.type** (string) - Optional - The unit for hash price (e.g., 'mh', 'gh', defaults to 'mh'). - **options.minhours** (number) - Optional - Minimum rental hours available. - **options.maxhours** (number) - Optional - Maximum rental hours available. - **options.hash** (Object) - Optional - Hash rate information. - **options.hash.hash** (string|number) - Required - The amount of hash power the rig provides. ### Request Example { "example": "{\"name\": \"My Rig\", \"type\": \"scrypt\", \"server\": \"us-east-1\", \"hash\": { \"hash\": 1000 } }" } ### Response #### Success Response (200) - **data** (Object) - Confirmation of rig creation. #### Response Example { "example": "{\"success\": true, \"rigId\": 123}" } ``` -------------------------------- ### getServers Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.html Retrieves a list of available servers. ```APIDOC ## getServers ### Description Retrieves a list of available servers. ### Method GET ### Endpoint /server/getservers ``` -------------------------------- ### Get Pools From Rigs Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.html Lists pools that are assigned to one or more specified rig IDs. ```APIDOC ## getPoolsFromRigs(rigIDs) ### Description List pools assigned to one or more rigs. ### Method GET ### Endpoint /rigs/{rigIDs}/pools ### Parameters #### Path Parameters - **rigIDs** (number | Array.) - Required - Rig IDs. ### Response #### Success Response (200) - **pools** (Array.) - List of pools assigned to the specified rigs. ``` -------------------------------- ### createRig Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.html Creates a new rig with specified configuration including name, type, pricing, and hashing power. ```APIDOC ## createRig(options) ### Description Create a Rig. ### Parameters #### Request Body - **options** (Object) - Optional - **name** (string) - Required - Name of rig - **type** (string) - Required - Type of rig (scrypt, sha256, x11, etc) - **status** (string) - Optional - "enabled","disabled" - **server** (string) - Required - Server name -- see /info/servers - **price** (Object) - Optional - **btc.price** (string) - Optional - Price of the rig per price.type per day (BTC) - **btc.autoprice** (boolean) - Optional - Enable BTC autopricing - **btc.minimum** (string | number) - Optional - Minimum price for the autopricer -- 0 to disable - **btc.modified** (string) - Optional - Percent +/- to modify the autopricing (eg: +10 or -5.13 is 10% over or 5.13% under market rates, respectively), 0 to disable - **ltc.enabled** (boolean) - Optional - true - **ltc.price** (string | number) - Optional - Price of the rig per price.type per day (LTC) - **ltc.autoprice** (boolean) - Optional - Enable LTC autopricing -- adjusts the LTC rate based on your BTC price and the GDAX market rate - **eth.enabled** (string) - Optional - true - **eth.price** (string | number) - Optional - Price of the rig per price.type per day (ETH) - **eth.autoprice** (boolean) - Optional - Enable ETH autopricing -- adjusts the ETH rate based on your BTC price and the GDAX market rate - **dash.enabled** (string) - Optional - true - **dash.price** (string) - Optional - Price of the rig per price.type per day (DASH) - **dash.autoprice** (boolean) - Optional - Enable DASH autopricing -- adjusts the DASH rate based on your BTC price and the GDAX market rate - **type** (string) - Optional - 'mh' - The hash type of hash.. defaults to "mh" possible values: [hash,kh,mh,gh,th] - **minhours** (number) - Optional - Minimum number of hours available - **maxhours** (number) - Optional - Maximum number of hours available - **hash** (Object) - Optional - **hash** (string | number) - Required - Amount of hash to advertise - **type** (string) - Required - 'mh' - The hash type of hash.. defaults to "mh" possible values: [hash,kh,mh,gh,th] ### Returns Type: Promise. ``` -------------------------------- ### createRental Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.html Creates a new rental. ```APIDOC ## createRental ### Description Creates a new rental. ### Method POST ### Endpoint /account/rental/createrental ### Parameters #### Request Body - **rig_id** (string) - Required - The ID of the rig to rent. - **pool_id** (string) - Required - The ID of the pool to use for the rental. - **duration** (string) - Required - The duration of the rental in hours. - **price** (string) - Required - The price of the rental. ``` -------------------------------- ### Get Pools By Rental ID Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.html Lists pools that are assigned to one or more specified rental IDs. ```APIDOC ## getPoolsByRentalID(rentalIDs) ### Description List pools assigned to one or more rentals. ### Method GET ### Endpoint /rentals/{rentalIDs}/pools ### Parameters #### Path Parameters - **rentalIDs** (number | Array.) - Required - Rental IDs. ### Response #### Success Response (200) - **pools** (Array.) - List of pools assigned to the specified rentals. ``` -------------------------------- ### createRig Source: https://context7.com/oipwg/miningrigrentals-api-v2/llms.txt Creates a new rig listing with specified options. ```APIDOC ## createRig(options) ### Description Creates a new rig listing. ### Method Not specified (assumed to be a client-side SDK method) ### Parameters - **options** (object) - Required - Configuration for the new rig. - **name** (string) - Required - The name of the rig. - **type** (string) - Required - The type of algorithm the rig supports (e.g., 'scrypt'). - **server** (string) - Required - The server address for the rig. - **hash** (object) - Required - Hashing information. - **hash** (number) - Required - The hash rate. - **type** (string) - Required - The unit of the hash rate (e.g., 'mh'). - **minhours** (number) - Required - Minimum rental duration in hours. - **maxhours** (number) - Required - Maximum rental duration in hours. - **price** (object) - Required - Pricing information. - **btc** (object) - Optional - Bitcoin pricing details. - **price** (string) - Required - The price in BTC. - **autoprice** (boolean) - Required - Whether to use autopricing. - **ltc** (object) - Optional - Litecoin pricing details. - **enabled** (boolean) - Required - Whether LTC pricing is enabled. - **autoprice** (boolean) - Required - Whether to use autopricing. - **type** (string) - Required - The unit of price (e.g., 'mh'). ### Request Example ```javascript const res = await mrr.createRig({ name: 'My Scrypt Rig', type: 'scrypt', server: 'us-west01.miningrigrentals.com', hash: { hash: 5000, type: 'mh' }, minhours: 3, maxhours: 24, price: { btc: { price: '0.0003', autoprice: false }, ltc: { enabled: true, autoprice: true }, type: 'mh' } }); // { success: true, data: { id: 112233, name: 'My Scrypt Rig', ... } } console.log('Created rig ID:', res.data.id); ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **data** (object) - Contains the created rig details. - **id** (number) - The unique identifier of the created rig. - **name** (string) - The name of the rig. - ... (other rig properties) #### Response Example ```json { "success": true, "data": { "id": 112233, "name": "My Scrypt Rig", "type": "scrypt", "server": "us-west01.miningrigrentals.com", "hash": {"hash": 5000, "type": "mh"}, "minhours": 3, "maxhours": 24, "price": { "btc": {"price": "0.0003", "autoprice": false}, "ltc": {"enabled": true, "autoprice": true}, "type": "mh" } } } ``` ``` -------------------------------- ### Get Pools by Rental ID Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.js.html Retrieves the pool configurations associated with one or more specified rental IDs. ```APIDOC ## GET /rental/{rentalIDs}/pool ### Description Retrieves the pool configurations associated with one or more specified rental IDs. ### Method GET ### Endpoint /rental/{rentalIDs}/pool ### Parameters #### Path Parameters - **rentalIDs** (number|Array) - Required - Rental IDs. Can be a single ID or an array of IDs separated by semicolons. ### Response #### Success Response (200) - **data** (Object) - An object containing pool configuration details for the specified rentals. ``` -------------------------------- ### Initialize Authenticated Axios Instance Source: https://context7.com/oipwg/miningrigrentals-api-v2/llms.txt Creates an axios instance pre-configured with base URL and HMAC-signed headers. This is used internally by public methods and typically not called directly. ```javascript // Internal usage pattern (used by every public method): const api = mrr.initAPI('/rig/14'); // api.defaults.headers['x-api-key'] === mrr.key // api.defaults.headers['x-api-sign'] === '' // api.defaults.headers['x-api-nonce'] === ``` -------------------------------- ### Get Transactions Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.js.html Retrieves a list of account transactions, with optional filtering by rental ID or transaction ID. ```APIDOC ## GET /account/transactions ### Description Retrieves a list of account transactions. Can be filtered by rental ID or transaction ID. ### Method GET ### Endpoint /account/transactions ### Parameters #### Query Parameters - **rental** (number) - Optional - Filter to specific rental by ID - **txid** (string) - Optional - Filter to specific txid ### Response #### Success Response (200) - **data** (Object) - Contains transaction details ``` -------------------------------- ### Create Rental Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.js.html Initiates the creation of a new rental agreement for a specified rig, duration, and profile. ```APIDOC ## PUT /rental ### Description Initiates the creation of a new rental agreement for a specified rig, duration, and profile. ### Method PUT ### Endpoint /rental ### Parameters #### Request Body - **rig** (number) - Required - Rig ID to rent - **length** (number) - Required - Length in hours to rent - **profile** (number) - Required - The profile ID to apply (see /account/profile) - **currency** (string) - Optional - Currency to use -- one of [BTC,LTC,ETH,DASH] (default: 'BTC') - **rate** (Object) - Optional - Rate details for the rental - **rate.type** (string) - Optional - The hash type of rate. defaults to "mh", possible values: [hash,kh,mh,gh,th] - **rate.price** (number) - Optional - Price per [rate.type] per day to pay -- this is a filter only, it will use the rig's current price as long as it is <= this value ### Response #### Success Response (200) - **data** (Object) - An object confirming the rental creation. ``` -------------------------------- ### createRental Source: https://context7.com/oipwg/miningrigrentals-api-v2/llms.txt Creates a new rental for a rig for a specified duration and pool profile. ```APIDOC ## createRental(options) ### Description Rents a rig for a specified duration using a designated pool profile. ### Method Not specified (assumed to be a client-side SDK method) ### Parameters - **options** (object) - Required - Configuration for the new rental. - **rig** (number) - Required - The ID of the rig to rent. - **length** (number) - Required - The duration of the rental in hours. - **profile** (number) - Required - The ID of the pool profile to apply to the rental. - **currency** (string) - Required - The currency for the rental (e.g., 'BTC'). - **rate** (object) - Required - The pricing rate for the rental. - **type** (string) - Required - The unit of the rate (e.g., 'mh'). - **price** (number) - Required - The price per unit (e.g., price per MH/day). ### Request Example ```javascript const res = await mrr.createRental({ rig: 98881, length: 6, // hours profile: 23136, // pool profile ID to apply currency: 'BTC', rate: { type: 'mh', price: 0.0005 // max price willing to pay per MH/day } }); // { success: true, data: { id: 1800000, rig: { id: 98881 }, ... } } console.log('Rental started, ID:', res.data.id); ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **data** (object) - Contains the details of the created rental. - **id** (number) - The unique identifier of the created rental. - **rig** (object) - Information about the rented rig. - **id** (number) - The rig ID. - ... (other rental properties) #### Response Example ```json { "success": true, "data": { "id": 1800000, "rig": {"id": 98881}, "length": 6, "profile": 23136, "currency": "BTC", "rate": {"type": "mh", "price": 0.0005}, "start_time": 1678890000, "end_time": 1678911600 } } ``` ``` -------------------------------- ### Get Account Transactions Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.js.html Retrieves a list of account transactions, with options to filter by rental ID or transaction ID. ```javascript async getTransactions(options) { let endpoint = `/account/transactions`; let api = this.initAPI(endpoint, options); try { return (await api.get(endpoint)).data; } catch (err) { throw this.createError(endpoint, 'GET', err) } } ``` -------------------------------- ### getServers() Source: https://context7.com/oipwg/miningrigrentals-api-v2/llms.txt Lists all available MRR rig servers. Returns all server locations available on the MRR platform (e.g., `us-west01.miningrigrentals.com`). Use server names returned here when creating rigs. ```APIDOC ## getServers() ### Description Lists all available MRR rig servers. Returns all server locations available on the MRR platform (e.g., `us-west01.miningrigrentals.com`). Use server names returned here when creating rigs. ### Method GET ### Endpoint /servers ### Response #### Success Response (200) - **data** (array) - An array of server objects, each containing `name` and `region`. ### Request Example ```javascript const res = await mrr.getServers(); // res.data => [{ name: 'us-west01.miningrigrentals.com', region: 'us' }, ...] console.log('Available servers:', res.data); ``` ``` -------------------------------- ### Create Rig Source: https://github.com/oipwg/miningrigrentals-api-v2/blob/master/docs/MiningRigRentals.js.html Creates a new mining rig listing on the platform. Allows specifying various options related to the rig's hash power and pricing. ```APIDOC ## POST /rig ### Description Creates a new mining rig listing. ### Method PUT ### Endpoint /rig ### Parameters #### Request Body - **options** (Object) - Optional. Configuration for the rig. - **hash.type** (string) - Optional. The hash type of hash. Defaults to "mh". Possible values: [hash, kh, mh, gh, th]. ### Request Example ```json { "options": { "hash": { "type": "mh" } } } ``` ### Response #### Success Response (200) - **data** (Object) - Contains the response data from the API. ``` -------------------------------- ### List Available Rig Servers with getServers() Source: https://context7.com/oipwg/miningrigrentals-api-v2/llms.txt Retrieve a list of all available rig server locations on the MRR platform. Server names from this list are used when creating rigs. ```javascript const res = await mrr.getServers(); // res.data => [{ name: 'us-west01.miningrigrentals.com', region: 'us' }, ...] console.log('Available servers:', res.data); ```