Author Topic: Forging Pool Software  (Read 1005 times)

warmach on: September 26, 2015, 08:10:33 PM

  • Senior Fimker
  • ***
  • Posts: 227
    • View Profile


This is a free software for running a FIM forging pool.  A big thanks goes to forkedchain on NXTForum.org who originally developed it for NXT.  It requires some technical knowledge and is not for beginners.  This software was developed for a LAMP stack but a Windows version may work but has not been tested.  Additional PHP/MYSQL/PERL libraries may be required to run the scripts.  You can find the libraries listed atop main.pl  This also requires the FIM API server to be running and accessible.

http://fim.warmach.info/pool/pool_software.zip

1.  Import .sql into mysql

2.  Modify all the .php files at the very top to include your mysql user, pass, and database.  (PHP scripts dont need write access to DB though, and you may not even want to give php scripts access to nxtAcct table as it contains secrets.)

3.  Modify main.pl perl file at the very top to use your mysql account/password.  Perl scripts need full access to DB

4.  Modify your nxt.properties file nxt.maxRollback property to be a sufficently large number.  This property tells how much blockchain history to keep in short term history.  This is necessary so that scripts can query historical transactions.  If your script fails at some point once you restart it, it will start with the last place it successfully ran.  If that was days ago, it still needs access to those historical transactions.

5.  Modify nxt.forceScan=true.  Restart FIM server.  Modify nxt.forceScan=false.  This forces the block chain to rescan so that it can populate the short term history for your scripts.  You only need to do once, which is why we set it back.  Rescan can take a long time (hours or even days).

6.  Update nxtAcct "account" and "secret" fields for your pool.  Account needs to be the numeric ID, not Reed Soloman.

7.  Update lastProcessedBlock and lastProcessedHeight in nxtInfo where entry = 0 to make them be 1 block before your pool's first forged block.  If you have not forged any blocks yet, set this to the current block minus 1440.

8.  Update minFeeNQT (typically 10000000) and deadlineMins (typically 1440) in nxtInfo

9.  Just manually set the nrsVer field for the RTnxtInfo table

10.  Open main.pl with a text editor and modify the pool configuration variables at the top.

11.  Make sure your pool's account has FIM in it, because the next step will start processing blocks up to 1440 blocks before the last block on the chain, and will payout if an inbound AM comes in (remember an inbound AM will trigger a payout to the sender, if there is a balance).  If you dont want this, then in step 8 use a later block/height such that there are no inbound AM requests after that.

12.  Run the main.pl script.  this may take a looong time, depending on how far back your first forged block was.  Open another terminal and you can select on the nxtInfo table to see how far you have to go to reach 1440 before last block.

13.  Run this again until you only see it working on unconfirmed blocks.

14.  Cron this script to run every minute.


Feel free to post questions and comments.  I'd love to see more pools out there so as to decentralize the network a bit.  I would also encourage larger stakeholders to lease portions of their stake to different pools to spread the forging power.


This software is free to use and modify.  Developer(s) may not be held responsible for use of scripts or bugs encountered.
Warmach's Forging Pool
http://fim.warmach.info/pool/
May the forge be with you...

Eliphaz Fimk #1 on: September 27, 2015, 09:52:08 AM

  • FIMKrypto coordinator
  • Administrator
  • *****
  • Posts: 810
    • View Profile
    • FIMKrypto
Good work there!  Perl :thumbup:

Quote
I would also encourage larger stakeholders to lease portions of their stake to different pools to spread the forging power.

That's a very useful suggestion.