Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.
/ hdpool-api Public archive

Interact with the HDPool account and mining related API programmatically

License

Notifications You must be signed in to change notification settings

felixbrucker/hdpool-api

Repository files navigation

HDPool API

Software License npm npm weekly downloads

Usage

Public API

const{HDPoolPublicApi}=require('hdpool-api');

constclient=newHDPoolPublicApi();

(async()=>{
awaitclient.init();

constpoolStats=awaitclient.getPoolStats();

constloginCodeResponse=awaitclient.getLoginCode();// Retrieve login code png

constloginResponse=awaitclient.login('[email protected]','mypassword','123456');

client.onBestMiningInfo(bestMiningInfo=>{
// Do stuff
});
})();

Account API

const{HDPoolAccountApi}=require('hdpool-api');

constuserId=12345;
constsessionKey='rOw7vZuqaC0GbapWGxeUECwLfDJaE2J74aCrmgnRfroolPuMOZUX7GotMRsy';

constclient=newHDPoolAccountApi(userId,sessionKey);

(async()=>{
awaitclient.init();

constuserInfo=awaitclient.getUserInfo();
constearningsStats=awaitclient.getEarningsStats();
constminers=awaitclient.getMiners();
constpledgeState=awaitclient.getPledgeState();
constboundPlotter=awaitclient.getBoundPlotter();
constdepositHistory=awaitclient.getDepositHistory();
constwithdrawHistory=awaitclient.getWithdrawHistory();
constearningsHistory=awaitclient.getEarningsHistory();
constexpectedEarningsHistory=awaitclient.getExpectedEarningsHistory();
constpoolStats=awaitclient.getPoolStats();
constnextFreePaymentDate=awaitclient.getNextFreePaymentDate();// When we can send a payout without paying fees

awaitclient.withdraw(Math.round(5*Math.pow(10,8)),'some code');// withdraw 5 BHD
awaitclient.cancelWithdraw(1234);// Cancel the withdraw with id 1234
constdepositAddr=awaitclient.getDepositAddr();// retrieve your deposit addr

client.onBestMiningInfo(bestMiningInfo=>{
// Do stuff
});
})();

Mining API

const{HDPoolMiningApi}=require('hdpool-api');

constaccountKey='dpvwfv34-xprf-15t2xwb12o8yglm4palf55';
constminerName='Miner 1';
constcapacityInGB=512;

constclient=newHDPoolMiningApi(accountKey,minerName,capacityInGB);

(async()=>{
awaitclient.init();

constminingInfo=awaitclient.getMiningInfo();

client.onMiningInfo(miningInfo=>{
// Do stuff
});

client.submitNonce('12297078971021390907',143779,'111137519053',81);
})();

Obtaining the userId and sessionKey

  • Login to hdpool
  • Open the dev console (F12) and enterlocalStorage.getItem('sess')into the console
  • Copy the uid (userId) and key (sessionKey) values

License

GNU GPLv3 (seeLICENSE)

About

Interact with the HDPool account and mining related API programmatically

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published