Advertisement
Guest User

Bitcoin Stratum Proxy VPS

a guest
May 20th, 2013
1,609
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.92 KB | None | 0 0
  1. Hi there,
  2. 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.
  3.  
  4. 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
  5.  
  6. http://en.wikipedia.org/wiki/Bitcoin Wiki page on Bitcoins
  7. http://bitcoinintro.com/ Bitcoin Basics/Getting Started
  8. https://bitcointalk.org/ The best Bitcoin Forum
  9.  
  10. OK, so why should you use a stratum proxy?
  11.  
  12. 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.
  13.  
  14. 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.
  15.  
  16. 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.
  17.  
  18. Here's a more indepth guide as to why you should use Stratum
  19. http://mining.bitcoin.cz/stratum-mining
  20.  
  21. 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.
  22.  
  23.  
  24.  
  25. OK, time for the guide!
  26.  
  27.  
  28.  
  29. 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.
  30. I recomend using one of the following:
  31.  
  32. http://www.changeip.com/
  33. https://freedns.afraid.org/
  34. http://www.dnsdynamic.org/
  35.  
  36. 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.
  37.  
  38. When it asks for an IP address, you'll want to put in the IP of your VPS.
  39.  
  40. 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.
  41.  
  42. 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.
  43.  
  44. 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.
  45.  
  46. 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.
  47.  
  48. Once logged in, you'll want to run the following commands
  49.  
  50. Code:
  51. #update your repos
  52. apt-get update
  53.  
  54. #make sure your installed packages are all up to date
  55. apt-get upgrade
  56.  
  57. #make a directory for the proxy
  58. cd /home
  59. mkdir stratum
  60. cd stratum
  61.  
  62. #download the proxy files
  63. wget https://github.com/slush0/stratum-mining-proxy/tarball/master
  64.  
  65. #extract the tgz
  66. tar xf master
  67.  
  68. #rename the folder for simplicity
  69. mv slush* proxy
  70.  
  71. #enter the proxy directory
  72. cd proxy
  73.  
  74. #install the python-dev package, don't forget to hit yes when it asks
  75. apt-get install python-dev
  76.  
  77. #build the proxy files, this will take a little while depending on server specs
  78. python setup.py install
  79.  
  80. #check everything has installed correctly by running the help command
  81. mining_proxy.py --help
  82.  
  83. If all has gone well, you should see the following
  84.  
  85. http://i.imgur.com/eoVZBb9.png
  86.  
  87. 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)
  88.  
  89. Code:
  90. #make sure screen is installed
  91. apt-get install screen
  92.  
  93. #open a new screen
  94. screen
  95.  
  96. You'll get some copyright info, just hit enter. You should be presented with a command prompt like you are used too
  97.  
  98. 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
  99.  
  100. Code:
  101. #start proxy on slush's pool
  102. ./mining_proxy.py
  103.  
  104. To stop the proxy, hold CTRL and press C. This will return you back to the command prompt.
  105.  
  106. 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.
  107.  
  108. Code:
  109. #basic connection arguments
  110. ./mining_proxy.py -o HOST -p PORT
  111.  
  112. For btcguild, you can use one of the following
  113.  
  114. Code:
  115. #stratum proxy on btcguild EU server
  116. ./mining_proxy.py -o eu-stratum.btcguild.com -p 3333
  117.  
  118. #stratum proxy on btcguild US server
  119. ./mining_proxy.py -o stratum.btcguild.com -p 3333
  120.  
  121. 50BTC
  122.  
  123. Code:
  124. #de
  125. ./mining_proxy.py -o pool-de.50btc.com -p 3333
  126.  
  127. #us
  128. ./mining_proxy.py -o pool-us.50btc.com -p 3333
  129.  
  130. #ru
  131. ./mining_proxy.py -o pool-ru.50btc.com -p 3333
  132.  
  133. For other pools check their websites. Generally you can just use the normal pool URL with port 3333 and it'll work.
  134.  
  135. You can check if your proxy is working by going to the following address in a web browser
  136.  
  137. http://dynamic.dns.address:8332
  138.  
  139. You should see something similar to this
  140.  
  141. Code:
  142. {"error": null, "id": 0, "result": {"hash1": "00000000000000000000000000000000000000000000000000000000000000000000008000000000​000000000000000000000000000000000000000000010000", "data": "00000002020ef2f4d6d495a5466b709788d6fbb9528903d3eae7a2cb000001d6000000000adb86e1​7d7442dc7760d3d5d7ae52eb1919407fa2355b0dcd545116d82247c75150c2341a02816e00000000​00000080000000000000000000000000000000000000000000000000000000000000000000000000​0000000080020000", "target": "0000000000000000000000000000000000000000000000000000ffff00000000", "midstate": "8434cc98a4656f6f32b181ce016902f8eb4a5d2cdf0d73fab15f45b92e1a9b8a"}}
  143.  
  144. 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.
  145. 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.
  146.  
  147. 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.
  148. To open screen again and see what the proxy is up to, type the following
  149.  
  150. Code:
  151. #attach to previous screen
  152. screen -r
  153.  
  154. 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.
  155.  
  156. ADVANCED
  157.  
  158. If you want to be even more stealthy, you can change the port that your bots connect to with the following switch
  159. -gp PORT
  160.  
  161. For example, to have your proxy connect to EU BTCGuild and listen on port 443, you would use the following command
  162.  
  163. Code:
  164. ./mining_proxy.py -o eu-stratum.btcguild.com -p 3333 -gp 443
  165.  
  166. 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.
  167.  
  168. Code:
  169. ./mining_proxy.py --help
  170.  
  171. Code:
  172. optional arguments:
  173. -h, --help show this help message and exit
  174. -o HOST, --host HOST Hostname of Stratum mining pool
  175. -p PORT, --port PORT Port of Stratum mining pool
  176. -sh STRATUM_HOST, --stratum-host STRATUM_HOST
  177. On which network interface listen for stratum miners.
  178. Use "localhost" for listening on internal IP only.
  179. -sp STRATUM_PORT, --stratum-port STRATUM_PORT
  180. Port on which port listen for stratum miners.
  181. -oh GETWORK_HOST, --getwork-host GETWORK_HOST
  182. On which network interface listen for getwork miners.
  183. Use "localhost" for listening on internal IP only.
  184. -gp GETWORK_PORT, --getwork-port GETWORK_PORT
  185. Port on which port listen for getwork miners. Use
  186. another port if you have bitcoind RPC running on this
  187. machine already.
  188. -nm, --no-midstate Don't compute midstate for getwork. This has
  189. outstanding performance boost, but some old miners
  190. like Diablo don't work without midstate.
  191. -rt, --real-target Propagate >diff1 target to getwork miners. Some miners
  192. work incorrectly with higher difficulty.
  193. -cl CUSTOM_LP, --custom-lp CUSTOM_LP
  194. Override URL provided in X-Long-Polling header
  195. -cs CUSTOM_STRATUM, --custom-stratum CUSTOM_STRATUM
  196. Override URL provided in X-Stratum header
  197. -cu CUSTOM_USER, --custom-user CUSTOM_USER
  198. Use this username for submitting shares
  199. -cp CUSTOM_PASSWORD, --custom-password CUSTOM_PASSWORD
  200. Use this password for submitting shares
  201. --old-target Provides backward compatible targets for some
  202. deprecated getwork miners.
  203. --blocknotify BLOCKNOTIFY_CMD
  204. Execute command when the best block changes (%s in
  205. BLOCKNOTIFY_CMD is replaced by block hash)
  206. --socks PROXY Use socks5 proxy for upstream Stratum connection,
  207. specify as host:port
  208. --tor Configure proxy to mine over Tor (requires Tor running
  209. on local machine)
  210. -t, --test Run performance test on startup
  211. -v, --verbose Enable low-level debugging messages
  212. -q, --quiet Make output more quiet
  213. -i PID_FILE, --pid-file PID_FILE
  214. Store process pid to the file
  215.  
  216.  
  217. 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