Skip to content

Getting Started With Stratum

immki edited this page Nov 25, 2021 · 10 revisions

Downloading

We need to fetch stratum-mining and some additional code for a stratum implementation:

git clone https://github.com/Tydus/litecoin_scrypt.git
git clone https://github.com/Crypto-Expert/stratum-mining.git
git clone https://github.com/ahmedbodi/stratum.git

That covers the download. Lets go ahead and prepare the software!

Installation

We need to install litecoin_scrypt and stratum (assuming you are working in your home directory):

cd ~/stratum-mining
git submodule init
git submodule update

cd ~/litecoin_scrypt
sudo python setup.py install

cd ~/stratum
sudo python setup.py install

Configuration

Now that we have everything installed we can configure stratum-mining to run with our testnet:

cd ~
cp stratum-mining/conf/config_sample.py stratum-mining/conf/config.py
vi stratum-mining/conf/config.py

You will need to adjust some settings for this to work:

CENTRAL_WALLET = 'Your_Valid_Bitcoin_or_Litecoin_Address'
[...]
COINDAEMON_TRUSTED_HOST = 'localhost'
COINDAEMON_TRUSTED_PORT = 19334
COINDAEMON_TRUSTED_USER = 'testnet'
COINDAEMON_TRUSTED_PASSWORD = 'testnet'
ALGO_NAME = 'ltc_scrypt'
COINDAEMON_Reward = 'POW'
COINDAEMON_TX = 'no'
[...]
DATABASE_DRIVER = 'mysql'
DB_MYSQL_HOST = 'localhost'
DB_MYSQL_DBNAME = 'mpos'
DB_MYSQL_USER = 'root'
DB_MYSQL_PASS = 'root'
[...]
POOL_TARGET = 16
[...]
SOLUTION_BLOCK_HASH = True

Starting stratum-mining

This is the easy part, but don't do it till you set up the database in the next steps. Change to the stratum-mining folder and fire up the service:

cd stratum-mining
twistd -ny launcher.tac

If you want to run it in the background you can remove the -ny and replace it with -y:

twistd -y launcher.tac

Special Notes

When running stratum-mining I noticed that stratum and pushpoold use different settings. @pooler was nice enough to explain it to me in detail:

pushpoold uses a target bits terminology and stratum a difficulty setting. These are different. When running pushpoold at a target bit of 20 you will match the default setting of 16 in stratum-mining. This will ensure that hashrates on MPOS match up! If you'd think you could set pushpoold to 16 and match it with stratum you will be off.

He devised a formula that can be used to change stratum difficulty and match pushpoold and MPOS to it:

(stratum diff) ~= 2^((target bits in pushpool) - 16)

Add The Result To The Stratum Pool_Target

Clone this wiki locally