Miningpool API

Basic Information

Interface Address

● Method for obtaining the key

a. Provide the mobile phone number registered on the Spider official website, contact the Spider staff to activate the third-party API permission, after successful activation, log in to the official website and you can see the "API Key Retrieval Entrance" under the personal center

● Online Environment

a. Official website online:https://www.spiderpool.com/

Description

● H、KH、MH、GH、TH、PH、EH,Hashrate units differ by 1000

Attention

● All interfaces are requested using private key signing and public key verification

● Unified request format

{
    "dataJson": "", 
    "accessKey": "", 
    "timestamp": 1628381288000,
    "sign": ""
}

For example, when accessing the /v2/addUser interface

{
    "dataJson": "{"userName":"test001","password":"123456"}",
    "accessKey": "D1504708600B44B499489C16CE7C32A5",
    "timestamp": 1628381288000,
    "sign": "N0n0iqKLUtssteqhbsOHGv2N7UaJh+YnPio90fciAM4hn2L82jAhafG/ynxdgFnBf2ZJ2R2C1d0uRvSNSHnEJKA8rvMx6ytQa2E4gpD8LG0kkdzYwgv9pyEFOGsS4+cUdV+nF/WJiPDRqfx8Cb0gPjBuCj+HboVx5++HOe2v+sA="
}

● Unified return format

{
    "code": "",
    "msg": "",
    "data": object,
}

code="SUCCESS" indicates a successful operation; any other responses indicate failure.

● Java Request Example

    long timestamp = System.currentTimeMillis();
    String spiderUrl = "https://cloudapi.spiderpool.com/v2/subaccount/createSubaccount";
    JSONObject jsonObject = new JSONObject();
    jsonObject.put("coin", "eth");
    jsonObject.put("subaccount", "chizg101");
    jsonObject.put("walletAddress", "0x9ed670910a8e5895428bb85e600d7d388a904a22");

    Map<String, Object> param = new HashMap<>();
    String dataJsonStr = jsonObject.toJSONString() + "|" + timestamp;
    String sign = RSACoder.sign(dataJsonStr.getBytes(StandardCharsets.UTF_8), privateKey);

    param.put("dataJson", jsonObject.toJSONString());
    param.put("accessKey", "5A842DAA0B8A4746B362FBF382A04CD9");
    param.put("timestamp", timestamp);
    param.put("sign", sign);

    String jsonBody = JSON.toJSONString(param);

    String reslut = HttpclientUtil.postRequest(spiderUrl, jsonBody,null,true);

● python Request Example

    import requests
    from Crypto.PublicKey import RSA
    from Crypto.Signature import PKCS1_v1_5
    from Crypto.Hash import MD5
    import base64
    import time
    import calendar
    datajson = "{'subAccountName':'test0414dan08','coin':'eth'}"
    timestamp = str(int(round(calendar.timegm(time.gmtime())*1000)))
    data = datajson + "|%s" % (timestamp)
    #Private key
    privatekey='''MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAJpigNWb2r6fbue9CfnaRyundft0WS4e/hhtdCef74UdH9stDtRidv24hieP7uXdq8KHVmzqAqiNVAHsg4WttwO9Fyz0YPuJZ/mXLqI0S4SOzGZ7hqErDOOF1Z9WE/ykapGAT/SBc5q0lLN6Z3iz7AygZYy4UxrH3cR2BsrUEyGnAgMBAAECgYBNTxpY3Uzyu//bh+xg849EKv2Hx8GIuPhg3x6VYR+eNvFm3e9ZJ12SvD5hvU/SR+jk5sS+kYh3Qx5YQEm0PUMxjyRkBpZUVitkBpRvBaQKfRvS9D65rUlUYhgHnyhwdvmIvJYob9dB+HkOgZMqEwWrWqe4B8E4i8ei9fwLkVSn0QJBAPHUljaXd4gvtkJVExlKB4u7irTEVjwTi9Nbh2pUWk3jgb1/Ua0kbNtQ0vEiBtQ6ROOSqbPoBCiH5YwR0KKjw2UCQQCjbj9Z98wUEXIao2EQ11U4T281B9vqUSYPBR4u7UVEDkeEyxL0gzXmqJc8pAmgCygSi0Ggg5xxD5TjoW+4xg4bAkEAjeE9qBXBiWMEuXIUXHf0aWTEgj3WojSNiplen2GSAbSCv9zc3IpMW3fV6qcd/pGZLTM04Vo0Zlskr8Mb9u/BiQJAcR60Nt+voAxbQFjprLB/ShShUsF31H4Kq8bNF4ofsXV4x0+QdTIEsvzqgYzBJMfUGtHMwP+X3yH72ns5S1m7FQJAKCWFdZzN9D+2HX7yZsc4/Q7l+J//LpZJjLsVhcDh3RGRU3QX6SzCWlLwOq4FX+nUYej2B3rr0ymr+tiy/k7fbQ==
    '''
    private_keyBytes = base64.b64decode(privatekey)
    prikey = RSA.importKey(private_keyBytes)
    signer = PKCS1_v1_5.new(prikey)
    hash_obj = MD5.new(data.encode('utf-8'))
    signtrue = base64.b64encode(signer.sign(hash_obj))
    sign = str(signtrue)[2:-1]
    url = "https://cloudapi.spiderpool.com/v2/subaccount/createSubaccount"
    data = {
        "dataJson": datajson,
        "accessKey": "5A842DAA0B8A4746B362FBF382A04CD9",
        "timestamp": timestamp,
        "sign": sign
    }
    result = requests.post(url,json=data)
    print(result.text)

