Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Hi there,
- There's been a lot of talk about bitcoin mining in this section later, so I thought I'd explain the benefits of using a proxy and write a guide for how to set one up.
- This guide isn't for people completely new to bitcoin, if you are completely new and interested, I recomend you read through the following pages
- http://en.wikipedia.org/wiki/Bitcoin Wiki page on Bitcoins
- http://bitcoinintro.com/ Bitcoin Basics/Getting Started
- https://bitcointalk.org/ The best Bitcoin Forum
- OK, so why should you use a stratum proxy?
- 1. Whilst most pools aren't too fussed about botnets being run on them, if they get complaints, or if your bot load gets too high, they may take action and ban your account. This method means that all miner traffic to the pool comes from a single IP address.
- 2. Makes it easier to switch pools. Get fed up of your current pool? You won't need to update your bots miners! You just have to change which server your proxy connects too and use the same username on the new pool.
- 3. Stratum mining is better than standard mining which is all done via the HTTP protocol. Stratum uses less traffic and produces a lot less stales/invalid shares.
- Here's a more indepth guide as to why you should use Stratum
- http://mining.bitcoin.cz/stratum-mining
- Right, first things first, you'll need a VPS. This guide will use Debian, but it should work on any Debian based OS such as Ubuntu, Mint, etc. It sould work fine on CentOS as well, you'll just need to switch apt-get for yum install, etc.
- OK, time for the guide!
- First off, you'll need to get a Dynamic DNS. Most people here seem to use no-ip. These same people also seems to lose their no-ip accounts quite frequently.
- I recomend using one of the following:
- http://www.changeip.com/
- https://freedns.afraid.org/
- http://www.dnsdynamic.org/
- The sign up is pretty simple, if you're using afraid.org you can click Registry on the right hand side and it'll give you a list of a few thousand domain names you can use. I recommend using something short and easy to remember.
- When it asks for an IP address, you'll want to put in the IP of your VPS.
- The domain you choose at this point will be the domain you'll use in your miners from now on, regardless of what pool you are using.
- OK. Next you need a pool. For this guide I'll use BTCGuild, however nearly all pool's have stratum servers now and most are looking to move over to stratum only in the future.
- For BTCGuild your default worker will be called 'username_1' however this can be changed. I recomend making a new working for each software miner you plan on using, such as worker_cheapminer, worker_chromeminer, worker_tfminer, etc.
- Right, now for the good bit, you'll want to log into your VPS as either root or with an admin account. Whilst you can run all this from root it's generally considered safer to make a new account for running your proxy from.
- Once logged in, you'll want to run the following commands
- Code:
- #update your repos
- apt-get update
- #make sure your installed packages are all up to date
- apt-get upgrade
- #make a directory for the proxy
- cd /home
- mkdir stratum
- cd stratum
- #download the proxy files
- wget https://github.com/slush0/stratum-mining-proxy/tarball/master
- #extract the tgz
- tar xf master
- #rename the folder for simplicity
- mv slush* proxy
- #enter the proxy directory
- cd proxy
- #install the python-dev package, don't forget to hit yes when it asks
- apt-get install python-dev
- #build the proxy files, this will take a little while depending on server specs
- python setup.py install
- #check everything has installed correctly by running the help command
- mining_proxy.py --help
- If all has gone well, you should see the following
- http://i.imgur.com/eoVZBb9.png
- By default, the proxy does not run in the background. The best way to deal with this is with screen. Screen is like running a seperate SSH session within an SSH session (lol inception)
- Code:
- #make sure screen is installed
- apt-get install screen
- #open a new screen
- screen
- You'll get some copyright info, just hit enter. You should be presented with a command prompt like you are used too
- Now you'll want to run the proxy, by default the proxy will connect to slush's pool, so if you use slush's pool, just type the following
- Code:
- #start proxy on slush's pool
- ./mining_proxy.py
- To stop the proxy, hold CTRL and press C. This will return you back to the command prompt.
- To run on another pool, you'll need to check the address of your pools stratum server and the port number it is running on.
- Code:
- #basic connection arguments
- ./mining_proxy.py -o HOST -p PORT
- For btcguild, you can use one of the following
- Code:
- #stratum proxy on btcguild EU server
- ./mining_proxy.py -o eu-stratum.btcguild.com -p 3333
- #stratum proxy on btcguild US server
- ./mining_proxy.py -o stratum.btcguild.com -p 3333
- 50BTC
- Code:
- #de
- ./mining_proxy.py -o pool-de.50btc.com -p 3333
- #us
- ./mining_proxy.py -o pool-us.50btc.com -p 3333
- #ru
- ./mining_proxy.py -o pool-ru.50btc.com -p 3333
- For other pools check their websites. Generally you can just use the normal pool URL with port 3333 and it'll work.
- You can check if your proxy is working by going to the following address in a web browser
- http://dynamic.dns.address:8332
- You should see something similar to this
- Code:
- {"error": null, "id": 0, "result": {"hash1": "00000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000010000", "data": "00000002020ef2f4d6d495a5466b709788d6fbb9528903d3eae7a2cb000001d6000000000adb86e17d7442dc7760d3d5d7ae52eb1919407fa2355b0dcd545116d82247c75150c2341a02816e00000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000", "target": "0000000000000000000000000000000000000000000000000000ffff00000000", "midstate": "8434cc98a4656f6f32b181ce016902f8eb4a5d2cdf0d73fab15f45b92e1a9b8a"}}
- Once the proxy is running, you can start testing some miners. You'll need to put your dynamic DNS address from earlier as the pool URL, and the port will be 8332.
- You should see in the proxy window the worker names connecting. The proxy will then forward all requests to the pool, hiding the fact that the requests are coming from multiple PC's and locations.
- Once the proxy is running and you've checked it's working correctly, you can minimize screen by holding CTRL and pressing A then D.
- To open screen again and see what the proxy is up to, type the following
- Code:
- #attach to previous screen
- screen -r
- And that's it! If you want to change pools, just stop the proxy with CTRL and C, then start again with the different pool server address. You'll just need to make sure you're using the same worker names on each pool.
- ADVANCED
- If you want to be even more stealthy, you can change the port that your bots connect to with the following switch
- -gp PORT
- For example, to have your proxy connect to EU BTCGuild and listen on port 443, you would use the following command
- Code:
- ./mining_proxy.py -o eu-stratum.btcguild.com -p 3333 -gp 443
- You can also change some other advanced settings which I won't explain here, but you can check out all of the switches with the --help command.
- Code:
- ./mining_proxy.py --help
- Code:
- optional arguments:
- -h, --help show this help message and exit
- -o HOST, --host HOST Hostname of Stratum mining pool
- -p PORT, --port PORT Port of Stratum mining pool
- -sh STRATUM_HOST, --stratum-host STRATUM_HOST
- On which network interface listen for stratum miners.
- Use "localhost" for listening on internal IP only.
- -sp STRATUM_PORT, --stratum-port STRATUM_PORT
- Port on which port listen for stratum miners.
- -oh GETWORK_HOST, --getwork-host GETWORK_HOST
- On which network interface listen for getwork miners.
- Use "localhost" for listening on internal IP only.
- -gp GETWORK_PORT, --getwork-port GETWORK_PORT
- Port on which port listen for getwork miners. Use
- another port if you have bitcoind RPC running on this
- machine already.
- -nm, --no-midstate Don't compute midstate for getwork. This has
- outstanding performance boost, but some old miners
- like Diablo don't work without midstate.
- -rt, --real-target Propagate >diff1 target to getwork miners. Some miners
- work incorrectly with higher difficulty.
- -cl CUSTOM_LP, --custom-lp CUSTOM_LP
- Override URL provided in X-Long-Polling header
- -cs CUSTOM_STRATUM, --custom-stratum CUSTOM_STRATUM
- Override URL provided in X-Stratum header
- -cu CUSTOM_USER, --custom-user CUSTOM_USER
- Use this username for submitting shares
- -cp CUSTOM_PASSWORD, --custom-password CUSTOM_PASSWORD
- Use this password for submitting shares
- --old-target Provides backward compatible targets for some
- deprecated getwork miners.
- --blocknotify BLOCKNOTIFY_CMD
- Execute command when the best block changes (%s in
- BLOCKNOTIFY_CMD is replaced by block hash)
- --socks PROXY Use socks5 proxy for upstream Stratum connection,
- specify as host:port
- --tor Configure proxy to mine over Tor (requires Tor running
- on local machine)
- -t, --test Run performance test on startup
- -v, --verbose Enable low-level debugging messages
- -q, --quiet Make output more quiet
- -i PID_FILE, --pid-file PID_FILE
- Store process pid to the file
- Hopefully this guide will help someone out there! If you're feeling generous and this has helped, I would love for you to send a few bit cents my way :)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement