Yiimp install notes for a Gentoo system Basic documentation, install, and source code at https://github.com/tpruvot/yiimp Of course, you can change things like the yiimp account name, database name, etc. freely, this guideline is just a pattern to follow. Note this is a pretty intrusive install, expecting things like /var/web to point to its own code. Therefore this is probably best done on a linux machine that is dedicated to running the pool code. 0) Login as root 1) Add "mysql mysqli curl php pdo nginx fastcgi fpm memcached" to your /etc/portage/make.conf USE= variable Add "NGINX_MODULES_HTTP="access fastcgi gzip rewrite stub_status" to the bottom 2) emerge mysql, php, memcached, git, pecl-memcache (not pecl-memcached) 3) emerge nginx and then edit /etc/nginx/nginx.conf. The server section should look something like this: server { listen 80; server_name 10.184.156.15; access_log /var/log/nginx/localhost.access_log main; error_log /var/log/nginx/localhost.error_log info; root /home/yiimp/yiimp/web; location ~ \.php$ { # Test for non-existent scripts or throw a 404 error # Without this line, nginx will blindly send any request ending in .php to php-fpm try_files $uri =404; include /etc/nginx/fastcgi.conf; fastcgi_pass unix:/run/php-fpm.socket; } location /nginx_status { stub_status on; allow 127.0.0.1/32; allow 10.184.156.11; deny all; } location / { try_files $uri @rewrite; } location @rewrite { rewrite ^/(.*)$ /index.php?r=$1; } location ~ \.php$ { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } } 4) Setup mysql: rc-update add mysql default emerge --config dev-db/mysql rc-service mysql start mysql_secure_installation 5) Add a yiimp userid: useradd -m -d /home/yiimp yiimp set the password: passwd yiimp 6) Login as yiimp: /bin/su - yiimp 7) Download the Yiimp source: git clone https://github.com/tpruvot/yiimp 8) Create the yiimp database & users: mysql -u root -p CREATE DATABASE yiimp; CREATE USER 'yiimpweb'@'localhost' IDENTIFIED BY 'SomePassword'; CREATE USER 'yiimpstratum'@'localhost' IDENTIFIED BY 'AnotherPassword'; GRANT ALL PRIVILEGES ON *.* TO 'yiimpweb'@'localhost'; GRANT ALL PRIVILEGES ON *.* TO 'yiimpstratum'@'localhost'; FLUSH PRIVILEGES; \q 9) Build the database: cd yiimp/sql There you will find a bunch of .sql files and a couple of .gz files. For reasons unknown, there are two .gz files. Keep the oldest one (date is part of the filename) and remove the other one. Note the date on the latest .gz and remove all .sql files prior to that. (rm -i *.sql works well for that). Once the directory is clean, vi the .gz file and save it as something obviouos like "sql.dump". Then: mysql -u yiimpweb -p yiimp < sql.dump - with any luck it will return with no messages after a minute or so. cat *.sql > sql.update mysql -u yiimpweb -p yiimp < sql.update - which hopefully will also run without error Note the "cat" saves you the trouble of having to apply each .sql file individually. Since the .sql files are named in date order, cat appends them in the correct order for input. 10) cd ~/yiimp/stratum cd iniparser; make; cd .. Generate the stratum binary: make cd ../blocknotify Suggested but optional: Edit blocknotify.cpp and change line 74 where"tu8tu5" is the password Generate the blocknotify binary: make logout of yimmp and go back to root: exit 11) cd /var mkdir stratum copy run.sh, the stratum binary, the blocknotify binary to /var/stratum pop over to the yiimp/stratum/config.sample directory and figure out which .conf files your going to want. Copy those to /var/stratum as well. ln -s /home/yiimp/yiimp/web web (point /var/web at the web code) 12) Yiimp uses pecl-memcache, not pecl-memcached. Pecl-memcache is only supported on php 5.6. Since this is (hopefully) a dedicated box, it shouldn't hurt too much to run the older php. Use "eselect php list cli" to see which release is active use "eselect php set cli 1" to set it to php 5.6 (match the list number from the list command) 13) Now to check things out: /bin/su - yiimp cd yiimp/bin vi yiimp and set ROOTDIR=/var vi /var/web/serverconfig.php ./yiimp checkup - Good luck, any issue revealed here will need to be fixed exit 14) There is probably a better way to handle the next step, but here goes: cd /var mkdir web cd web cp -R /home/yiimp/yiimp/web . chmod 777 assets mkdir /var/log/yiimp chmod 777 /var/log/yiimp touch /var/log/yiimp/debug.log chmod 777 /var/log/yiimp/debug.log 15) Start things out with a clean distribution: /bin/su - yiimp cd yiimp/bin ./yiimp distclean (e.g. /var/stratum/run.sh sha) for each stratum you have defined. 21) Point your miners and start mining! 22) Found a couple of references like "service nginx stop" in /var/web/yaamp/modules/thread/CronjobController.php Those should be changed to "rc-service nginx stop" to reflect we are not running on systemd (unless, of course, you are). Optional: For Sia support 23) The stratum code needs modification to support sia's mining.notify format. In ../stratum, edit job_send.cpp, and add lines 33-38 below: 15 static void job_mining_notify_buffer(YAAMP_JOB *job, char *buffer) 16 { 17 YAAMP_JOB_TEMPLATE *templ = job->templ; 18 19 if (!strcmp(g_stratum_algo, "lbry")) { 20 sprintf(buffer, "{\"id\":null,\"method\":\"mining.notify\",\"params\":[" 21 "\"%x\",\"%s\",\"%s\",\"%s\",\"%s\",[%s],\"%s\",\"%s\",\"%s\",true]}\n", 22 job->id, templ->prevhash_be, templ->claim_be, templ->coinb1, templ->coinb2, 23 templ->txmerkles, templ->version, templ->nbits, templ->ntime); 24 return; 25 } else if (strlen(templ->extradata_hex) == 128) { 26 // LUX smart contract state hashes (like lbry extra field, here the 2 root hashes in one) 27 sprintf(buffer, "{\"id\":null,\"method\":\"mining.notify\",\"params\":[" 28 "\"%x\",\"%s\",\"%s\",\"%s\",\"%s\",[%s],\"%s\",\"%s\",\"%s\",true]}\n", 29 job->id, templ->prevhash_be, templ->extradata_be, templ->coinb1, templ->coinb2, 30 templ->txmerkles, templ->version, templ->nbits, templ->ntime); 31 return; 32 } 33 else if (!strcmp(g_stratum_algo, "siaasic")) { 34 sprintf(buffer, "{\"id\":null,\"method\":\"mining.notify\",\"params\":[\"%x\",\"%s\",\"%s\",\"%s\",[%s],\"%s\",\"%s\",\"%s00000000\",true]}\n", 35 /* 1 2 3 4 5 6 7 8 */ 36 job->id, templ->prevhash_be, templ->coinb1, templ->coinb2, templ->txmerkles, "" , templ->nbits, templ->ntime); 37 return; 38 } 39 40 // standard stratum 41 sprintf(buffer, "{\"id\":null,\"method\":\"mining.notify\",\"params\":[\"%x\",\"%s\",\"%s\",\"%s\",[%s],\"%s\",\"%s\",\"%s\",true]}\n", 42 job->id, templ->prevhash_be, templ->coinb1, templ->coinb2, templ->txmerkles, templ->version, templ->nbits, templ->ntime); 43 } Note this is defining a new algoithm "siaasic". If you never intend to support CPU/GPU mining, you could code this against "blake2b". Other changes are also required. The reference is at https://siamining.com/stratum Diff of client_submit.cpp: 147c147 < bool is_sia = g_current_algo->name && !strcmp("siaasic",g_current_algo->name); --- > 149,150d148 < /* Attempt to adjust sia difficulty to standard bitcoin difficutly */ < if (is_sia) hash_int /= 4295032833; 426,427d423 < bool is_sia = g_current_algo->name && !strcmp("siaasic",g_current_algo->name); < YAAMP_JOB_TEMPLATE *templ = job->templ; 429,430c425 < /* Sia ASIC miners append 8 zeros to the nonce, so throw those away */ < if (is_sia && (strlen(nonce) == 16)) nonce[YAAMP_NONCE_SIZE*2]='\0'; --- > YAAMP_JOB_TEMPLATE *templ = job->templ; 437,444d431 < /* Sia ASIC miners prepend 8 zeros to the nonce, so clip those off */ < < if (strlen(ntime) == 16) { < for (int i=0; i<=8; ++i) { < ntime[i] = ntime[i+8]; < } < } < 515,517c502 < < /* Siaasic handle difficulty differently, without a lot of leading zeros */ < if(pfx && !is_sia) { --- > if(pfx) { 528,529d512 < /* Attempt to adjust sia difficulty to standard bitcoin difficutly */ < if (is_sia) hash_int /= 4295032833; 576d558 < 24) Add support for "siaasic" in the web interface in /var/web/yaamp/core/functions/yaamp.php add "siaasic" to the array of known algos. in /var/web/serverconfig.php add a pool fee and custom port if desired setup a new coin in the web interface using the algo type of "siaasic". This should pretty much be a clone of your blake2b setup for the coin. 25) Let the stratum code know siaasic is legit. Just edit ../stratum/stratum.cpp and duplicate the blake2b entry, substituting in "siaasic" in the first parameter. 26) Patchup /var/web/yaamp/modules/explorer/util.php adding an entry for siaasic in the same area as blake2b (I used #30).