● node Request Example

const http = require('http');
const crypto = require('crypto');
const privateKey = "MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAM8WblrosGzrRPSo+xBiL1zMCimpq64nqw66Wh4Z3lG1WIAfe+mes3oFzLsiOuPALCUZHbaMQ9fC7gcgQIL8PtlPRnuqxO1VrKDPE1hCN2cy+7HuSgWMrhnkgP11eVrDFEV4c9ugA1pl9e/4s2F3QCuCKCCrDh+lFTcwLOB+/jqbAgMBAAECgYEAme0ZX9c/c+Y4XgbQfvAMNlSvZSJpqsxveEYJwAAIYQGDY9CDITZGP3faImqiDTGFXpnZnRuLPe/1TzSo3vOxniuW2Bdyu7gn39b6/bmwveIUVzHG3K5VUMV5r8uGiFoPkbl9jQmBBluAWhPsEdMMibdW+WGXsMiLigVdocCDF9ECQQD7SQMY4op0UuaUjFY3oPs5zTXzupopMFxMFxIn4WnZYTruRXFnJnzS2r+Cm6t+TdjXES0kHjky2ml5FSVfVLMjAkEA0vkgZTh/jGFSQ619Fa3TYzSa8TNGw309pXnXWQRKJO6USmWKOfdONp1u0aN/QlsFCGi8OmjTxeL8KsNWAEHuKQJAHqWr/Af9LOzDdJCdH1HB8i3GC8DRdn6QczNJIpYKa9nA7ziG+TaneKv3OX2078Wc0bYllEcfYMVkocDjevoAkwJBAIuVCDnwB3N5cFQWlIujVhhs1ZZ/tnHgisjQtAnRLL0CnFoclDeFx9maj5dj9O6SCeJmaSK7+GEUrIIeeufwtwECQQCq5yGYqnuXHQSra6qSpoC+65AyROVdDhXWRPdroFFbtTdE9EdaKImgac4B2ARKMGsKSXNXSXStHneN1R7n+iX/"

const signer = (json) => {
    const privateKeys = "-----BEGIN PRIVATE KEY-----\n" + privateKey + "\n-----END PRIVATE KEY-----"
    const sign = crypto.createSign('md5');
    sign.update(json);
    return sign.sign(privateKeys, 'base64');
}

const jsonObject = JSON.stringify({
    queryTime: 1620732754
})
const timestamp = new Date().valueOf()
const dataJsonStr = `${jsonObject}|${timestamp}`
const sign = signer(dataJsonStr)
const postData = JSON.stringify({
    dataJson: jsonObject,
    accessKey: "AF7180A7203F49779052F1D1336EBE3C",
    timestamp: timestamp,
    sign: sign
});
const options = {
    hostname: 'https://cloudapi.spiderpool.com',
    path: '/v2/game/getData',
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Content-Length': Buffer.byteLength(postData)
    }
};
const req = http.request(options, (res) => {
    res.setEncoding('utf8');
    res.on('data', (chunk) => {
        console.log(`Response body: ${chunk}`);
    });
});
// Translate the data into the request body
req.write(postData);
req.end();

● PHP Request Example

$private = 'PRIVATE_KEY';
$dataJson = json_encode([
    'walletAddress' => 'eth_address',
    'subaccount' => 'sub_account_name',
    'coin' => 'eth',
]);
$timestamp = round(microtime(true) * 1000);
if (openssl_sign($dataJson . '|' . $timestamp, $signature, $private, OPENSSL_ALGO_MD5)) {
    $signature = base64_encode($signature);
    $httpClient = new \GuzzleHttp\Client(['timeout' => 10]);
    $response = $httpClient->post('https://cloudapi.spiderpool.com/v2/subaccount/createSubaccount', [
        \GuzzleHttp\RequestOptions::BODY => json_encode([
            'dataJson' => $dataJson,
            'accessKey' => 'ACCESS_KEY',
            'timestamp' => $timestamp,
            'sign' => $signature,
        ]),
    ]);

    dd($response->getBody()->getContents());
}
dd('fail');

