Page 2 of 4
Re: Write NiceHash bot, make lots of profit
Posted: Tue Jul 26, 2016 2:12 am
by Maznoz
Hi Steve,
I've tried to connect to both:
- wss://live.prohashing.com:443/ws
- wss://prohashing.com:444/ws
the first location is specified in the help documentation and the second location was used in the example you provided earlier in this thread. Both have the same authentication issue, as written in my earlier reply.
Best,
Maznoz
Re: Write NiceHash bot, make lots of profit
Posted: Tue Jul 26, 2016 9:13 am
by Steve Sokolowski
The port 444 one is definitely incorrect and will be removed from the documentation in the next release.
I don't understand what is going on here with the other one. The website has no problems connecting to the server, and that code comes directly from the website. I'm going to ask Chris to look into this and see if he can provide any more information.
Re: Write NiceHash bot, make lots of profit
Posted: Tue Jul 26, 2016 10:00 pm
by JoeTheMiner
Steve Sokolowski wrote:The port 444 one is definitely incorrect and will be removed from the documentation in the next release.
I don't understand what is going on here with the other one. The website has no problems connecting to the server, and that code comes directly from the website. I'm going to ask Chris to look into this and see if he can provide any more information.
Ok, that sounds good. I am not for sure either because it should be working if the code is the same.
Re: Write NiceHash bot, make lots of profit
Posted: Tue Jul 26, 2016 11:51 pm
by Chris Sokolowski
Are you getting a security certificate error? I know that Internet Explorer 10 doesn't like our wamp security certificate and won't display live data because of it, but since IE10 is such a small portion of the market, I have not looked into correcting it. If this same issue also affects your usage, I will try to correct the certificate issue.
Re: Write NiceHash bot, make lots of profit
Posted: Wed Jul 27, 2016 2:48 am
by Maznoz
Hi Chris,
I indeed got a certificate error, but disabled certificate verification while testing. So this issue does not seem to be caused by certificate issues.
My python code, which works for the poloniex wamp api (no authentication needed there), is as follows:
Code: Select all
#!/usr/bin/env python3
import ssl
from autobahn.asyncio.wamp import ApplicationSession
from autobahn.asyncio.wamp import ApplicationRunner
from autobahn.wamp import auth
try:
import asyncio
except ImportError:
# Trollius >= 0.3 was renamed
import trollius as asyncio
user = "web"
secret = "wampUser"
class ProhashingComponent(ApplicationSession):
def onConnect(self):
self.join(self.config.realm, [u"wampcra"], user)
def onChallenge(self, challenge):
if challenge.method == u"wampcra":
print("WAMP-CRA challenge received: {}".format(challenge))
if u'salt' in challenge.extra:
# salted secret
key = auth.derive_key(secret,
challenge.extra['salt'],
challenge.extra['iterations'],
challenge.extra['keylen'])
else:
# plain, unsalted secret
key = secret
# compute signature for challenge, using the key
signature = auth.compute_wcs(key, challenge.extra['challenge'])
# return the signature to the router for verification
return signature
else:
raise Exception("Invalid authmethod {}".format(challenge.method))
@asyncio.coroutine
def onJoin(self, details):
def onProfitabilityUpdates(*args):
print("Profitability Updates event received:", args)
try:
yield from self.subscribe(onProfitabilityUpdates, 'profitability_updates')
except Exception as e:
print("Could not subscribe to topic:", e)
def main():
context = ssl.create_default_context()
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
runner = ApplicationRunner(u"wss://live.prohashing.com:443/ws", u"mining", ssl=context)
#runner = ApplicationRunner(u"wss://prohashing.com:444/ws", u"mining", ssl=context)
runner.run(ProhashingComponent)
if __name__ == "__main__":
main()
The wampcra imlementation comes straight from the autobahn examples.
Hope this helps.
Best,
Maznoz
Re: Write NiceHash bot, make lots of profit
Posted: Wed Jul 27, 2016 7:51 am
by Steve Sokolowski
Hi Maznoz,
There is at least one error in this code - the password was translated incorrectly from the Javascript. You'll notice the line that sets the password equal to the username variable, not equal to the variable name (which you have as a string - "wampUser.") The password, like the username, is "web."
Thanks,
-Steve
Maznoz wrote:Hi Chris,
I indeed got a certificate error, but disabled certificate verification while testing. So this issue does not seem to be caused by certificate issues.
My python code, which works for the poloniex wamp api (no authentication needed there), is as follows:
Code: Select all
#!/usr/bin/env python3
import ssl
from autobahn.asyncio.wamp import ApplicationSession
from autobahn.asyncio.wamp import ApplicationRunner
from autobahn.wamp import auth
try:
import asyncio
except ImportError:
# Trollius >= 0.3 was renamed
import trollius as asyncio
user = "web"
secret = "wampUser"
class ProhashingComponent(ApplicationSession):
def onConnect(self):
self.join(self.config.realm, [u"wampcra"], user)
def onChallenge(self, challenge):
if challenge.method == u"wampcra":
print("WAMP-CRA challenge received: {}".format(challenge))
if u'salt' in challenge.extra:
# salted secret
key = auth.derive_key(secret,
challenge.extra['salt'],
challenge.extra['iterations'],
challenge.extra['keylen'])
else:
# plain, unsalted secret
key = secret
# compute signature for challenge, using the key
signature = auth.compute_wcs(key, challenge.extra['challenge'])
# return the signature to the router for verification
return signature
else:
raise Exception("Invalid authmethod {}".format(challenge.method))
@asyncio.coroutine
def onJoin(self, details):
def onProfitabilityUpdates(*args):
print("Profitability Updates event received:", args)
try:
yield from self.subscribe(onProfitabilityUpdates, 'profitability_updates')
except Exception as e:
print("Could not subscribe to topic:", e)
def main():
context = ssl.create_default_context()
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
runner = ApplicationRunner(u"wss://live.prohashing.com:443/ws", u"mining", ssl=context)
#runner = ApplicationRunner(u"wss://prohashing.com:444/ws", u"mining", ssl=context)
runner.run(ProhashingComponent)
if __name__ == "__main__":
main()
The wampcra imlementation comes straight from the autobahn examples.
Hope this helps.
Best,
Maznoz
Re: Write NiceHash bot, make lots of profit
Posted: Wed Jul 27, 2016 9:27 am
by Maznoz
Hi,
the connection seems to work now. I'm not receiving any profitability updates, but I'll start debugging that.
Thanks for the help so far.
Best,
Maznoz
Re: Write NiceHash bot, make lots of profit
Posted: Sun Oct 16, 2016 3:47 am
by kenedy
That's great news and you have done great job.well done
Re: Write NiceHash bot, make lots of profit
Posted: Fri Oct 28, 2016 11:40 pm
by JoeTheMiner
Steve Sokolowski wrote:Good morning!
We're proud to finally document our WAMP API, which allows users to obtain live statistics about the status of the pool. In the coming days, we also plan to provide methods that provide insight into users' workers and balances.
The first methods are now available at
https://prohashing.com/help.html#api-wamp.
For the first time, these methods make it possible for a user to write a "NiceHash bot." Since NiceHash provides an API with all the necessary properties and methods, a bot can be written to obtain pricing at NiceHash, compare it to profits provided by the WAMP API here, and if profit here is greater, then buy lots of hashrate from NiceHash and direct it here.
If programmed conservatively, this bot should never be at risk of losing money. During times of high profitability, profits here often soar to 33% above NiceHash. That should never happen, because a bot like this can drive a significant portion of NiceHash's hashrate here during those times up to the point that NiceHash's rate equalizes.
Is anyone interested in writing this bot? We aren't asking for any cut of the profits that you earn; we just want someone to write it and run it to make themselves money so that we can take the pool fees. GenTarkin seems to have the expertise to make a lot of profit by doing this.
Hi Steve,
Just wanted to give you an update that I finally finished my bot tonight and have started it up. So you should start seeing more hashrate from me now!
Thanks,
Joseph
Re: Write NiceHash bot, make lots of profit
Posted: Sat Oct 29, 2016 12:19 am
by Chris Sokolowski
Thanks Joe. Let us know if there's any issues on the pool side that we can fix.