pool.dero.io Dero pool source for mining Dero.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  1. Usage
  2. ===
  3. #### Requirements
  4. * Coin daemon(s) (find the coin's repo and build latest version from source)
  5. * [Node.js](http://nodejs.org/) v4+ ([follow these installation instructions](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager))
  6. * [Redis](http://redis.io/) key-value store v2.6+ ([follow these instructions](http://redis.io/topics/quickstart))
  7. * libssl required for the node-multi-hashing module
  8. * For Ubuntu: `sudo apt-get install libssl-dev`
  9. ##### Seriously
  10. Those are legitimate requirements. If you use old versions of Node.js or Redis that may come with your system package manager then you will have problems. Follow the linked instructions to get the last stable versions.
  11. [**Redis security warning**](http://redis.io/topics/security): be sure firewall access to redis - an easy way is to
  12. include `bind 127.0.0.1` in your `redis.conf` file. Also it's a good idea to learn about and understand software that
  13. you are using - a good place to start with redis is [data persistence](http://redis.io/topics/persistence).
  14. ##### Easy install on Ubuntu 14 LTS
  15. Installing pool on different Linux distributives is different because it depends on system default components and versions. For now the easiest way to install pool is to use Ubuntu 14 LTS. Thus, all you had to do in order to prepare Ubunty 14 for pool installation is to run:
  16. ```bash
  17. sudo apt-get install git redis-server libboost1.55-all-dev nodejs-dev nodejs-legacy npm cmake libssl-dev
  18. ```
  19. #### 1) Downloading & Installing
  20. Clone the repository and run `npm update` for all the dependencies to be installed:
  21. ```bash
  22. git clone https://github.com/SadBatman/cryptonote-sumokoin-pool.git pool
  23. cd pool
  24. npm update
  25. ```
  26. #### 2) Configuration
  27. Explanation for each field:
  28. ```javascript
  29. /* Used for storage in redis so multiple coins can share the same redis instance. */
  30. "coin": "Sumokoin",
  31. /* Used for front-end display */
  32. "symbol": "SUMO",
  33. /* Minimum units in a single coin, see COIN constant in DAEMON_CODE/src/cryptonote_config.h */
  34. "coinUnits": 1000000000,
  35. /* Coin network time to mine one block, see DIFFICULTY_TARGET constant in DAEMON_CODE/src/cryptonote_config.h */
  36. "coinDifficultyTarget": 60,
  37. "logging": {
  38. "files": {
  39. /* Specifies the level of log output verbosity. This level and anything
  40. more severe will be logged. Options are: info, warn, or error. */
  41. "level": "info",
  42. /* Directory where to write log files. */
  43. "directory": "logs",
  44. /* How often (in seconds) to append/flush data to the log files. */
  45. "flushInterval": 5
  46. },
  47. "console": {
  48. "level": "debug",
  49. /* Gives console output useful colors. If you direct that output to a log file
  50. then disable this feature to avoid nasty characters in the file. */
  51. "colors": true
  52. }
  53. },
  54. /* Modular Pool Server */
  55. "poolServer": {
  56. "enabled": true,
  57. /* Set to "auto" by default which will spawn one process/fork/worker for each CPU
  58. core in your system. Each of these workers will run a separate instance of your
  59. pool(s), and the kernel will load balance miners using these forks. Optionally,
  60. the 'forks' field can be a number for how many forks will be spawned. */
  61. "clusterForks": "auto",
  62. /* Address where block rewards go, and miner payments come from. */
  63. "poolAddress": "Sumoo64zh7dRFyB8dgDWZMLmzKBgGXYWZCG4NBF2VcvzEuiSQpMjyyiYJ1Ra696pZu56PPFQNBDdB1rZjyeX1RVKeWZgHg7pTxj"
  64. /* Poll RPC daemons for new blocks every this many milliseconds. */
  65. "blockRefreshInterval": 1000,
  66. /* How many seconds until we consider a miner disconnected. */
  67. "minerTimeout": 900,
  68. /* These cryptonote address prefixes are used to check whether the
  69. miner supplied a valid address. The values below are for sumokoin
  70. wallet and subaddresses. If you use a different coin than you must
  71. update the values here. */
  72. "allowedMinerAddressPrefixes": [
  73. "2864026", "536986"
  74. ],
  75. "ports": [
  76. {
  77. "port": 3333, //Port for mining apps to connect to
  78. "difficulty": 5000, //Initial difficulty miners are set to
  79. "desc": "Low end hardware" //Description of port
  80. },
  81. {
  82. "port": 3334,
  83. "difficulty": 10000,
  84. "desc": "Mid range hardware"
  85. },
  86. {
  87. "port": 3335,
  88. "difficulty": 20000,
  89. "desc": "High end hardware"
  90. },
  91. {
  92. "port": 3336,
  93. "difficulty": 20000,
  94. "desc": "High end hardware (SSL protected)",
  95. /* When you enable SSL; the server expects that you put the
  96. SSL key and cert as the files "key.pem" and "cert.pem" into the
  97. directory from which you run the pool server. /*
  98. "type": "SSL"
  99. }
  100. ],
  101. /* Variable difficulty is a feature that will automatically adjust difficulty for
  102. individual miners based on their hashrate in order to lower networking and CPU
  103. overhead. */
  104. "varDiff": {
  105. "minDiff": 500, //Minimum difficulty
  106. "maxDiff": 50000,
  107. "targetTime": 100, //Try to get 1 share per this many seconds
  108. "retargetTime": 30, //Check to see if we should retarget every this many seconds
  109. "variancePercent": 30, //Allow time to very this % from target without retargeting
  110. "maxJump": 100 //Limit diff percent increase/decrease in a single retargetting
  111. },
  112. /* Set difficulty on miner client side by passing <address> param with .<difficulty> postfix
  113. minerd -u Sumoo64zh7dRFyB8dgDWZMLmzKBgGXYWZCG4NBF2VcvzEuiSQpMjyyiYJ1Ra696pZu56PPFQNBDdB1rZjyeX1RVKeWZgHg7pTxj.5000 */
  114. "fixedDiff": {
  115. "enabled": true,
  116. "separator": ".", // character separator between <address> and <difficulty>
  117. },
  118. /* Feature to trust share difficulties from miners which can
  119. significantly reduce CPU load. */
  120. "shareTrust": {
  121. "enabled": true,
  122. "min": 10, //Minimum percent probability for share hashing
  123. "stepDown": 3, //Increase trust probability % this much with each valid share
  124. "threshold": 10, //Amount of valid shares required before trusting begins
  125. "penalty": 30 //Upon breaking trust require this many valid share before trusting
  126. },
  127. /* If under low-diff share attack we can ban their IP to reduce system/network load. */
  128. "banning": {
  129. "enabled": true,
  130. "time": 600, //How many seconds to ban worker for
  131. "invalidPercent": 25, //What percent of invalid shares triggers ban
  132. "checkThreshold": 30 //Perform check when this many shares have been submitted
  133. }
  134. },
  135. /* Module that sends payments to miners according to their submitted shares. */
  136. "payments": {
  137. "enabled": true,
  138. "interval": 600, //how often to run in seconds
  139. "maxAddresses": 10, //split up payments if sending to more than this many addresses
  140. "mixin": 12, //number of transactions yours is indistinguishable from
  141. "transferFee": 10000000, //fee to pay for each transaction, deducted from pool owner's balance
  142. "minPayment": 2000000000, //miner balance required before sending payment
  143. "maxTransactionAmount": 500000000000, //split transactions by this amount(to prevent "too big transaction" error)
  144. "denomination": 10000000, //truncate to this precision and store remainder
  145. "useDynamicTransferFee": true, // use (simple) dynamic transfer fee
  146. "transferFeePerPayee": 4000000, // dynamic transfer fee per payee/transaction
  147. "minerPayFee": true, // miner pays (dynamic) transfer fee instead of pool owner
  148. // When the block reward is a non-zero value; it will be used to provide a
  149. // payout estimate in the miner statistics.
  150. "blockReward": 0
  151. },
  152. /* Module that monitors the submitted block maturities and manages rounds. Confirmed
  153. blocks mark the end of a round where workers' balances are increased in proportion
  154. to their shares. */
  155. "blockUnlocker": {
  156. "enabled": true,
  157. "interval": 30, //how often to check block statuses in seconds
  158. /* Block depth required for a block to unlocked/mature. Found in daemon source as
  159. the variable CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW */
  160. "depth": 60,
  161. "poolFee": 1.8, //1.8% pool fee (2% total fee total including donations)
  162. "devDonation": 0.1, //0.1% donation to send to pool dev - only works with Monero
  163. "coreDevDonation": 0.1 //0.1% donation to send to core devs - works with Bytecoin, Monero, Dashcoin, QuarazCoin, Fantoncoin, AEON, Sumokoin, OneEvilCoin
  164. },
  165. /* AJAX API used for front-end website. */
  166. "api": {
  167. "enabled": true,
  168. "hashrateWindow": 600, //how many second worth of shares used to estimate hash rate
  169. "updateInterval": 3, //gather stats and broadcast every this many seconds
  170. "port": 8117,
  171. "blocks": 30, //amount of blocks to send at a time
  172. "payments": 30, //amount of payments to send at a time
  173. "password": "test" //password required for admin stats
  174. "trust_proxy_ip": false //trust the X-Forwarded-For header to set the client IP. This should be used in combination with reverse proxies.
  175. },
  176. /* Coin daemon connection details. */
  177. "daemon": {
  178. "host": "127.0.0.1",
  179. "port": 19734
  180. },
  181. /* Wallet daemon connection details. */
  182. "wallet": {
  183. "host": "127.0.0.1",
  184. "port": 19735
  185. },
  186. /* Redis connection into. */
  187. "redis": {
  188. "host": "127.0.0.1",
  189. "port": 6379
  190. }
  191. /* Email configuration */
  192. "email": {
  193. "enabled": false,
  194. "api_key": "", // Your Mailgun.com API key.
  195. "api_domain": "mg.yourdomain", // The domain you registered at Mailgun.
  196. "from_address": "", // The email address to which users can reply.
  197. "template_dir": "email_templates",
  198. "domain": "pool.domain.here" // Used for links in the email.
  199. },
  200. /* Monitoring RPC services. Statistics will be displayed in Admin panel */
  201. "monitoring": {
  202. "daemon": {
  203. "checkInterval": 60, //interval of sending rpcMethod request
  204. "rpcMethod": "getblockcount" //RPC method name
  205. },
  206. "wallet": {
  207. "checkInterval": 60,
  208. "rpcMethod": "getbalance"
  209. }
  210. /* Collect pool statistics to display in frontend charts */
  211. "charts": {
  212. "pool": {
  213. "hashrate": {
  214. "enabled": true, //enable data collection and chart displaying in frontend
  215. "updateInterval": 60, //how often to get current value
  216. "stepInterval": 1800, //chart step interval calculated as average of all updated values
  217. "maximumPeriod": 86400 //chart maximum periods (chart points number = maximumPeriod / stepInterval = 48)
  218. },
  219. "workers": {
  220. "enabled": true,
  221. "updateInterval": 60,
  222. "stepInterval": 1800, //chart step interval calculated as maximum of all updated values
  223. "maximumPeriod": 86400
  224. },
  225. "difficulty": {
  226. "enabled": true,
  227. "updateInterval": 1800,
  228. "stepInterval": 10800,
  229. "maximumPeriod": 604800
  230. },
  231. "price": { //USD price of one currency coin received from cryptonator.com/api
  232. "enabled": true,
  233. "updateInterval": 1800,
  234. "stepInterval": 10800,
  235. "maximumPeriod": 604800
  236. },
  237. "profit": { //Reward * Rate / Difficulty
  238. "enabled": true,
  239. "updateInterval": 1800,
  240. "stepInterval": 10800,
  241. "maximumPeriod": 604800
  242. }
  243. },
  244. "user": { //chart data displayed in user stats block
  245. "hashrate": {
  246. "enabled": true,
  247. "updateInterval": 180,
  248. "stepInterval": 1800,
  249. "maximumPeriod": 86400
  250. },
  251. "payments": { //payment chart uses all user payments data stored in DB
  252. "enabled": true
  253. }
  254. }
  255. ```
  256. #### 3) Start the pool
  257. First make sure that the sumokoind and sumo-wallet-rpc daemons are running:
  258. ```bash
  259. ./sumokoind --detach
  260. ./sumo-wallet-rpc --wallet-file=<wallet name> --rpc-bind-port <wallet port>
  261. ```
  262. When both are running it's worth to make sure the sumokoind has it's blockchain
  263. synced. If this is not the case your pool will show errors with "Core is busy"
  264. until sumokoind is synchronized.
  265. ```bash
  266. node init.js
  267. ```
  268. The file `config.json` is used by default but a file can be specified using the `-config=file` command argument, for example:
  269. ```bash
  270. node init.js -config=config_sumokoin.json
  271. ```
  272. This software contains four distinct modules:
  273. * `pool` - Which opens ports for miners to connect and processes shares
  274. * `api` - Used by the website to display network, pool and miners' data
  275. * `unlocker` - Processes block candidates and increases miners' balances when blocks are unlocked
  276. * `payments` - Sends out payments to miners according to their balances stored in redis
  277. By default, running the `init.js` script will start up all four modules. You can optionally have the script start
  278. only start a specific module by using the `-module=name` command argument, for example:
  279. ```bash
  280. node init.js -module=api
  281. ```
  282. [Example screenshot](http://i.imgur.com/SEgrI3b.png) of running the pool in single module mode with tmux.
  283. #### 4) Host the front-end
  284. Simply host the contents of the `website_example` directory on file server capable of serving simple static files.
  285. Edit the variables in the `website_example/config.js` file to use your pool's specific configuration.
  286. Variable explanations:
  287. ```javascript
  288. /* Must point to the API setup in your config.json file. */
  289. var api = "http://poolhost:8117";
  290. /* Pool server host to instruct your miners to point to. */
  291. var poolHost = "poolhost.com";
  292. /* IRC Server and room used for embedded KiwiIRC chat. */
  293. var irc = "irc.freenode.net/#sumokoin";
  294. /* Contact email address. */
  295. var email = "support@poolhost.com";
  296. /* Market stat display params from https://www.cryptonator.com/widget */
  297. var cryptonatorWidget = ["SUMO-BTC", "SUMO-USD", "SUMO-EUR"];
  298. /* Download link to cryptonote-easy-miner for Windows users. */
  299. var easyminerDownload = "https://github.com/zone117x/cryptonote-easy-miner/releases/";
  300. /* Used for front-end block links. */
  301. var blockchainExplorer = "http://chainradar.com/{symbol}/block/{id}";
  302. /* Used by front-end transaction links. */
  303. var transactionExplorer = "http://chainradar.com/{symbol}/transaction/{id}";
  304. /* Any custom CSS theme for pool frontend */
  305. var themeCss = "themes/default-theme.css";
  306. ```
  307. #### 6) Customize your website
  308. The following files are included so that you can customize your pool website without having to make significant changes
  309. to `index.html` or other front-end files thus reducing the difficulty of merging updates with your own changes:
  310. * `custom.css` for creating your own pool style
  311. * `custom.js` for changing the functionality of your pool website
  312. Then simply serve the files via nginx, Apache, Google Drive, or anything that can host static content.
  313. #### Upgrading
  314. When updating to the latest code its important to not only `git pull` the latest from this repo, but to also update
  315. the Node.js modules, and any config files that may have been changed.
  316. * Inside your pool directory (where the init.js script is) do `git pull` to get the latest code.
  317. * Remove the dependencies by deleting the `node_modules` directory with `rm -r node_modules`.
  318. * Run `npm update` to force updating/reinstalling of the dependencies.
  319. * Compare your `config.json` to the latest example ones in this repo or the ones in the setup instructions where each config field is explained. You may need to modify or add any new changes.
  320. ### Setting up Testnet
  321. Sumokoin does have a testnet. Call daemon and simplewallet with --tesnet to connect to it.
  322. Downloading the testnet blockchain may still take a while to start usint testnet, so you can use this excellent
  323. Monero tutorial, which also applies to Sumokoin, at http://moneroexamples.github.io/private-testnet/ to set up a private testnet.
  324. For cryptonote based coins that don't have a testnet mode (yet), you can effectively create a testnet with the following steps:
  325. * Open `/src/p2p/net_node.inl` and remove lines with `ADD_HARDCODED_SEED_NODE` to prevent it from connecting to mainnet (Monero example: http://git.io/0a12_Q)
  326. * Build the coin from source
  327. * You now need to run two instance of the daemon and connect them to each other (without a connection to another instance the daemon will not accept RPC requests)
  328. * Run first instance with `./coind --p2p-bind-port 28080 --allow-local-ip`
  329. * Run second instance with `./coind --p2p-bind-port 5011 --rpc-bind-port 5010 --add-peer 0.0.0.0:28080 --allow-local-ip`
  330. * You should now have a local testnet setup. The ports can be changes as long as the second instance is pointed to the first instance, obviously
  331. *Credit to surfer43 for these instructions*
  332. ### JSON-RPC Commands from CLI
  333. Documentation for JSON-RPC commands can be found here:
  334. * Daemon https://wiki.bytecoin.org/wiki/Daemon_JSON_RPC_API
  335. * Wallet https://wiki.bytecoin.org/wiki/Wallet_JSON_RPC_API
  336. Curl can be used to use the JSON-RPC commands from command-line. Here is an example of calling `getblockheaderbyheight` for block 100:
  337. ```bash
  338. curl 127.0.0.1:18081/json_rpc -d '{"method":"getblockheaderbyheight","params":{"height":100}}'
  339. ```
  340. ### Monitoring Your Pool
  341. * To inspect and make changes to redis I suggest using [redis-commander](https://github.com/joeferner/redis-commander)
  342. * To monitor server load for CPU, Network, IO, etc - I suggest using [New Relic](http://newrelic.com/)
  343. * To keep your pool node script running in background, logging to file, and automatically restarting if it crashes - I suggest using [forever](https://github.com/nodejitsu/forever)