API

Create Subaccount

Request AUTH

POST /v2/subaccount/createSubaccount

Parameters

NameTypeRequiredDefaultDescription

coin

String

true

-

Currency, e.g.,btc

subaccount

String

true

-

Subaccount (6-20 alphanumeric characters)

walletAddress

String

false

-

Wallet address (please fill in the address that complies with the chain environment)

  • Successful Response:

{
    "code": "SUCCESS"
}
  • Error Response:

{
    "code": "......", // INVALID_SUBACCOUNT / SUBACCOUNT_EXIST / IVAILD_WALLETADDRESS
    "msg": "......"
}

Create Subaccount

Request AUTH

POST /v2/subaccount/modifyWalletAddress

Parameters

NameTypeRequiredDefaultDescription

coin

String

true

-

Currency, e.g.,btc、eth

subaccount

String

true

-

Subaccount name

newWalletAddress

String

true

-

New wallet address(please fill in the address that complies with the rules according to the chain environment))

  • Correct Response:

{
    "code": "SUCCESS"
}
  • Error response:

{
    "code": "......", // INVALID_SUBACCOUNT / SUBACCOUNT_EXIST / IVAILD_WALLETADDRESS
    "msg": "......"
}

Observer Pattern

Request AUTH

POST /v2/subaccount/subAccountObserverLink

Parameters

NameTypeRequiredDefaultDescription

coin

String

true

-

Currency abbreviation, e.g.,btc

subaccount

String

true

-

Subaccount name

type

String

true

-

Type:newSign for adding、resetSign for resetting、deleteSign deleting

  • Correct Response:

{
	"code":"SUCCESS",
	"data":{
		"subaccount":"btctestchizg002",
		"sign":"v92480670d100d4c67f9e22d6ae612fd3e78aebb6e1b1fcdba994ba454ade6482",
		"coin":"btc"
	}
}
  • Error Response:

{
    "code": "......", // INVALID_SUBACCOUNT / SUBACCOUNT_EXIST / IVAILD_WALLETADDRESS
    "msg": "......"
}

Get Subaccount Profit Detail Information

Request AUTH

(The scheduled task starts at 4:30, it is recommended to fetch data after 5:30)

POST /v2/subaccount/getSubaccountProfitDetailInfo

Parameters

NameTypeRequiredDefaultDescription

coin

String

true

-

Currency abbreviation, e.g.,btc

subaccount

String

true

-

Subaccount name

startTimestamp

Integer

false

0

Query start timestamp (seconds)

endTimestamp

Integer

false

Current time Query end timestamp (seconds)

pageNumber

Integer

false

1

Page number

pageSize

Integer

false

10

Number of entries per page

  • Correct Response:

{
    "code": "SUCCESS",
    "data": {
        "total": 35,
        "dayProfitList": [
            {
                "dayDate": 1569600000000,
                "avgHashrate": "90057979829",
                "dayProfit": 0.647981779,
            },
            ......
        ]
    }
}

Get Subaccount Payment Record

Request AUTH

POST /v2/subaccount/getSubaccountPaymentRecord

Parameters

NameTypeRequiredDefaultDescription

coin

String

true

-

Currency abbreviation, e.g., btc

subaccount

String

true

-

Subaccount name

startTimestamp

Integer

false

0

Query start timestamp (milliseconds)

endTimestamp

Integer

false

currentTime

Query end timestamp (milliseconds)

pageNumber

Integer

false

1

Page number

pageSize

Integer

false

10

Number of entries per page

  • Correct Response:

{
    "code": "SUCCESS",
        "data": {
        "list": [
            {
                "paymentDate": 1564531200000, // Payment time
                "paymentAddress": "mv8W2k7UMkqbHbfbvRXcEzaehPGvZCmkV5" // Payment address
                "paymentMoney": 0.0666348000, // Payment amount
                "txId": "097a39595c261f141de2174d8639fd9c18122236b14f9d08c91e82aea2a87e61", // Transaction Id
            }
        ],
            "total": 1 // Total number of records
    }
}

Get subaccount hashrate detailed information

REQUEST AUTH

POST /v2/subaccount/getSubaccountHashrateDetailInfo

PARAMETERS

NameTypeRequiredDefaultDescription

coin

String

true

-

Abbreviation of the cryptocurrency, e.g.,btc,eth

subaccount

String

true

-

Subaccount name

mode

String

false

hourly

mode=hourly indicates a 24-hour chart, mode=daily indicates a 30-day chart

  • Correct response:

{
    "code": "SUCCESS",
    "data": {
         "coin": "btc",
         "subaccount": "btc_test001",
         "startTime": 1569674700000,
         "timeInterval": 3600, // 
         "hashrates": ["86989808092", "87758098015", "88708080889", "87167897971", ......],
    }
}

Get Subaccount Profit Information

Request AUTH

POST /v2/subaccount/getSubaccountProfitInfo

Parameters

NameTypeRequiredDefaultDescription

coin

String

true

-

Currency abbreviation, e.g.,btc,eth

subaccount

String

true

-

Subaccount name

  • Successful Response:

{
    "code": "SUCCESS",
    "data": {
            "yesterdayProfit": 0.61505330, // 24-hour profit
            "unpaidProfit": 0.57536600,    // Unpaid profit
            "totalProfit": 26.026078521,   // Total profit
            "dayEstimateProfit": 0.57536600 //profit for today
    }
}

Get Subaccount Day Profit Information

Request AUTH

POST /v2/sp/subaccount/getDayProfitDetailInfo

Parameters

NameTypeRequiredDefaultDescription

coin

String

true

-

Currency abbreviation, e.g.,btc,eth

subaccount

String

true

-

Subaccount name

timeStamp

int

true

UTC+0

  • Successful Response:

{
    "code": 200,
    "msg": "Success",
    "t": 1717677079167,
    "data": {
        "day": 1716854400,
        "coin": "btc",
        "userName": "test",
        "avgShareAccept": 6792538500482.84,
        "dayProfit": 0.0000052632731696429,
        "ppsDayProfit": 0.00000505032710936514,
        "pplnsDayProfit": 0.00000021294606027776,
        "difficult": "84381461788831"
    }
}

Get Subaccount Hour Profit Information

Request AUTH

POST /v2/sp/subaccount/getHourProfitDetailInfo

Parameters

NameTypeRequiredDefaultDescription

coin

String

true

-

Currency abbreviation, e.g.,btc,eth

subaccount

String

true

-

Subaccount name

timeStamp

int

true

UTC+0

  • Successful Response:

{
    "code": 200,
    "msg": "Success",
    "t": 1717677390714,
    "data": {
        "day": 1716861600,
        "coin": "btc",
        "userName": "test",
        "ppsDayProfit": 0.00000021294606027776
    }
}

Get Subaccount Information

Request AUTH

POST /v2/subaccount/getSubaccountInfo

Parameters

NameTypeRequiredDefaultDescription

coin

String

false

-

Currency abbreviation, e.g.,btc,eth

subaccount

String

false

-

Subaccount name

isGetSubaccountDetailInfo

Boolean

false

-

Whether to get details

  • Successful Response:

{
    "code": "SUCCESS", 
    "data": [
      {
        "coin": "btc",
        "subaccount": "test001",
        "walletAddress": "33Vxq5DN4vAXkv7swDp4zNZJWkazsDgwLq",
        "realtimeHashrate": "9789798686766", // Real-time hashrate
        "avgHashrate1440": "88667987952", // 24-hour average hashrate
        "activeWorkerNum": 100,//Number of active miners
        "inactiveWorkerNum": 10,//Number of inactive miners
     
      },
    ......
]
}

Get Subaccount Worker Information

Request AUTH

POST /v2/worker/getSubaccountWorkerDetailInfo

Parameters

NameTypeRequiredDefaultDescription

coin

String

true

-

Currency abbreviation, e.g.,btc,eth

subaccount

String

true

-

Subaccount name

  • Successful Response:

{
  "code": "SUCCESS", 
  "data": [
    {
      "workerName": "test001",
      "realtimeHashrate": "2079080822",
      "avgHashrate1440": "20979879837",
      "avgRejectrate1440": 0.001,
      "status": "active", // Status: active: online; inactive: offline; lost: lost connection
      "lastShareTime": 1578653368,
    },
    ......
]
}

Get Subaccount Worker Hashrate Detailed Information

Request

POST /v2/worker/getSubaccountWorkerHashrateDetailInfo

Parameters

NameTypeRequiredDefaultDescription

coin

String

true

-

Currency abbreviation, e.g.,btc、eth

subaccount

String

true

-

Subaccount name

worker

String

true

-

Miner name

mode

String

false

hourly mode=hourlyfor 24-hour chart, mode=daily for 30-day chart (BTC only)

  • Successful Response:

{
    "code": "SUCCESS",
    "data": {
        "startTime": 1581742800000,
		"timeInterval": 3600,
		"hashrates": [
			"32369622321725",
			"30336747489926"
		]
	}
}

Get Priority on-chain Fees

Request

POST /v2/sp/txPriorityChain/getChainingFee

Parameters

NameTypeRequiredDefaultDescription

txHash

String

true

tx hash

informEmail

String

true

User email

  • Successful Response:

{
	"code": 200,
	"msg": "Success",
	"t": 1718250294397,
	"data": {
		"coin": "BTC", //coin
		"curTxSize": 110, //tx size
		"unconfirmedPreTxSize": 110,
		"unit": "BTC", //fee currency
		"totalFee": 0.00009721, //Actual fees paid
		"theoreticalPayAmount": 0.00003584, //Theoretical fees paid
		"txHash": "d0b0c82931c5c34fccb1f4acd42cadc999450921a1a3925ba6dce20ce10598f9", //tx hash
		"informEmail": "test@test.com", //User email
		"timeout": 6000 //Order expiration time seconds
	},
	"success": true
}

Priority on-chain

Request

POST /v2/sp/txPriorityChain/submit

Parameters

NameTypeRequiredDefaultDescription

txHash

String

true

tx hash

informEmail

String

true

User email

curTxSize

Integer

true

tx size

totalFee

BigDecimal

true

Actual fees paid

  • Successful Response:

{
	"code": 200,
	"msg": "Success",
	"t": 1718253030928,
	"data": {
		"coin": "BTC", //coin
		"txHash": "d0b0c82931c5c34fccb1f4acd42cadc999450921a1a3925ba6dce20ce10598f9", //tx hash
		"curTxSize": 110, //tx size
		"unconfirmedPreTxSize": 110,
		"currency": "BTC", //fee currency
		"totalFee": 0.00009721, //Actual fees paid
		"theoreticalPayAmount": 0.00003584, //Theoretical fees paid
		"informEmail": "test@test.com", //User email
		"status": 3, //Order status 3: Paid 4: Accelerating 5: Already on the chain
		"createTime": 1718253029277 //order time
	},
	"success": true
}

Get Priority on-chain Order List

Request

POST /v2/sp/txPriorityChain/queryOrderPage

Parameters

NameTypeRequiredDefaultDescription

pageNumber

Integer

true

pageNumber

pageSize

Integer

true

pageSize

  • Successful Response:

{
	"code": 200,
	"msg": "Success",
	"t": 1718254361407,
	"data": {
		"total": 3,
		"list": [
			{
				"coin": "BTC",
				"txHash": "d0b0c82931c5c34fccb1f4acd42cadc999450921a1a3925ba6dce20ce10598f9",
				"curTxSize": 110,
				"unconfirmedPreTxSize": 110,
				"currency": "BTC",
				"totalFee": 0.00009721,
				"theoreticalPayAmount": 0.00003584,
				"informEmail": "test@test.com",
				"status": 5, //Order status 3: Paid 4: Accelerating 5: Already on the chain
				"blockHeight": 847608,
				"blockTime": 1718185820,
				"createTime": 1718253029000
			}
		]
	},
	"success": true
}

Get Priority on-chain Order Detail

Request

POST /v2/sp/txPriorityChain/orderDetail

Parameters

NameTypeRequiredDefaultDescription

txHash

String

true

tx hash

  • Successful Response:

{
	"code": 200,
	"msg": "Success",
	"t": 1718253030928,
	"data": {
		"coin": "BTC",
		"txHash": "d0b0c82931c5c34fccb1f4acd42cadc999450921a1a3925ba6dce20ce10598f9",
		"curTxSize": 110,
		"unconfirmedPreTxSize": 110,
		"currency": "BTC",
		"totalFee": 0.00009721,
		"theoreticalPayAmount": 0.00003584,
		"informEmail": "test@test.com",
		"status": 3,		
		"blockHeight": 847608,
		"blockTime": 1718185820,
		"createTime": 1718253029277
	},
	"success": true
}

Get Priority on-chain Account Info

Request

POST /v2/sp/txPriorityChain/accountInfo

Parameters

NameTypeRequiredDefaultDescription

  • Successful Response:

{
	"code": 200,
	"msg": "Success",
	"t": 1718254872915,
	"data": [
		{
			"currency": "BTC",
			"availableBalance": 4.99882903,
			"totalConsumeAmount": 0.00117097
		}
	],
	"success": true
}

Last updated